code
stringlengths
1
2.01M
repo_name
stringlengths
3
62
path
stringlengths
1
267
language
stringclasses
231 values
license
stringclasses
13 values
size
int64
1
2.01M
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is itstructures.com code. * * The Initial Developer of the Original Code is IT Structures. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> #define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit #include <atlbase.h> #include <atlstr.h> // TODO: reference additional headers your program requires here
zzhongster-activex
ff-activex-host/ffactivex/stdafx.h
C
lgpl
2,218
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is RSJ Software GmbH code. * * The Initial Developer of the Original Code is * RSJ Software GmbH. * Portions created by the Initial Developer are Copyright (C) 2009 * the Initial Developer. All Rights Reserved. * * Contributors: * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include <stdio.h> #include <windows.h> #include <winreg.h> #include "ffactivex.h" #include "common/stdafx.h" #include "axhost.h" #include "atlutil.h" #include "authorize.h" // ---------------------------------------------------------------------------- #define SUB_KEY L"SOFTWARE\\MozillaPlugins\\@itstructures.com/ffactivex\\MimeTypes\\application/x-itst-activex" // ---------------------------------------------------------------------------- BOOL TestExplicitAuthorizationUTF8 (const char *MimeType, const char *AuthorizationType, const char *DocumentUrl, const char *ProgramId); BOOL TestExplicitAuthorization (const wchar_t *MimeType, const wchar_t *AuthorizationType, const wchar_t *DocumentUrl, const wchar_t *ProgramId); BOOL WildcardMatch (const wchar_t *Mask, const wchar_t *Value); HKEY FindKey (const wchar_t *MimeType, const wchar_t *AuthorizationType); // --------------------------------------------------------------------------- HKEY BaseKeys[] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }; // ---------------------------------------------------------------------------- BOOL TestAuthorization (NPP Instance, int16 ArgC, char *ArgN[], char *ArgV[], const char *MimeType) { BOOL ret = FALSE; NPObject *globalObj = NULL; NPIdentifier identifier; NPVariant varLocation; NPVariant varHref; bool rc = false; int16 i; char *wrkHref; #ifdef NDEF _asm{int 3}; #endif if (Instance == NULL) { return (FALSE); } // Determine owning document // Get the window object. NPNFuncs.getvalue(Instance, NPNVWindowNPObject, &globalObj); // Create a "location" identifier. identifier = NPNFuncs.getstringidentifier("location"); // Get the location property from the window object (which is another object). rc = NPNFuncs.getproperty(Instance, globalObj, identifier, &varLocation); NPNFuncs.releaseobject(globalObj); if (!rc){ log(Instance, 0, "AxHost.TestAuthorization: could not get the location from the global object"); return false; } // Get a pointer to the "location" object. NPObject *locationObj = varLocation.value.objectValue; // Create a "href" identifier. identifier = NPNFuncs.getstringidentifier("href"); // Get the location property from the location object. rc = NPNFuncs.getproperty(Instance, locationObj, identifier, &varHref); NPNFuncs.releasevariantvalue(&varLocation); if (!rc) { log(Instance, 0, "AxHost.TestAuthorization: could not get the href from the location property"); return false; } ret = TRUE; wrkHref = (char *) alloca(varHref.value.stringValue.UTF8Length + 1); memcpy(wrkHref, varHref.value.stringValue.UTF8Characters, varHref.value.stringValue.UTF8Length); wrkHref[varHref.value.stringValue.UTF8Length] = 0x00; NPNFuncs.releasevariantvalue(&varHref); for (i = 0; i < ArgC; ++i) { // search for any needed information: clsid, event handling directives, etc. if (0 == strnicmp(ArgN[i], PARAM_CLSID, strlen(PARAM_CLSID))) { ret &= TestExplicitAuthorizationUTF8(MimeType, PARAM_CLSID, wrkHref, ArgV[i]); } else if (0 == strnicmp(ArgN[i], PARAM_PROGID, strlen(PARAM_PROGID))) { // The class id of the control we are asked to load ret &= TestExplicitAuthorizationUTF8(MimeType, PARAM_PROGID, wrkHref, ArgV[i]); } else if( 0 == strnicmp(ArgN[i], PARAM_CODEBASEURL, strlen(PARAM_CODEBASEURL))) { ret &= TestExplicitAuthorizationUTF8(MimeType, PARAM_CODEBASEURL, wrkHref, ArgV[i]); } } log(Instance, 1, "AxHost.TestAuthorization: returning %s", ret ? "True" : "False"); return (ret); } // ---------------------------------------------------------------------------- BOOL TestExplicitAuthorizationUTF8 (const char *MimeType, const char *AuthorizationType, const char *DocumentUrl, const char *ProgramId) { USES_CONVERSION; BOOL ret; ret = TestExplicitAuthorization(A2W(MimeType), A2W(AuthorizationType), A2W(DocumentUrl), A2W(ProgramId)); return (ret); } // ---------------------------------------------------------------------------- BOOL TestExplicitAuthorization (const wchar_t *MimeType, const wchar_t *AuthorizationType, const wchar_t *DocumentUrl, const wchar_t *ProgramId) { BOOL ret = FALSE; #ifndef NO_REGISTRY_AUTHORIZE HKEY hKey; HKEY hSubKey; ULONG i; ULONG j; ULONG keyNameLen; ULONG valueNameLen; wchar_t keyName[_MAX_PATH]; wchar_t valueName[_MAX_PATH]; if (DocumentUrl == NULL) { return (FALSE); } if (ProgramId == NULL) { return (FALSE); } #ifdef NDEF MessageBox(NULL, DocumentUrl, ProgramId, MB_OK); #endif if ((hKey = FindKey(MimeType, AuthorizationType)) != NULL) { for (i = 0; !ret; i++) { keyNameLen = sizeof(keyName); if (RegEnumKey(hKey, i, keyName, keyNameLen) == ERROR_SUCCESS) { if (WildcardMatch(keyName, DocumentUrl)) { if (RegOpenKeyEx(hKey, keyName, 0, KEY_QUERY_VALUE, &hSubKey) == ERROR_SUCCESS) { for (j = 0; ; j++) { valueNameLen = sizeof(valueName); if (RegEnumValue(hSubKey, j, valueName, &valueNameLen, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) { break; } if (WildcardMatch(valueName, ProgramId)) { ret = TRUE; break; } } RegCloseKey(hSubKey); } if (ret) { break; } } } else { break; } } RegCloseKey(hKey); } #endif return (ret); } // ---------------------------------------------------------------------------- BOOL WildcardMatch (const wchar_t *Mask, const wchar_t *Value) { size_t i; size_t j = 0; size_t maskLen; size_t valueLen; maskLen = wcslen(Mask); valueLen = wcslen(Value); for (i = 0; i < maskLen + 1; i++) { if (Mask[i] == '?') { j++; continue; } if (Mask[i] == '*') { for (; j < valueLen + 1; j++) { if (WildcardMatch(Mask + i + 1, Value + j)) { return (TRUE); } } return (FALSE); } if ((j <= valueLen) && (Mask[i] == tolower(Value[j]))) { j++; continue; } return (FALSE); } return (TRUE); } // ---------------------------------------------------------------------------- HKEY FindKey (const wchar_t *MimeType, const wchar_t *AuthorizationType) { HKEY ret = NULL; HKEY plugins; wchar_t searchKey[_MAX_PATH]; wchar_t pluginName[_MAX_PATH]; DWORD j; size_t i; for (i = 0; i < ARRAYSIZE(BaseKeys); i++) { if (RegOpenKeyEx(BaseKeys[i], L"SOFTWARE\\MozillaPlugins", 0, KEY_ENUMERATE_SUB_KEYS, &plugins) == ERROR_SUCCESS) { for (j = 0; ret == NULL; j++) { if (RegEnumKey(plugins, j, pluginName, sizeof(pluginName)) != ERROR_SUCCESS) { break; } wsprintf(searchKey, L"%s\\MimeTypes\\%s\\%s", pluginName, MimeType, AuthorizationType); if (RegOpenKeyEx(plugins, searchKey, 0, KEY_ENUMERATE_SUB_KEYS, &ret) == ERROR_SUCCESS) { break; } ret = NULL; } RegCloseKey(plugins); if (ret != NULL) { break; } } } return (ret); }
zzhongster-activex
ff-activex-host/ffactivex/authorize.cpp
C++
lgpl
10,024
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is itstructures.com code. * * The Initial Developer of the Original Code is IT Structures. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor: * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include <atlbase.h> #include <atlsafe.h> #include <npapi.h> #include <npfunctions.h> #include <prtypes.h> #include <npruntime.h> #include "scriptable.h" #include "GenericNPObject.h" #include "variants.h" extern NPNetscapeFuncs NPNFuncs; BSTR Utf8StringToBstr(LPCSTR szStr, int iSize) { BSTR bstrVal; // Chars required for string int iReq = 0; if (iSize > 0) { if ((iReq = MultiByteToWideChar(CP_UTF8, 0, szStr, iSize, 0, 0)) == 0) { return (0); } } // Account for terminating 0. if (iReq != -1) { ++iReq; } if ((bstrVal = ::SysAllocStringLen(0, iReq)) == 0) { return (0); } memset(bstrVal, 0, iReq * sizeof(wchar_t)); if (iSize > 0) { // Convert into the buffer. if (MultiByteToWideChar(CP_UTF8, 0, szStr, iSize, bstrVal, iReq) == 0) { ::SysFreeString(bstrVal); return 0; } } return (bstrVal); } void BSTR2NPVar(BSTR bstr, NPVariant *npvar, NPP instance) { USES_CONVERSION; char *npStr = NULL; size_t sourceLen; size_t bytesNeeded; sourceLen = lstrlenW(bstr); bytesNeeded = WideCharToMultiByte(CP_UTF8, 0, bstr, sourceLen, NULL, 0, NULL, NULL); bytesNeeded += 1; // complete lack of documentation on Mozilla's part here, I have no // idea how this string is supposed to be freed npStr = (char *)NPNFuncs.memalloc(bytesNeeded); if (npStr) { memset(npStr, 0, bytesNeeded); WideCharToMultiByte(CP_UTF8, 0, bstr, sourceLen, npStr, bytesNeeded - 1, NULL, NULL); STRINGZ_TO_NPVARIANT(npStr, (*npvar)); } else { STRINGZ_TO_NPVARIANT(NULL, (*npvar)); } } void Dispatch2NPVar(IDispatch *disp, NPVariant *npvar, NPP instance) { NPObject *obj = NULL; obj = NPNFuncs.createobject(instance, &ScriptableNPClass); ((Scriptable *)obj)->setControl(disp); ((Scriptable *)obj)->setInstance(instance); OBJECT_TO_NPVARIANT(obj, (*npvar)); } void Unknown2NPVar(IUnknown *unk, NPVariant *npvar, NPP instance) { NPObject *obj = NULL; obj = NPNFuncs.createobject(instance, &ScriptableNPClass); ((Scriptable *)obj)->setControl(unk); ((Scriptable *)obj)->setInstance(instance); OBJECT_TO_NPVARIANT(obj, (*npvar)); } NPObject * SafeArray2NPObject(SAFEARRAY *parray, unsigned short dim, unsigned long *pindices, NPP instance) { unsigned long *indices = pindices; NPObject *obj = NULL; bool rc = true; if (!parray || !instance) { return NULL; } obj = NPNFuncs.createobject(instance, &GenericNPObjectClass); if (NULL == obj) { return NULL; } do { if (NULL == indices) { // just getting started SafeArrayLock(parray); indices = (unsigned long *)calloc(1, parray->cDims * sizeof(unsigned long)); if (NULL == indices) { rc = false; break; } } NPIdentifier id = NULL; NPVariant val; VOID_TO_NPVARIANT(val); for(indices[dim] = 0; indices[dim] < parray->rgsabound[dim].cElements; indices[dim]++) { if (dim == (parray->cDims - 1)) { // single dimension (or the bottom of the recursion) if (parray->fFeatures & FADF_VARIANT) { VARIANT variant; VariantInit(&variant); if(FAILED(SafeArrayGetElement(parray, (long *)indices, &variant))) { rc = false; break; } Variant2NPVar(&variant, &val, instance); VariantClear(&variant); } else if (parray->fFeatures & FADF_BSTR) { BSTR bstr; if(FAILED(SafeArrayGetElement(parray, (long *)indices, &bstr))) { rc = false; break; } BSTR2NPVar(bstr, &val, instance); } else if (parray->fFeatures & FADF_DISPATCH) { IDispatch *disp; if(FAILED(SafeArrayGetElement(parray, (long *)indices, &disp))) { rc = false; break; } Dispatch2NPVar(disp, &val, instance); } else if (parray->fFeatures & FADF_UNKNOWN) { IUnknown *unk; if(FAILED(SafeArrayGetElement(parray, (long *)indices, &unk))) { rc = false; break; } Unknown2NPVar(unk, &val, instance); } } else { // recurse NPObject *o = SafeArray2NPObject(parray, dim + 1, indices, instance); if (NULL == o) { rc = false; break; } OBJECT_TO_NPVARIANT(o, val); } id = NPNFuncs.getintidentifier(parray->rgsabound[dim].lLbound + indices[dim]); // setproperty will call retainobject or copy the internal string, we should // release variant NPNFuncs.setproperty(instance, obj, id, &val); NPNFuncs.releasevariantvalue(&val); VOID_TO_NPVARIANT(val); } } while (0); if (false == rc) { if (!pindices && indices) { free(indices); indices = NULL; SafeArrayUnlock(parray); } if (obj) { NPNFuncs.releaseobject(obj); obj = NULL; } } return obj; } #define GETVALUE(var, val) (((var->vt) & VT_BYREF) ? *(var->p##val) : (var->val)) void Variant2NPVar(const VARIANT *var, NPVariant *npvar, NPP instance) { NPObject *obj = NULL; SAFEARRAY *parray = NULL; if (!var || !npvar) { return; } VOID_TO_NPVARIANT(*npvar); switch (var->vt & ~VT_BYREF) { case VT_EMPTY: VOID_TO_NPVARIANT((*npvar)); break; case VT_NULL: NULL_TO_NPVARIANT((*npvar)); break; case VT_LPSTR: // not sure it can even appear in a VARIANT, but... STRINGZ_TO_NPVARIANT(var->pcVal, (*npvar)); break; case VT_BSTR: BSTR2NPVar(GETVALUE(var, bstrVal), npvar, instance); break; case VT_I1: INT32_TO_NPVARIANT((int32)GETVALUE(var, cVal), (*npvar)); break; case VT_I2: INT32_TO_NPVARIANT((int32)GETVALUE(var, iVal), (*npvar)); break; case VT_I4: INT32_TO_NPVARIANT((int32)GETVALUE(var, lVal), (*npvar)); break; case VT_UI1: INT32_TO_NPVARIANT((int32)GETVALUE(var, bVal), (*npvar)); break; case VT_UI2: INT32_TO_NPVARIANT((int32)GETVALUE(var, uiVal), (*npvar)); break; case VT_UI4: INT32_TO_NPVARIANT((int32)GETVALUE(var, ulVal), (*npvar)); break; case VT_BOOL: BOOLEAN_TO_NPVARIANT((GETVALUE(var, boolVal) == VARIANT_TRUE) ? true : false, (*npvar)); break; case VT_R4: DOUBLE_TO_NPVARIANT((double)GETVALUE(var, fltVal), (*npvar)); break; case VT_R8: DOUBLE_TO_NPVARIANT(GETVALUE(var, dblVal), (*npvar)); break; case VT_DISPATCH: Dispatch2NPVar(GETVALUE(var, pdispVal), npvar, instance); break; case VT_UNKNOWN: Unknown2NPVar(GETVALUE(var, punkVal), npvar, instance); break; case VT_CY: DOUBLE_TO_NPVARIANT((double)GETVALUE(var, cyVal).int64 / 10000, (*npvar)); break; case VT_DATE: BSTR bstrVal; VarBstrFromDate(GETVALUE(var, date), 0, 0, &bstrVal); BSTR2NPVar(bstrVal, npvar, instance); break; default: if (var->vt & VT_ARRAY) { obj = SafeArray2NPObject(GETVALUE(var, parray), 0, NULL, instance); OBJECT_TO_NPVARIANT(obj, (*npvar)); } break; } } #undef GETVALUE void NPVar2Variant(const NPVariant *npvar, VARIANT *var, NPP instance) { USES_CONVERSION; if (!var || !npvar) { return; } switch (npvar->type) { case NPVariantType_Void: var->vt = VT_VOID; var->ulVal = 0; break; case NPVariantType_Null: var->vt = VT_PTR; var->byref = NULL; break; case NPVariantType_Bool: var->vt = VT_BOOL; var->ulVal = npvar->value.boolValue; break; case NPVariantType_Int32: var->vt = VT_UI4; var->ulVal = npvar->value.intValue; break; case NPVariantType_Double: var->vt = VT_R8; var->dblVal = npvar->value.doubleValue; break; case NPVariantType_String: var->vt = VT_BSTR; var->bstrVal = Utf8StringToBstr(npvar->value.stringValue.UTF8Characters, npvar->value.stringValue.UTF8Length); break; case NPVariantType_Object: NPIdentifier *identifiers = NULL; uint32_t identifierCount = 0; NPObject *object = NPVARIANT_TO_OBJECT(*npvar); if (NPNFuncs.enumerate(instance, object, &identifiers, &identifierCount)) { CComSafeArray<VARIANT> variants; for (uint32_t index = 0; index < identifierCount; ++index) { NPVariant npVariant; if (NPNFuncs.getproperty(instance, object, identifiers[index], &npVariant)) { if (npVariant.type != NPVariantType_Object) { CComVariant variant; NPVar2Variant(&npVariant, &variant, instance); variants.Add(variant); } NPNFuncs.releasevariantvalue(&npVariant); } } NPNFuncs.memfree(identifiers); *reinterpret_cast<CComVariant*>(var) = variants; } else { var->vt = VT_VOID; var->ulVal = 0; } break; } }
zzhongster-activex
ff-activex-host/ffactivex/variants.cpp
C++
lgpl
10,569
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is itstructures.com code. * * The Initial Developer of the Original Code is IT Structures. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include <algorithm> #include <string> #include "GenericNPObject.h" static NPObject* AllocateGenericNPObject(NPP npp, NPClass *aClass) { return new GenericNPObject(npp, false); } static NPObject* AllocateMethodNPObject(NPP npp, NPClass *aClass) { return new GenericNPObject(npp, true); } static void DeallocateGenericNPObject(NPObject *obj) { if (!obj) { return; } GenericNPObject *m = (GenericNPObject *)obj; delete m; } static void InvalidateGenericNPObject(NPObject *obj) { if (!obj) { return; } ((GenericNPObject *)obj)->Invalidate(); } NPClass GenericNPObjectClass = { /* version */ NP_CLASS_STRUCT_VERSION, /* allocate */ AllocateGenericNPObject, /* deallocate */ DeallocateGenericNPObject, /* invalidate */ InvalidateGenericNPObject, /* hasMethod */ GenericNPObject::_HasMethod, /* invoke */ GenericNPObject::_Invoke, /* invokeDefault */ GenericNPObject::_InvokeDefault, /* hasProperty */ GenericNPObject::_HasProperty, /* getProperty */ GenericNPObject::_GetProperty, /* setProperty */ GenericNPObject::_SetProperty, /* removeProperty */ GenericNPObject::_RemoveProperty, /* enumerate */ GenericNPObject::_Enumerate, /* construct */ NULL }; NPClass MethodNPObjectClass = { /* version */ NP_CLASS_STRUCT_VERSION, /* allocate */ AllocateMethodNPObject, /* deallocate */ DeallocateGenericNPObject, /* invalidate */ InvalidateGenericNPObject, /* hasMethod */ GenericNPObject::_HasMethod, /* invoke */ GenericNPObject::_Invoke, /* invokeDefault */ GenericNPObject::_InvokeDefault, /* hasProperty */ GenericNPObject::_HasProperty, /* getProperty */ GenericNPObject::_GetProperty, /* setProperty */ GenericNPObject::_SetProperty, /* removeProperty */ GenericNPObject::_RemoveProperty, /* enumerate */ GenericNPObject::_Enumerate, /* construct */ NULL }; // Some standard JavaScript methods bool toString(void *object, const NPVariant *args, uint32_t argCount, NPVariant *result) { GenericNPObject *map = (GenericNPObject *)object; if (!map || map->invalid) return false; // no args expected or cared for... std::string out; std::vector<NPVariant>::iterator it; for (it = map->numeric_mapper.begin(); it < map->numeric_mapper.end(); ++it) { if (NPVARIANT_IS_VOID(*it)) { out += ","; } else if (NPVARIANT_IS_NULL(*it)) { out += ","; } else if (NPVARIANT_IS_BOOLEAN(*it)) { if ((*it).value.boolValue) { out += "true,"; } else { out += "false,"; } } else if (NPVARIANT_IS_INT32(*it)) { char tmp[50]; memset(tmp, 0, sizeof(tmp)); _snprintf(tmp, 49, "%d,", (*it).value.intValue); out += tmp; } else if (NPVARIANT_IS_DOUBLE(*it)) { char tmp[50]; memset(tmp, 0, sizeof(tmp)); _snprintf(tmp, 49, "%f,", (*it).value.doubleValue); out += tmp; } else if (NPVARIANT_IS_STRING(*it)) { out += (*it).value.stringValue.UTF8Characters; out += ","; } else if (NPVARIANT_IS_OBJECT(*it)) { out += "[object],"; } } // calculate how much space we need std::string::size_type size = out.length(); char *s = (char *)NPNFuncs.memalloc(size * sizeof(char)); if (NULL == s) { return false; } memcpy(s, out.c_str(), size); s[size - 1] = 0; // overwrite the last "," STRINGZ_TO_NPVARIANT(s, (*result)); return true; } // Some helpers static void free_numeric_element(NPVariant elem) { NPNFuncs.releasevariantvalue(&elem); } static void free_alpha_element(std::pair<const char *, NPVariant> elem) { NPNFuncs.releasevariantvalue(&(elem.second)); } // And now the GenericNPObject implementation GenericNPObject::GenericNPObject(NPP instance, bool isMethodObj): invalid(false), defInvoker(NULL), defInvokerObject(NULL) { NPVariant val; INT32_TO_NPVARIANT(0, val); immutables["length"] = val; if (!isMethodObj) { NPObject *obj = NULL; obj = NPNFuncs.createobject(instance, &MethodNPObjectClass); if (NULL == obj) { throw NULL; } ((GenericNPObject *)obj)->SetDefaultInvoker(&toString, this); OBJECT_TO_NPVARIANT(obj, val); immutables["toString"] = val; } } GenericNPObject::~GenericNPObject() { for_each(immutables.begin(), immutables.end(), free_alpha_element); for_each(alpha_mapper.begin(), alpha_mapper.end(), free_alpha_element); for_each(numeric_mapper.begin(), numeric_mapper.end(), free_numeric_element); } bool GenericNPObject::HasMethod(NPIdentifier name) { if (invalid) return false; if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (immutables.count(key) > 0) { if (NPVARIANT_IS_OBJECT(immutables[key])) { return (NULL != immutables[key].value.objectValue->_class->invokeDefault); } } else if (alpha_mapper.count(key) > 0) { if (NPVARIANT_IS_OBJECT(alpha_mapper[key])) { return (NULL != alpha_mapper[key].value.objectValue->_class->invokeDefault); } } } return false; } bool GenericNPObject::Invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) { if (invalid) return false; if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (immutables.count(key) > 0) { if ( NPVARIANT_IS_OBJECT(immutables[key]) && immutables[key].value.objectValue->_class->invokeDefault) { return immutables[key].value.objectValue->_class->invokeDefault(immutables[key].value.objectValue, args, argCount, result); } } else if (alpha_mapper.count(key) > 0) { if ( NPVARIANT_IS_OBJECT(alpha_mapper[key]) && alpha_mapper[key].value.objectValue->_class->invokeDefault) { return alpha_mapper[key].value.objectValue->_class->invokeDefault(alpha_mapper[key].value.objectValue, args, argCount, result); } } } return true; } bool GenericNPObject::InvokeDefault(const NPVariant *args, uint32_t argCount, NPVariant *result) { if (invalid) return false; if (defInvoker) { defInvoker(defInvokerObject, args, argCount, result); } return true; } // This method is also called before the JS engine attempts to add a new // property, most likely it's trying to check that the key is supported. // It only returns false if the string name was not found, or does not // hold a callable object bool GenericNPObject::HasProperty(NPIdentifier name) { if (invalid) return false; if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (immutables.count(key) > 0) { if (NPVARIANT_IS_OBJECT(immutables[key])) { return (NULL == immutables[key].value.objectValue->_class->invokeDefault); } } else if (alpha_mapper.count(key) > 0) { if (NPVARIANT_IS_OBJECT(alpha_mapper[key])) { return (NULL == alpha_mapper[key].value.objectValue->_class->invokeDefault); } } return false; } return true; } static bool CopyNPVariant(NPVariant *dst, const NPVariant *src) { dst->type = src->type; if (NPVARIANT_IS_STRING(*src)) { NPUTF8 *str = (NPUTF8 *)NPNFuncs.memalloc((src->value.stringValue.UTF8Length + 1) * sizeof(NPUTF8)); if (NULL == str) { return false; } dst->value.stringValue.UTF8Length = src->value.stringValue.UTF8Length; memcpy(str, src->value.stringValue.UTF8Characters, src->value.stringValue.UTF8Length); str[dst->value.stringValue.UTF8Length] = 0; dst->value.stringValue.UTF8Characters = str; } else if (NPVARIANT_IS_OBJECT(*src)) { NPNFuncs.retainobject(NPVARIANT_TO_OBJECT(*src)); dst->value.objectValue = src->value.objectValue; } else { dst->value = src->value; } return true; } #define MIN(x, y) ((x) < (y)) ? (x) : (y) bool GenericNPObject::GetProperty(NPIdentifier name, NPVariant *result) { if (invalid) return false; try { if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (immutables.count(key) > 0) { if (!CopyNPVariant(result, &(immutables[key]))) { return false; } } else if (alpha_mapper.count(key) > 0) { if (!CopyNPVariant(result, &(alpha_mapper[key]))) { return false; } } } else { // assume int... unsigned long key = (unsigned long)NPNFuncs.intfromidentifier(name); if (numeric_mapper.size() > key) { if (!CopyNPVariant(result, &(numeric_mapper[key]))) { return false; } } } } catch (...) { } return true; } bool GenericNPObject::SetProperty(NPIdentifier name, const NPVariant *value) { if (invalid) return false; try { if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (immutables.count(key) > 0) { // the key is already defined as immutable, check the new value type if (value->type != immutables[key].type) { return false; } // Seems ok, copy the new value if (!CopyNPVariant(&(immutables[key]), value)) { return false; } } else if (!CopyNPVariant(&(alpha_mapper[key]), value)) { return false; } } else { // assume int... NPVariant var; if (!CopyNPVariant(&var, value)) { return false; } unsigned long key = (unsigned long)NPNFuncs.intfromidentifier(name); if (key >= numeric_mapper.size()) { // there's a gap we need to fill NPVariant pad; VOID_TO_NPVARIANT(pad); numeric_mapper.insert(numeric_mapper.end(), key - numeric_mapper.size() + 1, pad); } numeric_mapper.at(key) = var; NPVARIANT_TO_INT32(immutables["length"])++; } } catch (...) { } return true; } bool GenericNPObject::RemoveProperty(NPIdentifier name) { if (invalid) return false; try { if (NPNFuncs.identifierisstring(name)) { char *key = NPNFuncs.utf8fromidentifier(name); if (alpha_mapper.count(key) > 0) { NPNFuncs.releasevariantvalue(&(alpha_mapper[key])); alpha_mapper.erase(key); } } else { // assume int... unsigned long key = (unsigned long)NPNFuncs.intfromidentifier(name); if (numeric_mapper.size() > key) { NPNFuncs.releasevariantvalue(&(numeric_mapper[key])); numeric_mapper.erase(numeric_mapper.begin() + key); } NPVARIANT_TO_INT32(immutables["length"])--; } } catch (...) { } return true; } bool GenericNPObject::Enumerate(NPIdentifier **identifiers, uint32_t *identifierCount) { if (invalid) return false; try { *identifiers = (NPIdentifier *)NPNFuncs.memalloc(sizeof(NPIdentifier) * numeric_mapper.size()); if (NULL == *identifiers) { return false; } *identifierCount = 0; std::vector<NPVariant>::iterator it; unsigned int i = 0; char str[10] = ""; for (it = numeric_mapper.begin(); it < numeric_mapper.end(); ++it, ++i) { // skip empty (padding) elements if (NPVARIANT_IS_VOID(*it)) continue; _snprintf(str, sizeof(str), "%u", i); (*identifiers)[(*identifierCount)++] = NPNFuncs.getstringidentifier(str); } } catch (...) { } return true; }
zzhongster-activex
ff-activex-host/ffactivex/GenericNPObject.cpp
C++
lgpl
12,906
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by ffactivex.rc // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
zzhongster-activex
ff-activex-host/ffactivex/resource.h
C
lgpl
403
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is itstructures.com code. * * The Initial Developer of the Original Code is IT Structures. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ class CAxHost { private: CAxHost(const CAxHost &); NPP instance; bool isValidClsID; bool isKnown; protected: // The window handle to our plugin area in the browser HWND Window; WNDPROC OldProc; // The class/prog id of the control CLSID ClsID; LPCWSTR CodeBaseUrl; CControlEventSinkInstance *Sink; public: CAxHost(NPP inst); ~CAxHost(); CControlSiteInstance *Site; PropertyList Props; void setWindow(HWND win); HWND getWinfow(); void UpdateRect(RECT rcPos); bool verifyClsID(LPOLESTR oleClsID); bool setClsID(const char *clsid); bool setClsIDFromProgID(const char *progid); void setCodeBaseUrl(LPCWSTR clsid); bool hasValidClsID(); bool CreateControl(bool subscribeToEvents); bool AddEventHandler(wchar_t *name, wchar_t *handler); int16 HandleEvent(void *event); NPObject *GetScriptableObject(); };
zzhongster-activex
ff-activex-host/ffactivex/axhost.h
C++
lgpl
2,570
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is itstructures.com code. * * The Initial Developer of the Original Code is IT Structures. * Portions created by the Initial Developer are Copyright (C) 2008 * the Initial Developer. All Rights Reserved. * * Contributor: * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // ffactivex.cpp : Defines the exported functions for the DLL application. // #include "ffactivex.h" #include "common/stdafx.h" #include "axhost.h" #include "atlutil.h" #include "authorize.h" // A list of trusted domains // Each domain name may start with a '*' to specify that sub domains are // trusted as well // Note that a '.' is not enforced after the '*' static const char *TrustedLocations[] = {NULL}; static const unsigned int numTrustedLocations = 0; static const char *LocalhostName = "localhost"; static const bool TrustLocalhost = true; void * ffax_calloc(unsigned int size) { void *ptr = NULL; ptr = NPNFuncs.memalloc(size); if (ptr) { memset(ptr, 0, size); } return ptr; } void ffax_free(void *ptr) { if (ptr) NPNFuncs.memfree(ptr); } // // Gecko API // static unsigned int log_level = 0; static char *logger = NULL; void log(NPP instance, unsigned int level, char *message, ...) { NPVariant result; NPVariant args; NPObject *globalObj = NULL; bool rc = false; char *formatted = NULL; char *new_formatted = NULL; int buff_len = 0; int size = 0; va_list list; if (!logger || (level > log_level)) { return; } buff_len = strlen(message); buff_len += buff_len / 10; formatted = (char *)calloc(1, buff_len); while (true) { va_start(list, message); size = vsnprintf_s(formatted, buff_len, _TRUNCATE, message, list); va_end(list); if (size > -1 && size < buff_len) break; buff_len *= 2; new_formatted = (char *)realloc(formatted, buff_len); if (NULL == new_formatted) { free(formatted); return; } formatted = new_formatted; new_formatted = NULL; } NPNFuncs.getvalue(instance, NPNVWindowNPObject, &globalObj); NPIdentifier handler = NPNFuncs.getstringidentifier(logger); STRINGZ_TO_NPVARIANT(formatted, args); bool success = NPNFuncs.invoke(instance, globalObj, handler, &args, 1, &result); NPNFuncs.releasevariantvalue(&result); NPNFuncs.releaseobject(globalObj); free(formatted); } static bool MatchURL2TrustedLocations(NPP instance, LPCTSTR matchUrl) { USES_CONVERSION; bool rc = false; CUrl url; if (!numTrustedLocations) { return true; } rc = url.CrackUrl(matchUrl, ATL_URL_DECODE); if (!rc) { log(instance, 0, "AxHost.MatchURL2TrustedLocations: failed to parse the current location URL"); return false; } if ( (url.GetScheme() == ATL_URL_SCHEME_FILE) || (!strncmp(LocalhostName, W2A(url.GetHostName()), strlen(LocalhostName)))){ return TrustLocalhost; } for (unsigned int i = 0; i < numTrustedLocations; ++i) { if (TrustedLocations[i][0] == '*') { // sub domains are trusted unsigned int len = strlen(TrustedLocations[i]); bool match = 0; if (url.GetHostNameLength() < len) { // can't be a match continue; } --len; // skip the '*' match = strncmp(W2A(url.GetHostName()) + (url.GetHostNameLength() - len), // anchor the comparison to the end of the domain name TrustedLocations[i] + 1, // skip the '*' len) == 0 ? true : false; if (match) { return true; } } else if (!strncmp(W2A(url.GetHostName()), TrustedLocations[i], url.GetHostNameLength())) { return true; } } return false; } static bool VerifySiteLock(NPP instance) { USES_CONVERSION; NPObject *globalObj = NULL; NPIdentifier identifier; NPVariant varLocation; NPVariant varHref; bool rc = false; // Get the window object. NPNFuncs.getvalue(instance, NPNVWindowNPObject, &globalObj); // Create a "location" identifier. identifier = NPNFuncs.getstringidentifier("location"); // Get the location property from the window object (which is another object). rc = NPNFuncs.getproperty(instance, globalObj, identifier, &varLocation); NPNFuncs.releaseobject(globalObj); if (!rc){ log(instance, 0, "AxHost.VerifySiteLock: could not get the location from the global object"); return false; } // Get a pointer to the "location" object. NPObject *locationObj = varLocation.value.objectValue; // Create a "href" identifier. identifier = NPNFuncs.getstringidentifier("href"); // Get the location property from the location object. rc = NPNFuncs.getproperty(instance, locationObj, identifier, &varHref); NPNFuncs.releasevariantvalue(&varLocation); if (!rc) { log(instance, 0, "AxHost.VerifySiteLock: could not get the href from the location property"); return false; } rc = MatchURL2TrustedLocations(instance, A2W(varHref.value.stringValue.UTF8Characters)); NPNFuncs.releasevariantvalue(&varHref); if (false == rc) { log(instance, 0, "AxHost.VerifySiteLock: current location is not trusted"); } return rc; } /* * Create a new plugin instance, most probably through an embed/object HTML * element. * * Any private data we want to keep for this instance can be saved into * [instance->pdata]. * [saved] might hold information a previous instance that was invoked from the * same URL has saved for us. */ NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char *argn[], char *argv[], NPSavedData *saved) { NPError rc = NPERR_NO_ERROR; NPObject *browser = NULL; CAxHost *host = NULL; PropertyList events; int16 i = 0; USES_CONVERSION; //_asm {int 3}; if (!instance || (0 == NPNFuncs.size)) { return NPERR_INVALID_PARAM; } #ifdef NO_REGISTRY_AUTHORIZE // Verify that we're running from a trusted location if (!VerifySiteLock(instance)) { return NPERR_GENERIC_ERROR; } #endif instance->pdata = NULL; #ifndef NO_REGISTRY_AUTHORIZE if (!TestAuthorization (instance, argc, argn, argv, pluginType)) { return NPERR_GENERIC_ERROR; } #endif // TODO: Check the pluginType to make sure we're being called with the rigth MIME Type do { // Create a plugin instance, the actual control will be created once we // are given a window handle host = new CAxHost(instance); if (!host) { rc = NPERR_OUT_OF_MEMORY_ERROR; log(instance, 0, "AxHost.NPP_New: failed to allocate memory for a new host"); break; } // Iterate over the arguments we've been passed for (i = 0; (i < argc) && (NPERR_NO_ERROR == rc); ++i) { // search for any needed information: clsid, event handling directives, etc. if (0 == strnicmp(argn[i], PARAM_CLSID, strlen(PARAM_CLSID))) { // The class id of the control we are asked to load host->setClsID(argv[i]); } else if (0 == strnicmp(argn[i], PARAM_PROGID, strlen(PARAM_PROGID))) { // The class id of the control we are asked to load host->setClsIDFromProgID(argv[i]); } else if (0 == strnicmp(argn[i], PARAM_DEBUG, strlen(PARAM_DEBUG))) { // Logging verbosity log_level = atoi(argv[i]); log(instance, 0, "AxHost.NPP_New: debug level set to %d", log_level); } else if (0 == strnicmp(argn[i], PARAM_LOGGER, strlen(PARAM_LOGGER))) { // Logger function logger = strdup(argv[i]); } else if (0 == strnicmp(argn[i], PARAM_ONEVENT, strlen(PARAM_ONEVENT))) { // A request to handle one of the activex's events in JS events.AddOrReplaceNamedProperty(A2W(argn[i] + strlen(PARAM_ONEVENT)), CComVariant(A2W(argv[i]))); } else if (0 == strnicmp(argn[i], PARAM_PARAM, strlen(PARAM_PARAM))) { CComBSTR paramName = argn[i] + strlen(PARAM_PARAM); CComBSTR paramValue(Utf8StringToBstr(argv[i], strlen(argv[i]))); // Check for existing params with the same name BOOL bFound = FALSE; for (unsigned long j = 0; j < host->Props.GetSize(); j++) { if (wcscmp(host->Props.GetNameOf(j), (BSTR) paramName) == 0) { bFound = TRUE; break; } } // If the parameter already exists, don't add it to the // list again. if (bFound) { continue; } // Add named parameter to list CComVariant v(paramValue); host->Props.AddNamedProperty(paramName, v); } else if(0 == strnicmp(argn[i], PARAM_CODEBASEURL, strlen(PARAM_CODEBASEURL))) { if (MatchURL2TrustedLocations(instance, A2W(argv[i]))) { host->setCodeBaseUrl(A2W(argv[i])); } else { log(instance, 0, "AxHost.NPP_New: codeBaseUrl contains an untrusted location"); } } } if (NPERR_NO_ERROR != rc) break; // Make sure we have all the information we need to initialize a new instance if (!host->hasValidClsID()) { rc = NPERR_INVALID_PARAM; log(instance, 0, "AxHost.NPP_New: no valid CLSID or PROGID"); break; } instance->pdata = host; // if no events were requested, don't fail if subscribing fails if (!host->CreateControl(events.GetSize() ? true : false)) { rc = NPERR_GENERIC_ERROR; log(instance, 0, "AxHost.NPP_New: failed to create the control"); break; } for (unsigned int j = 0; j < events.GetSize(); j++) { if (!host->AddEventHandler(events.GetNameOf(j), events.GetValueOf(j)->bstrVal)) { //rc = NPERR_GENERIC_ERROR; //break; } } if (NPERR_NO_ERROR != rc) break; } while (0); if (NPERR_NO_ERROR != rc) { delete host; } return rc; } /* * Destroy an existing plugin instance. * * [save] can be used to save information for a future instance of our plugin * that'll be invoked by the same URL. */ NPError NPP_Destroy(NPP instance, NPSavedData **save) { // _asm {int 3}; if (!instance || !instance->pdata) { return NPERR_INVALID_PARAM; } log(instance, 0, "NPP_Destroy: destroying the control..."); CAxHost *host = (CAxHost *)instance->pdata; delete host; instance->pdata = NULL; return NPERR_NO_ERROR; } /* * Sets an instance's window parameters. */ NPError NPP_SetWindow(NPP instance, NPWindow *window) { CAxHost *host = NULL; RECT rcPos; if (!instance || !instance->pdata) { return NPERR_INVALID_PARAM; } host = (CAxHost *)instance->pdata; host->setWindow((HWND)window->window); rcPos.left = 0; rcPos.top = 0; rcPos.right = window->width; rcPos.bottom = window->height; host->UpdateRect(rcPos); return NPERR_NO_ERROR; }
zzhongster-activex
ff-activex-host/ffactivex/ffactivex.cpp
C++
lgpl
12,205
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "StdAfx.h" #include "PropertyBag.h" CPropertyBag::CPropertyBag() { } CPropertyBag::~CPropertyBag() { } /////////////////////////////////////////////////////////////////////////////// // IPropertyBag implementation HRESULT STDMETHODCALLTYPE CPropertyBag::Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog) { if (pszPropName == NULL) { return E_INVALIDARG; } if (pVar == NULL) { return E_INVALIDARG; } VARTYPE vt = pVar->vt; VariantInit(pVar); for (unsigned long i = 0; i < m_PropertyList.GetSize(); i++) { if (wcsicmp(m_PropertyList.GetNameOf(i), pszPropName) == 0) { const VARIANT *pvSrc = m_PropertyList.GetValueOf(i); if (!pvSrc) { return E_FAIL; } CComVariant vNew; HRESULT hr = (vt == VT_EMPTY) ? vNew.Copy(pvSrc) : vNew.ChangeType(vt, pvSrc); if (FAILED(hr)) { return E_FAIL; } // Copy the new value vNew.Detach(pVar); return S_OK; } } // Property does not exist in the bag return E_FAIL; } HRESULT STDMETHODCALLTYPE CPropertyBag::Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar) { if (pszPropName == NULL) { return E_INVALIDARG; } if (pVar == NULL) { return E_INVALIDARG; } CComBSTR bstrName(pszPropName); m_PropertyList.AddOrReplaceNamedProperty(bstrName, *pVar); return S_OK; }
zzhongster-activex
ff-activex-host/ffactivex/common/PropertyBag.cpp
C++
lgpl
3,426
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef PROPERTYBAG_H #define PROPERTYBAG_H #include "PropertyList.h" // Object wrapper for property list. This class can be set up with a // list of properties and used to initialise a control with them class CPropertyBag : public CComObjectRootEx<CComSingleThreadModel>, public IPropertyBag { // List of properties in the bag PropertyList m_PropertyList; public: // Constructor CPropertyBag(); // Destructor virtual ~CPropertyBag(); BEGIN_COM_MAP(CPropertyBag) COM_INTERFACE_ENTRY(IPropertyBag) END_COM_MAP() // IPropertyBag methods virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(/* [in] */ LPCOLESTR pszPropName, /* [out][in] */ VARIANT __RPC_FAR *pVar, /* [in] */ IErrorLog __RPC_FAR *pErrorLog); virtual HRESULT STDMETHODCALLTYPE Write(/* [in] */ LPCOLESTR pszPropName, /* [in] */ VARIANT __RPC_FAR *pVar); }; typedef CComObject<CPropertyBag> CPropertyBagInstance; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/PropertyBag.h
C++
lgpl
2,769
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef CONTROLSITE_H #define CONTROLSITE_H #include "IOleCommandTargetImpl.h" #include "PropertyList.h" // If you created a class derived from CControlSite, use the following macro // in the interface map of the derived class to include all the necessary // interfaces. #define CCONTROLSITE_INTERFACES() \ COM_INTERFACE_ENTRY(IOleWindow) \ COM_INTERFACE_ENTRY(IOleClientSite) \ COM_INTERFACE_ENTRY(IOleInPlaceSite) \ COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSite, IOleInPlaceSiteWindowless) \ COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteEx, IOleInPlaceSiteWindowless) \ COM_INTERFACE_ENTRY(IOleControlSite) \ COM_INTERFACE_ENTRY(IDispatch) \ COM_INTERFACE_ENTRY_IID(IID_IAdviseSink, IAdviseSinkEx) \ COM_INTERFACE_ENTRY_IID(IID_IAdviseSink2, IAdviseSinkEx) \ COM_INTERFACE_ENTRY_IID(IID_IAdviseSinkEx, IAdviseSinkEx) \ COM_INTERFACE_ENTRY(IOleCommandTarget) \ COM_INTERFACE_ENTRY(IServiceProvider) \ COM_INTERFACE_ENTRY(IBindStatusCallback) \ COM_INTERFACE_ENTRY(IWindowForBindingUI) // Temoporarily removed by bug 200680. Stops controls misbehaving and calling // windowless methods when they shouldn't. // COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceSiteWindowless, IOleInPlaceSiteWindowless) \ // Class that defines the control's security policy with regards to // what controls it hosts etc. class CControlSiteSecurityPolicy { public: // Test if the class is safe to host virtual BOOL IsClassSafeToHost(const CLSID & clsid) = 0; // Test if the specified class is marked safe for scripting virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) = 0; // Test if the instantiated object is safe for scripting on the specified interface virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) = 0; }; // // Class for hosting an ActiveX control // // This class supports both windowed and windowless classes. The normal // steps to hosting a control are this: // // CControlSiteInstance *pSite = NULL; // CControlSiteInstance::CreateInstance(&pSite); // pSite->AddRef(); // pSite->Create(clsidControlToCreate); // pSite->Attach(hwndParentWindow, rcPosition); // // Where propertyList is a named list of values to initialise the new object // with, hwndParentWindow is the window in which the control is being created, // and rcPosition is the position in window coordinates where the control will // be rendered. // // Destruction is this: // // pSite->Detach(); // pSite->Release(); // pSite = NULL; class CControlSite : public CComObjectRootEx<CComSingleThreadModel>, public CControlSiteSecurityPolicy, public IOleClientSite, public IOleInPlaceSiteWindowless, public IOleControlSite, public IAdviseSinkEx, public IDispatch, public IServiceProvider, public IOleCommandTargetImpl<CControlSite>, public IBindStatusCallback, public IWindowForBindingUI { public: // Site management values // Handle to parent window HWND m_hWndParent; // Position of the site and the contained object RECT m_rcObjectPos; // Flag indicating if client site should be set early or late unsigned m_bSetClientSiteFirst:1; // Flag indicating whether control is visible or not unsigned m_bVisibleAtRuntime:1; // Flag indicating if control is in-place active unsigned m_bInPlaceActive:1; // Flag indicating if control is UI active unsigned m_bUIActive:1; // Flag indicating if control is in-place locked and cannot be deactivated unsigned m_bInPlaceLocked:1; // Flag indicating if the site allows windowless controls unsigned m_bSupportWindowlessActivation:1; // Flag indicating if control is windowless (after being created) unsigned m_bWindowless:1; // Flag indicating if only safely scriptable controls are allowed unsigned m_bSafeForScriptingObjectsOnly:1; // Pointer to an externally registered service provider CComPtr<IServiceProvider> m_spServiceProvider; // Pointer to the OLE container CComPtr<IOleContainer> m_spContainer; // Return the default security policy object static CControlSiteSecurityPolicy *GetDefaultControlSecurityPolicy(); protected: // Pointers to object interfaces // Raw pointer to the object CComPtr<IUnknown> m_spObject; // Pointer to objects IViewObject interface CComQIPtr<IViewObject, &IID_IViewObject> m_spIViewObject; // Pointer to object's IOleObject interface CComQIPtr<IOleObject, &IID_IOleObject> m_spIOleObject; // Pointer to object's IOleInPlaceObject interface CComQIPtr<IOleInPlaceObject, &IID_IOleInPlaceObject> m_spIOleInPlaceObject; // Pointer to object's IOleInPlaceObjectWindowless interface CComQIPtr<IOleInPlaceObjectWindowless, &IID_IOleInPlaceObjectWindowless> m_spIOleInPlaceObjectWindowless; // CLSID of the control CLSID m_CLSID; // Parameter list PropertyList m_ParameterList; // Pointer to the security policy CControlSiteSecurityPolicy *m_pSecurityPolicy; // Binding variables // Flag indicating whether binding is in progress unsigned m_bBindingInProgress; // Result from the binding operation HRESULT m_hrBindResult; // Double buffer drawing variables used for windowless controls // Area of buffer RECT m_rcBuffer; // Bitmap to buffer HBITMAP m_hBMBuffer; // Bitmap to buffer HBITMAP m_hBMBufferOld; // Device context HDC m_hDCBuffer; // Clipping area of site HRGN m_hRgnBuffer; // Flags indicating how the buffer was painted DWORD m_dwBufferFlags; // Ambient properties // Locale ID LCID m_nAmbientLocale; // Foreground colour COLORREF m_clrAmbientForeColor; // Background colour COLORREF m_clrAmbientBackColor; // Flag indicating if control should hatch itself bool m_bAmbientShowHatching:1; // Flag indicating if control should have grab handles bool m_bAmbientShowGrabHandles:1; // Flag indicating if control is in edit/user mode bool m_bAmbientUserMode:1; // Flag indicating if control has a 3d border or not bool m_bAmbientAppearance:1; protected: // Notifies the attached control of a change to an ambient property virtual void FireAmbientPropertyChange(DISPID id); public: // Construction and destruction // Constructor CControlSite(); // Destructor virtual ~CControlSite(); BEGIN_COM_MAP(CControlSite) CCONTROLSITE_INTERFACES() END_COM_MAP() BEGIN_OLECOMMAND_TABLE() END_OLECOMMAND_TABLE() // Returns the window used when processing ole commands HWND GetCommandTargetWindow() { return NULL; // TODO } // Object creation and management functions // Creates and initialises an object virtual HRESULT Create(REFCLSID clsid, PropertyList &pl = PropertyList(), LPCWSTR szCodebase = NULL, IBindCtx *pBindContext = NULL); // Attaches the object to the site virtual HRESULT Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream = NULL); // Detaches the object from the site virtual HRESULT Detach(); // Returns the IUnknown pointer for the object virtual HRESULT GetControlUnknown(IUnknown **ppObject); // Sets the bounding rectangle for the object virtual HRESULT SetPosition(const RECT &rcPos); // Draws the object using the provided DC virtual HRESULT Draw(HDC hdc); // Performs the specified action on the object virtual HRESULT DoVerb(LONG nVerb, LPMSG lpMsg = NULL); // Sets an advise sink up for changes to the object virtual HRESULT Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie); // Removes an advise sink virtual HRESULT Unadvise(const IID &iid, DWORD dwCookie); // Register an external service provider object virtual void SetServiceProvider(IServiceProvider *pSP) { m_spServiceProvider = pSP; } virtual void SetContainer(IOleContainer *pContainer) { m_spContainer = pContainer; } // Set the security policy object. Ownership of this object remains with the caller and the security // policy object is meant to exist for as long as it is set here. virtual void SetSecurityPolicy(CControlSiteSecurityPolicy *pSecurityPolicy) { m_pSecurityPolicy = pSecurityPolicy; } virtual CControlSiteSecurityPolicy *GetSecurityPolicy() const { return m_pSecurityPolicy; } // Methods to set ambient properties virtual void SetAmbientUserMode(BOOL bUser); // Inline helper methods // Returns the object's CLSID virtual const CLSID &GetObjectCLSID() const { return m_CLSID; } // Tests if the object is valid or not virtual BOOL IsObjectValid() const { return (m_spObject) ? TRUE : FALSE; } // Returns the parent window to this one virtual HWND GetParentWindow() const { return m_hWndParent; } // Returns the inplace active state of the object virtual BOOL IsInPlaceActive() const { return m_bInPlaceActive; } // CControlSiteSecurityPolicy // Test if the class is safe to host virtual BOOL IsClassSafeToHost(const CLSID & clsid); // Test if the specified class is marked safe for scripting virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists); // Test if the instantiated object is safe for scripting on the specified interface virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid); // Test if the instantiated object is safe for scripting on the specified interface virtual BOOL IsObjectSafeForScripting(const IID &iid); // IServiceProvider virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID guidService, REFIID riid, void** ppv); // IDispatch virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo); virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); // IAdviseSink implementation virtual /* [local] */ void STDMETHODCALLTYPE OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed); virtual /* [local] */ void STDMETHODCALLTYPE OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex); virtual /* [local] */ void STDMETHODCALLTYPE OnRename(/* [in] */ IMoniker __RPC_FAR *pmk); virtual /* [local] */ void STDMETHODCALLTYPE OnSave(void); virtual /* [local] */ void STDMETHODCALLTYPE OnClose(void); // IAdviseSink2 virtual /* [local] */ void STDMETHODCALLTYPE OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk); // IAdviseSinkEx implementation virtual /* [local] */ void STDMETHODCALLTYPE OnViewStatusChange(/* [in] */ DWORD dwViewStatus); // IOleWindow implementation virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); // IOleClientSite implementation virtual HRESULT STDMETHODCALLTYPE SaveObject(void); virtual HRESULT STDMETHODCALLTYPE GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk); virtual HRESULT STDMETHODCALLTYPE GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer); virtual HRESULT STDMETHODCALLTYPE ShowObject(void); virtual HRESULT STDMETHODCALLTYPE OnShowWindow(/* [in] */ BOOL fShow); virtual HRESULT STDMETHODCALLTYPE RequestNewObjectLayout(void); // IOleInPlaceSite implementation virtual HRESULT STDMETHODCALLTYPE CanInPlaceActivate(void); virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivate(void); virtual HRESULT STDMETHODCALLTYPE OnUIActivate(void); virtual HRESULT STDMETHODCALLTYPE GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo); virtual HRESULT STDMETHODCALLTYPE Scroll(/* [in] */ SIZE scrollExtant); virtual HRESULT STDMETHODCALLTYPE OnUIDeactivate(/* [in] */ BOOL fUndoable); virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivate(void); virtual HRESULT STDMETHODCALLTYPE DiscardUndoState(void); virtual HRESULT STDMETHODCALLTYPE DeactivateAndUndo(void); virtual HRESULT STDMETHODCALLTYPE OnPosRectChange(/* [in] */ LPCRECT lprcPosRect); // IOleInPlaceSiteEx implementation virtual HRESULT STDMETHODCALLTYPE OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags); virtual HRESULT STDMETHODCALLTYPE OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw); virtual HRESULT STDMETHODCALLTYPE RequestUIActivate(void); // IOleInPlaceSiteWindowless implementation virtual HRESULT STDMETHODCALLTYPE CanWindowlessActivate(void); virtual HRESULT STDMETHODCALLTYPE GetCapture(void); virtual HRESULT STDMETHODCALLTYPE SetCapture(/* [in] */ BOOL fCapture); virtual HRESULT STDMETHODCALLTYPE GetFocus(void); virtual HRESULT STDMETHODCALLTYPE SetFocus(/* [in] */ BOOL fFocus); virtual HRESULT STDMETHODCALLTYPE GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC); virtual HRESULT STDMETHODCALLTYPE ReleaseDC(/* [in] */ HDC hDC); virtual HRESULT STDMETHODCALLTYPE InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase); virtual HRESULT STDMETHODCALLTYPE InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase); virtual HRESULT STDMETHODCALLTYPE ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip); virtual HRESULT STDMETHODCALLTYPE AdjustRect(/* [out][in] */ LPRECT prc); virtual HRESULT STDMETHODCALLTYPE OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult); // IOleControlSite implementation virtual HRESULT STDMETHODCALLTYPE OnControlInfoChanged(void); virtual HRESULT STDMETHODCALLTYPE LockInPlaceActive(/* [in] */ BOOL fLock); virtual HRESULT STDMETHODCALLTYPE GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp); virtual HRESULT STDMETHODCALLTYPE TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags); virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers); virtual HRESULT STDMETHODCALLTYPE OnFocus(/* [in] */ BOOL fGotFocus); virtual HRESULT STDMETHODCALLTYPE ShowPropertyFrame( void); // IBindStatusCallback virtual HRESULT STDMETHODCALLTYPE OnStartBinding(/* [in] */ DWORD dwReserved, /* [in] */ IBinding __RPC_FAR *pib); virtual HRESULT STDMETHODCALLTYPE GetPriority(/* [out] */ LONG __RPC_FAR *pnPriority); virtual HRESULT STDMETHODCALLTYPE OnLowResource(/* [in] */ DWORD reserved); virtual HRESULT STDMETHODCALLTYPE OnProgress(/* [in] */ ULONG ulProgress, /* [in] */ ULONG ulProgressMax, /* [in] */ ULONG ulStatusCode, /* [in] */ LPCWSTR szStatusText); virtual HRESULT STDMETHODCALLTYPE OnStopBinding(/* [in] */ HRESULT hresult, /* [unique][in] */ LPCWSTR szError); virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetBindInfo( /* [out] */ DWORD __RPC_FAR *grfBINDF, /* [unique][out][in] */ BINDINFO __RPC_FAR *pbindinfo); virtual /* [local] */ HRESULT STDMETHODCALLTYPE OnDataAvailable(/* [in] */ DWORD grfBSCF, /* [in] */ DWORD dwSize, /* [in] */ FORMATETC __RPC_FAR *pformatetc, /* [in] */ STGMEDIUM __RPC_FAR *pstgmed); virtual HRESULT STDMETHODCALLTYPE OnObjectAvailable(/* [in] */ REFIID riid, /* [iid_is][in] */ IUnknown __RPC_FAR *punk); // IWindowForBindingUI virtual HRESULT STDMETHODCALLTYPE GetWindow(/* [in] */ REFGUID rguidReason, /* [out] */ HWND *phwnd); }; typedef CComObject<CControlSite> CControlSiteInstance; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/ControlSite.h
C++
lgpl
18,659
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "StdAfx.h" #include "ItemContainer.h" CItemContainer::CItemContainer() { } CItemContainer::~CItemContainer() { } /////////////////////////////////////////////////////////////////////////////// // IParseDisplayName implementation HRESULT STDMETHODCALLTYPE CItemContainer::ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut) { // TODO return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// // IOleContainer implementation HRESULT STDMETHODCALLTYPE CItemContainer::EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum) { HRESULT hr = E_NOTIMPL; /* if (ppenum == NULL) { return E_POINTER; } *ppenum = NULL; typedef CComObject<CComEnumOnSTL<IEnumUnknown, &IID_IEnumUnknown, IUnknown*, _CopyInterface<IUnknown>, CNamedObjectList > > enumunk; enumunk* p = NULL; p = new enumunk; if(p == NULL) { return E_OUTOFMEMORY; } hr = p->Init(); if (SUCCEEDED(hr)) { hr = p->QueryInterface(IID_IEnumUnknown, (void**) ppenum); } if (FAILED(hRes)) { delete p; } */ return hr; } HRESULT STDMETHODCALLTYPE CItemContainer::LockContainer(/* [in] */ BOOL fLock) { // TODO return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IOleItemContainer implementation HRESULT STDMETHODCALLTYPE CItemContainer::GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) { if (pszItem == NULL) { return E_INVALIDARG; } if (ppvObject == NULL) { return E_INVALIDARG; } *ppvObject = NULL; return MK_E_NOOBJECT; } HRESULT STDMETHODCALLTYPE CItemContainer::GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage) { // TODO return MK_E_NOOBJECT; } HRESULT STDMETHODCALLTYPE CItemContainer::IsRunning(/* [in] */ LPOLESTR pszItem) { // TODO return MK_E_NOOBJECT; }
zzhongster-activex
ff-activex-host/ffactivex/common/ItemContainer.cpp
C++
lgpl
4,191
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef CONTROLEVENTSINK_H #define CONTROLEVENTSINK_H #include <map> // This class listens for events from the specified control class CControlEventSink : public CComObjectRootEx<CComSingleThreadModel>, public IDispatch { public: CControlEventSink(); // Current event connection point CComPtr<IConnectionPoint> m_spEventCP; CComPtr<ITypeInfo> m_spEventSinkTypeInfo; DWORD m_dwEventCookie; IID m_EventIID; typedef std::map<DISPID, wchar_t *> EventMap; EventMap events; NPP instance; protected: virtual ~CControlEventSink(); bool m_bSubscribed; static HRESULT WINAPI SinkQI(void* pv, REFIID riid, LPVOID* ppv, DWORD dw) { CControlEventSink *pThis = (CControlEventSink *) pv; if (!IsEqualIID(pThis->m_EventIID, GUID_NULL) && IsEqualIID(pThis->m_EventIID, riid)) { return pThis->QueryInterface(__uuidof(IDispatch), ppv); } return E_NOINTERFACE; } public: BEGIN_COM_MAP(CControlEventSink) COM_INTERFACE_ENTRY(IDispatch) COM_INTERFACE_ENTRY_FUNC_BLIND(0, SinkQI) END_COM_MAP() virtual HRESULT SubscribeToEvents(IUnknown *pControl); virtual void UnsubscribeFromEvents(); virtual BOOL GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo); virtual HRESULT InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr); // IDispatch virtual HRESULT STDMETHODCALLTYPE GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo); virtual HRESULT STDMETHODCALLTYPE GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo); virtual HRESULT STDMETHODCALLTYPE GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId); virtual /* [local] */ HRESULT STDMETHODCALLTYPE Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr); }; typedef CComObject<CControlEventSink> CControlEventSinkInstance; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/ControlEventSink.h
C++
lgpl
4,193
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "stdafx.h" #include "ControlSiteIPFrame.h" CControlSiteIPFrame::CControlSiteIPFrame() { m_hwndFrame = NULL; } CControlSiteIPFrame::~CControlSiteIPFrame() { } /////////////////////////////////////////////////////////////////////////////// // IOleWindow implementation HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) { if (phwnd == NULL) { return E_INVALIDARG; } *phwnd = m_hwndFrame; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) { return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IOleInPlaceUIWindow implementation HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::GetBorder(/* [out] */ LPRECT lprectBorder) { return INPLACE_E_NOTOOLSPACE; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) { return INPLACE_E_NOTOOLSPACE; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName) { return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IOleInPlaceFrame implementation HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::RemoveMenus(/* [in] */ HMENU hmenuShared) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::SetStatusText(/* [in] */ LPCOLESTR pszStatusText) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::EnableModeless(/* [in] */ BOOL fEnable) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSiteIPFrame::TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID) { return E_NOTIMPL; }
zzhongster-activex
ff-activex-host/ffactivex/common/ControlSiteIPFrame.cpp
C++
lgpl
4,105
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ // stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, // but are changed infrequently #if !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_) #define AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED_ #if _MSC_VER >= 1000 #pragma once #endif // _MSC_VER >= 1000 // under MSVC shut off copious warnings about debug symbol too long #ifdef _MSC_VER #pragma warning( disable: 4786 ) #endif //#include "jstypes.h" //#include "prtypes.h" // Mozilla headers //#include "jscompat.h" //#include "prthread.h" //#include "prprf.h" //#include "nsID.h" //#include "nsIComponentManager.h" //#include "nsIServiceManager.h" //#include "nsStringAPI.h" //#include "nsCOMPtr.h" //#include "nsComponentManagerUtils.h" //#include "nsServiceManagerUtils.h" //#include "nsIDocument.h" //#include "nsIDocumentObserver.h" //#include "nsVoidArray.h" //#include "nsIDOMNode.h" //#include "nsIDOMNodeList.h" //#include "nsIDOMDocument.h" //#include "nsIDOMDocumentType.h" //#include "nsIDOMElement.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> #define _ATL_APARTMENT_THREADED //#define _ATL_STATIC_REGISTRY // #define _ATL_DEBUG_INTERFACES // ATL headers // The ATL headers that come with the platform SDK have bad for scoping #if _MSC_VER >= 1400 #pragma conform(forScope, push, atlhack, off) #endif #include <atlbase.h> //You may derive a class from CComModule and use it if you want to override //something, but do not change the name of _Module extern CComModule _Module; #include <atlcom.h> #include <atlctl.h> #if _MSC_VER >= 1400 #pragma conform(forScope, pop, atlhack) #endif #include <mshtml.h> #include <mshtmhst.h> #include <docobj.h> //#include <winsock2.h> #include <comdef.h> #include <vector> #include <list> #include <string> // New winsock2.h doesn't define this anymore typedef long int32; #define NS_SCRIPTABLE #include "nscore.h" #include "npapi.h" //#include "npupp.h" #include "npfunctions.h" #include "nsID.h" #include <npruntime.h> #include "../variants.h" #include "PropertyList.h" #include "PropertyBag.h" #include "ItemContainer.h" #include "ControlSite.h" #include "ControlSiteIPFrame.h" #include "ControlEventSink.h" extern NPNetscapeFuncs NPNFuncs; // Turn off warnings about debug symbols for templates being too long #pragma warning(disable : 4786) #define TRACE_METHOD(fn) \ { \ ATLTRACE(_T("0x%04x %s()\n"), (int) GetCurrentThreadId(), _T(#fn)); \ } #define TRACE_METHOD_ARGS(fn, pattern, args) \ { \ ATLTRACE(_T("0x%04x %s(") _T(pattern) _T(")\n"), (int) GetCurrentThreadId(), _T(#fn), args); \ } //{{AFX_INSERT_LOCATION}} // Microsoft Developer Studio will insert additional declarations immediately before the previous line. #define NS_ASSERTION(x, y) #endif // !defined(AFX_STDAFX_H__1339B542_3453_11D2_93B9_000000000000__INCLUDED)
zzhongster-activex
ff-activex-host/ffactivex/common/StdAfx.h
C++
lgpl
5,055
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "StdAfx.h" #include "ControlEventSink.h" CControlEventSink::CControlEventSink() : m_dwEventCookie(0), m_bSubscribed(false), m_EventIID(GUID_NULL), events() { } CControlEventSink::~CControlEventSink() { UnsubscribeFromEvents(); } BOOL CControlEventSink::GetEventSinkIID(IUnknown *pControl, IID &iid, ITypeInfo **typeInfo) { iid = GUID_NULL; if (!pControl) { return E_INVALIDARG; } // IProvideClassInfo2 way is easiest // CComQIPtr<IProvideClassInfo2> classInfo2 = pControl; // if (classInfo2) // { // classInfo2->GetGUID(GUIDKIND_DEFAULT_SOURCE_DISP_IID, &iid); // if (!::IsEqualIID(iid, GUID_NULL)) // { // return TRUE; // } // } // Yuck, the hard way CComQIPtr<IProvideClassInfo> classInfo = pControl; if (!classInfo) { return FALSE; } // Search the class type information for the default source interface // which is the outgoing event sink. CComPtr<ITypeInfo> classTypeInfo; classInfo->GetClassInfo(&classTypeInfo); if (!classTypeInfo) { return FALSE; } TYPEATTR *classAttr = NULL; if (FAILED(classTypeInfo->GetTypeAttr(&classAttr))) { return FALSE; } INT implFlags = 0; for (UINT i = 0; i < classAttr->cImplTypes; i++) { // Search for the interface with the [default, source] attr if (SUCCEEDED(classTypeInfo->GetImplTypeFlags(i, &implFlags)) && implFlags == (IMPLTYPEFLAG_FDEFAULT | IMPLTYPEFLAG_FSOURCE)) { CComPtr<ITypeInfo> eventSinkTypeInfo; HREFTYPE hRefType; if (SUCCEEDED(classTypeInfo->GetRefTypeOfImplType(i, &hRefType)) && SUCCEEDED(classTypeInfo->GetRefTypeInfo(hRefType, &eventSinkTypeInfo))) { TYPEATTR *eventSinkAttr = NULL; if (SUCCEEDED(eventSinkTypeInfo->GetTypeAttr(&eventSinkAttr))) { iid = eventSinkAttr->guid; if (typeInfo) { *typeInfo = eventSinkTypeInfo.p; (*typeInfo)->AddRef(); } eventSinkTypeInfo->ReleaseTypeAttr(eventSinkAttr); } } break; } } classTypeInfo->ReleaseTypeAttr(classAttr); return (!::IsEqualIID(iid, GUID_NULL)); } void CControlEventSink::UnsubscribeFromEvents() { if (m_bSubscribed) { DWORD tmpCookie = m_dwEventCookie; m_dwEventCookie = 0; m_bSubscribed = false; // Unsubscribe and reset - This seems to complete release and destroy us... m_spEventCP->Unadvise(tmpCookie); // Unadvise handles the Release //m_spEventCP.Release(); } } HRESULT CControlEventSink::SubscribeToEvents(IUnknown *pControl) { if (!pControl) { return E_INVALIDARG; } // Throw away any existing connections UnsubscribeFromEvents(); // Grab the outgoing event sink IID which will be used to subscribe // to events via the connection point container. IID iidEventSink; CComPtr<ITypeInfo> typeInfo; if (!GetEventSinkIID(pControl, iidEventSink, &typeInfo)) { return E_FAIL; } // Get the connection point CComQIPtr<IConnectionPointContainer> ccp = pControl; CComPtr<IConnectionPoint> cp; if (!ccp) { return E_FAIL; } // Custom IID m_EventIID = iidEventSink; DWORD dwCookie = 0; if (!ccp || FAILED(ccp->FindConnectionPoint(m_EventIID, &cp)) || FAILED(cp->Advise(this, &dwCookie))) { return E_FAIL; } m_bSubscribed = true; m_spEventCP = cp; m_dwEventCookie = dwCookie; m_spEventSinkTypeInfo = typeInfo; return S_OK; } HRESULT CControlEventSink::InternalInvoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { USES_CONVERSION; if (DISPATCH_METHOD != wFlags) { // any other reason to call us?! return S_FALSE; } EventMap::iterator cur = events.find(dispIdMember); if (events.end() != cur) { // invoke this event handler NPVariant result; NPVariant *args = NULL; if (pDispParams->cArgs > 0) { args = (NPVariant *)calloc(pDispParams->cArgs, sizeof(NPVariant)); if (!args) { return S_FALSE; } for (unsigned int i = 0; i < pDispParams->cArgs; ++i) { // convert the arguments in reverse order Variant2NPVar(&pDispParams->rgvarg[i], &args[pDispParams->cArgs - i - 1], instance); } } NPObject *globalObj = NULL; NPNFuncs.getvalue(instance, NPNVWindowNPObject, &globalObj); NPIdentifier handler = NPNFuncs.getstringidentifier(W2A((*cur).second)); bool success = NPNFuncs.invoke(instance, globalObj, handler, args, pDispParams->cArgs, &result); NPNFuncs.releaseobject(globalObj); for (unsigned int i = 0; i < pDispParams->cArgs; ++i) { // convert the arguments if (args[i].type == NPVariantType_String) { // was allocated earlier by Variant2NPVar NPNFuncs.memfree((void *)args[i].value.stringValue.UTF8Characters); } } if (!success) { return S_FALSE; } if (pVarResult) { // set the result NPVar2Variant(&result, pVarResult, instance); } NPNFuncs.releasevariantvalue(&result); } return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IDispatch implementation HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlEventSink::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlEventSink::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlEventSink::Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr) { return InternalInvoke(dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); }
zzhongster-activex
ff-activex-host/ffactivex/common/ControlEventSink.cpp
C++
lgpl
8,596
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * Brent Booker * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include "StdAfx.h" #include <Objsafe.h> #include "ControlSite.h" #include "PropertyBag.h" #include "ControlSiteIPFrame.h" class CDefaultControlSiteSecurityPolicy : public CControlSiteSecurityPolicy { // Test if the specified class id implements the specified category BOOL ClassImplementsCategory(const CLSID & clsid, const CATID &catid, BOOL &bClassExists); public: // Test if the class is safe to host virtual BOOL IsClassSafeToHost(const CLSID & clsid); // Test if the specified class is marked safe for scripting virtual BOOL IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists); // Test if the instantiated object is safe for scripting on the specified interface virtual BOOL IsObjectSafeForScripting(IUnknown *pObject, const IID &iid); }; BOOL CDefaultControlSiteSecurityPolicy::ClassImplementsCategory(const CLSID &clsid, const CATID &catid, BOOL &bClassExists) { bClassExists = FALSE; // Test if there is a CLSID entry. If there isn't then obviously // the object doesn't exist and therefore doesn't implement any category. // In this situation, the function returns REGDB_E_CLASSNOTREG. CRegKey key; if (key.Open(HKEY_CLASSES_ROOT, _T("CLSID"), KEY_READ) != ERROR_SUCCESS) { // Must fail if we can't even open this! return FALSE; } LPOLESTR szCLSID = NULL; if (FAILED(StringFromCLSID(clsid, &szCLSID))) { return FALSE; } USES_CONVERSION; CRegKey keyCLSID; LONG lResult = keyCLSID.Open(key, W2CT(szCLSID), KEY_READ); CoTaskMemFree(szCLSID); if (lResult != ERROR_SUCCESS) { // Class doesn't exist return FALSE; } keyCLSID.Close(); // CLSID exists, so try checking what categories it implements bClassExists = TRUE; CComQIPtr<ICatInformation> spCatInfo; HRESULT hr = CoCreateInstance(CLSID_StdComponentCategoriesMgr, NULL, CLSCTX_INPROC_SERVER, IID_ICatInformation, (LPVOID*) &spCatInfo); if (spCatInfo == NULL) { // Must fail if we can't open the category manager return FALSE; } // See what categories the class implements CComQIPtr<IEnumCATID> spEnumCATID; if (FAILED(spCatInfo->EnumImplCategoriesOfClass(clsid, &spEnumCATID))) { // Can't enumerate classes in category so fail return FALSE; } // Search for matching categories BOOL bFound = FALSE; CATID catidNext = GUID_NULL; while (spEnumCATID->Next(1, &catidNext, NULL) == S_OK) { if (::IsEqualCATID(catid, catidNext)) { return TRUE; } } return FALSE; } // Test if the class is safe to host BOOL CDefaultControlSiteSecurityPolicy::IsClassSafeToHost(const CLSID & clsid) { return TRUE; } // Test if the specified class is marked safe for scripting BOOL CDefaultControlSiteSecurityPolicy::IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) { // Test the category the object belongs to return ClassImplementsCategory(clsid, CATID_SafeForScripting, bClassExists); } // Test if the instantiated object is safe for scripting on the specified interface BOOL CDefaultControlSiteSecurityPolicy::IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) { if (!pObject) { return FALSE; } // Ask the control if its safe for scripting CComQIPtr<IObjectSafety> spObjectSafety = pObject; if (!spObjectSafety) { return FALSE; } DWORD dwSupported = 0; // Supported options (mask) DWORD dwEnabled = 0; // Enabled options // Assume scripting via IDispatch if (FAILED(spObjectSafety->GetInterfaceSafetyOptions( iid, &dwSupported, &dwEnabled))) { // Interface is not safe or failure. return FALSE; } // Test if safe for scripting if (!(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) { // Object says it is not set to be safe, but supports unsafe calling, // try enabling it and asking again. if(!(dwSupported & INTERFACESAFE_FOR_UNTRUSTED_CALLER) || FAILED(spObjectSafety->SetInterfaceSafetyOptions( iid, INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER)) || FAILED(spObjectSafety->GetInterfaceSafetyOptions( iid, &dwSupported, &dwEnabled)) || !(dwEnabled & dwSupported) & INTERFACESAFE_FOR_UNTRUSTED_CALLER) { return FALSE; } } return TRUE; } /////////////////////////////////////////////////////////////////////////////// // Constructor CControlSite::CControlSite() { TRACE_METHOD(CControlSite::CControlSite); m_hWndParent = NULL; m_CLSID = CLSID_NULL; m_bSetClientSiteFirst = FALSE; m_bVisibleAtRuntime = TRUE; memset(&m_rcObjectPos, 0, sizeof(m_rcObjectPos)); m_bInPlaceActive = FALSE; m_bUIActive = FALSE; m_bInPlaceLocked = FALSE; m_bWindowless = FALSE; m_bSupportWindowlessActivation = TRUE; m_bSafeForScriptingObjectsOnly = FALSE; m_pSecurityPolicy = GetDefaultControlSecurityPolicy(); // Initialise ambient properties m_nAmbientLocale = 0; m_clrAmbientForeColor = ::GetSysColor(COLOR_WINDOWTEXT); m_clrAmbientBackColor = ::GetSysColor(COLOR_WINDOW); m_bAmbientUserMode = true; m_bAmbientShowHatching = true; m_bAmbientShowGrabHandles = true; m_bAmbientAppearance = true; // 3d // Windowless variables m_hDCBuffer = NULL; m_hRgnBuffer = NULL; m_hBMBufferOld = NULL; m_hBMBuffer = NULL; } // Destructor CControlSite::~CControlSite() { TRACE_METHOD(CControlSite::~CControlSite); Detach(); } // Create the specified control, optionally providing properties to initialise // it with and a name. HRESULT CControlSite::Create(REFCLSID clsid, PropertyList &pl, LPCWSTR szCodebase, IBindCtx *pBindContext) { TRACE_METHOD(CControlSite::Create); m_CLSID = clsid; m_ParameterList = pl; // See if security policy will allow the control to be hosted if (m_pSecurityPolicy && !m_pSecurityPolicy->IsClassSafeToHost(clsid)) { return E_FAIL; } // See if object is script safe BOOL checkForObjectSafety = FALSE; if (m_pSecurityPolicy && m_bSafeForScriptingObjectsOnly) { BOOL bClassExists = FALSE; BOOL bIsSafe = m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists); if (!bClassExists && szCodebase) { // Class doesn't exist, so allow code below to fetch it } else if (!bIsSafe) { // The class is not flagged as safe for scripting, so // we'll have to create it to ask it if its safe. checkForObjectSafety = TRUE; } } //Now Check if the control version needs to be updated. BOOL bUpdateControlVersion = FALSE; wchar_t *szURL = NULL; DWORD dwFileVersionMS = 0xffffffff; DWORD dwFileVersionLS = 0xffffffff; if(szCodebase) { HKEY hk = NULL; wchar_t wszKey[60] = L""; wchar_t wszData[MAX_PATH]; LPWSTR pwszClsid = NULL; DWORD dwSize = 255; DWORD dwHandle, dwLength, dwRegReturn; DWORD dwExistingFileVerMS = 0xffffffff; DWORD dwExistingFileVerLS = 0xffffffff; BOOL bFoundLocalVerInfo = FALSE; StringFromCLSID(clsid, (LPOLESTR*)&pwszClsid); swprintf(wszKey, L"%s%s%s\0", L"CLSID\\", pwszClsid, L"\\InprocServer32"); if ( RegOpenKeyExW( HKEY_CLASSES_ROOT, wszKey, 0, KEY_READ, &hk ) == ERROR_SUCCESS ) { dwRegReturn = RegQueryValueExW( hk, L"", NULL, NULL, (LPBYTE)wszData, &dwSize ); RegCloseKey( hk ); } if(dwRegReturn == ERROR_SUCCESS) { VS_FIXEDFILEINFO *pFileInfo; UINT uLen; dwLength = GetFileVersionInfoSizeW( wszData , &dwHandle ); LPBYTE lpData = new BYTE[dwLength]; GetFileVersionInfoW(wszData, 0, dwLength, lpData ); bFoundLocalVerInfo = VerQueryValueW( lpData, L"\\", (LPVOID*)&pFileInfo, &uLen ); if(bFoundLocalVerInfo) { dwExistingFileVerMS = pFileInfo->dwFileVersionMS; dwExistingFileVerLS = pFileInfo->dwFileVersionLS; } delete [] lpData; } // Test if the code base ends in #version=a,b,c,d const wchar_t *szHash = wcsrchr(szCodebase, wchar_t('#')); if (szHash) { if (wcsnicmp(szHash, L"#version=", 9) == 0) { int a, b, c, d; if (swscanf(szHash + 9, L"%d,%d,%d,%d", &a, &b, &c, &d) == 4) { dwFileVersionMS = MAKELONG(b,a); dwFileVersionLS = MAKELONG(d,c); //If local version info was found compare it if(bFoundLocalVerInfo) { if(dwFileVersionMS > dwExistingFileVerMS) bUpdateControlVersion = TRUE; if((dwFileVersionMS == dwExistingFileVerMS) && (dwFileVersionLS > dwExistingFileVerLS)) bUpdateControlVersion = TRUE; } } } szURL = _wcsdup(szCodebase); // Terminate at the hash mark if (szURL) szURL[szHash - szCodebase] = wchar_t('\0'); } else { szURL = _wcsdup(szCodebase); } } CComPtr<IUnknown> spObject; HRESULT hr; //If the control needs to be updated do not call CoCreateInstance otherwise you will lock files //and force a reboot on CoGetClassObjectFromURL if(!bUpdateControlVersion) { // Create the object hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void **) &spObject); if (SUCCEEDED(hr) && checkForObjectSafety) { // Assume scripting via IDispatch if (!m_pSecurityPolicy->IsObjectSafeForScripting(spObject, __uuidof(IDispatch))) { return E_FAIL; } // Drop through, success! } } // Do we need to download the control? if ((FAILED(hr) && szCodebase) || (bUpdateControlVersion)) { if (!szURL) return E_OUTOFMEMORY; CComPtr<IBindCtx> spBindContext; CComPtr<IBindStatusCallback> spBindStatusCallback; CComPtr<IBindStatusCallback> spOldBSC; // Create our own bind context or use the one provided? BOOL useInternalBSC = FALSE; if (!pBindContext) { useInternalBSC = TRUE; hr = CreateBindCtx(0, &spBindContext); if (FAILED(hr)) { free(szURL); return hr; } spBindStatusCallback = dynamic_cast<IBindStatusCallback *>(this); hr = RegisterBindStatusCallback(spBindContext, spBindStatusCallback, &spOldBSC, 0); if (FAILED(hr)) { free(szURL); return hr; } } else { spBindContext = pBindContext; } //If the version from the CODEBASE value is greater than the installed control //Call CoGetClassObjectFromURL with CLSID_NULL to prevent system change reboot prompt if(bUpdateControlVersion) { hr = CoGetClassObjectFromURL(CLSID_NULL, szCodebase, dwFileVersionMS, dwFileVersionLS, NULL, spBindContext, CLSCTX_INPROC_HANDLER | CLSCTX_INPROC_SERVER, 0, IID_IClassFactory, NULL); } else { hr = CoGetClassObjectFromURL(clsid, szURL, dwFileVersionMS, dwFileVersionLS, NULL, spBindContext, CLSCTX_ALL, NULL, IID_IUnknown, NULL); } free(szURL); // Handle the internal binding synchronously so the object exists // or an error code is available when the method returns. if (useInternalBSC) { if (MK_S_ASYNCHRONOUS == hr) { m_bBindingInProgress = TRUE; m_hrBindResult = E_FAIL; // Spin around waiting for binding to complete HANDLE hFakeEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL); while (m_bBindingInProgress) { MSG msg; // Process pending messages while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!::GetMessage(&msg, NULL, 0, 0)) { m_bBindingInProgress = FALSE; break; } ::TranslateMessage(&msg); ::DispatchMessage(&msg); } if (!m_bBindingInProgress) break; // Sleep for a bit or the next msg to appear ::MsgWaitForMultipleObjects(1, &hFakeEvent, FALSE, 500, QS_ALLEVENTS); } ::CloseHandle(hFakeEvent); // Set the result hr = m_hrBindResult; } // Destroy the bind status callback & context if (spBindStatusCallback) { RevokeBindStatusCallback(spBindContext, spBindStatusCallback); spBindStatusCallback.Release(); spBindContext.Release(); } } //added to create control if (SUCCEEDED(hr)) { // Create the object hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, IID_IUnknown, (void **) &spObject); if (SUCCEEDED(hr) && checkForObjectSafety) { // Assume scripting via IDispatch if (!m_pSecurityPolicy->IsObjectSafeForScripting(spObject, __uuidof(IDispatch))) { hr = E_FAIL; } } } //EOF test code } if (spObject) { m_spObject = spObject; } return hr; } // Attach the created control to a window and activate it HRESULT CControlSite::Attach(HWND hwndParent, const RECT &rcPos, IUnknown *pInitStream) { TRACE_METHOD(CControlSite::Attach); if (hwndParent == NULL) { NS_ASSERTION(0, "No parent hwnd"); return E_INVALIDARG; } m_hWndParent = hwndParent; m_rcObjectPos = rcPos; // Object must have been created if (m_spObject == NULL) { return E_UNEXPECTED; } m_spIViewObject = m_spObject; m_spIOleObject = m_spObject; if (m_spIOleObject == NULL) { return E_FAIL; } DWORD dwMiscStatus; m_spIOleObject->GetMiscStatus(DVASPECT_CONTENT, &dwMiscStatus); if (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST) { m_bSetClientSiteFirst = TRUE; } if (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME) { m_bVisibleAtRuntime = FALSE; } // Some objects like to have the client site as the first thing // to be initialised (for ambient properties and so forth) if (m_bSetClientSiteFirst) { m_spIOleObject->SetClientSite(this); } // If there is a parameter list for the object and no init stream then // create one here. CPropertyBagInstance *pPropertyBag = NULL; if (pInitStream == NULL && m_ParameterList.GetSize() > 0) { CPropertyBagInstance::CreateInstance(&pPropertyBag); pPropertyBag->AddRef(); for (unsigned long i = 0; i < m_ParameterList.GetSize(); i++) { pPropertyBag->Write(m_ParameterList.GetNameOf(i), const_cast<VARIANT *>(m_ParameterList.GetValueOf(i))); } pInitStream = (IPersistPropertyBag *) pPropertyBag; } // Initialise the control from store if one is provided if (pInitStream) { CComQIPtr<IPropertyBag, &IID_IPropertyBag> spPropertyBag = pInitStream; CComQIPtr<IStream, &IID_IStream> spStream = pInitStream; CComQIPtr<IPersistStream, &IID_IPersistStream> spIPersistStream = m_spIOleObject; CComQIPtr<IPersistPropertyBag, &IID_IPersistPropertyBag> spIPersistPropertyBag = m_spIOleObject; if (spIPersistPropertyBag && spPropertyBag) { spIPersistPropertyBag->Load(spPropertyBag, NULL); } else if (spIPersistStream && spStream) { spIPersistStream->Load(spStream); } } else { // Initialise the object if possible CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> spIPersistStreamInit = m_spIOleObject; if (spIPersistStreamInit) { spIPersistStreamInit->InitNew(); } } m_spIOleInPlaceObject = m_spObject; m_spIOleInPlaceObjectWindowless = m_spObject; if (m_spIOleInPlaceObject) { SetPosition(m_rcObjectPos); } // In-place activate the object if (m_bVisibleAtRuntime) { DoVerb(OLEIVERB_INPLACEACTIVATE); } // For those objects which haven't had their client site set yet, // it's done here. if (!m_bSetClientSiteFirst) { m_spIOleObject->SetClientSite(this); } return S_OK; } // Unhook the control from the window and throw it all away HRESULT CControlSite::Detach() { TRACE_METHOD(CControlSite::Detach); if (m_spIOleInPlaceObjectWindowless) { m_spIOleInPlaceObjectWindowless.Release(); } if (m_spIOleInPlaceObject) { m_spIOleInPlaceObject->InPlaceDeactivate(); m_spIOleInPlaceObject.Release(); } if (m_spIOleObject) { m_spIOleObject->Close(OLECLOSE_NOSAVE); m_spIOleObject->SetClientSite(NULL); m_spIOleObject.Release(); } m_spIViewObject.Release(); m_spObject.Release(); return S_OK; } // Return the IUnknown of the contained control HRESULT CControlSite::GetControlUnknown(IUnknown **ppObject) { *ppObject = NULL; if (m_spObject) { m_spObject->QueryInterface(IID_IUnknown, (void **) ppObject); } return S_OK; } // Subscribe to an event sink on the control HRESULT CControlSite::Advise(IUnknown *pIUnkSink, const IID &iid, DWORD *pdwCookie) { if (m_spObject == NULL) { return E_UNEXPECTED; } if (pIUnkSink == NULL || pdwCookie == NULL) { return E_INVALIDARG; } return AtlAdvise(m_spObject, pIUnkSink, iid, pdwCookie); } // Unsubscribe event sink from the control HRESULT CControlSite::Unadvise(const IID &iid, DWORD dwCookie) { if (m_spObject == NULL) { return E_UNEXPECTED; } return AtlUnadvise(m_spObject, iid, dwCookie); } // Draw the control HRESULT CControlSite::Draw(HDC hdc) { TRACE_METHOD(CControlSite::Draw); // Draw only when control is windowless or deactivated if (m_spIViewObject) { if (m_bWindowless || !m_bInPlaceActive) { RECTL *prcBounds = (m_bWindowless) ? NULL : (RECTL *) &m_rcObjectPos; m_spIViewObject->Draw(DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdc, prcBounds, NULL, NULL, 0); } } else { // Draw something to indicate no control is there HBRUSH hbr = CreateSolidBrush(RGB(200,200,200)); FillRect(hdc, &m_rcObjectPos, hbr); DeleteObject(hbr); } return S_OK; } // Execute the specified verb HRESULT CControlSite::DoVerb(LONG nVerb, LPMSG lpMsg) { TRACE_METHOD(CControlSite::DoVerb); if (m_spIOleObject == NULL) { return E_FAIL; } return m_spIOleObject->DoVerb(nVerb, lpMsg, this, 0, m_hWndParent, &m_rcObjectPos); } // Set the position on the control HRESULT CControlSite::SetPosition(const RECT &rcPos) { HWND hwnd; TRACE_METHOD(CControlSite::SetPosition); m_rcObjectPos = rcPos; if (m_spIOleInPlaceObject && SUCCEEDED(m_spIOleInPlaceObject->GetWindow(&hwnd))) { m_spIOleInPlaceObject->SetObjectRects(&m_rcObjectPos, &m_rcObjectPos); } return S_OK; } void CControlSite::FireAmbientPropertyChange(DISPID id) { if (m_spObject) { CComQIPtr<IOleControl> spControl = m_spObject; if (spControl) { spControl->OnAmbientPropertyChange(id); } } } void CControlSite::SetAmbientUserMode(BOOL bUserMode) { bool bNewMode = bUserMode ? true : false; if (m_bAmbientUserMode != bNewMode) { m_bAmbientUserMode = bNewMode; FireAmbientPropertyChange(DISPID_AMBIENT_USERMODE); } } /////////////////////////////////////////////////////////////////////////////// // CControlSiteSecurityPolicy implementation CControlSiteSecurityPolicy *CControlSite::GetDefaultControlSecurityPolicy() { static CDefaultControlSiteSecurityPolicy defaultControlSecurityPolicy; return &defaultControlSecurityPolicy; } // Test if the class is safe to host BOOL CControlSite::IsClassSafeToHost(const CLSID & clsid) { if (m_pSecurityPolicy) return m_pSecurityPolicy->IsClassSafeToHost(clsid); return TRUE; } // Test if the specified class is marked safe for scripting BOOL CControlSite::IsClassMarkedSafeForScripting(const CLSID & clsid, BOOL &bClassExists) { if (m_pSecurityPolicy) return m_pSecurityPolicy->IsClassMarkedSafeForScripting(clsid, bClassExists); return TRUE; } // Test if the instantiated object is safe for scripting on the specified interface BOOL CControlSite::IsObjectSafeForScripting(IUnknown *pObject, const IID &iid) { if (m_pSecurityPolicy) return m_pSecurityPolicy->IsObjectSafeForScripting(pObject, iid); return TRUE; } BOOL CControlSite::IsObjectSafeForScripting(const IID &iid) { return IsObjectSafeForScripting(m_spObject, iid); } /////////////////////////////////////////////////////////////////////////////// // IServiceProvider implementation HRESULT STDMETHODCALLTYPE CControlSite::QueryService(REFGUID guidService, REFIID riid, void** ppv) { if (m_spServiceProvider) return m_spServiceProvider->QueryService(guidService, riid, ppv); return E_NOINTERFACE; } /////////////////////////////////////////////////////////////////////////////// // IDispatch implementation HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfoCount(/* [out] */ UINT __RPC_FAR *pctinfo) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::GetTypeInfo(/* [in] */ UINT iTInfo, /* [in] */ LCID lcid, /* [out] */ ITypeInfo __RPC_FAR *__RPC_FAR *ppTInfo) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::GetIDsOfNames(/* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, /* [in] */ UINT cNames, /* [in] */ LCID lcid, /* [size_is][out] */ DISPID __RPC_FAR *rgDispId) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::Invoke(/* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, /* [in] */ LCID lcid, /* [in] */ WORD wFlags, /* [out][in] */ DISPPARAMS __RPC_FAR *pDispParams, /* [out] */ VARIANT __RPC_FAR *pVarResult, /* [out] */ EXCEPINFO __RPC_FAR *pExcepInfo, /* [out] */ UINT __RPC_FAR *puArgErr) { if (wFlags & DISPATCH_PROPERTYGET) { CComVariant vResult; switch (dispIdMember) { case DISPID_AMBIENT_APPEARANCE: vResult = CComVariant(m_bAmbientAppearance); break; case DISPID_AMBIENT_FORECOLOR: vResult = CComVariant((long) m_clrAmbientForeColor); break; case DISPID_AMBIENT_BACKCOLOR: vResult = CComVariant((long) m_clrAmbientBackColor); break; case DISPID_AMBIENT_LOCALEID: vResult = CComVariant((long) m_nAmbientLocale); break; case DISPID_AMBIENT_USERMODE: vResult = CComVariant(m_bAmbientUserMode); break; case DISPID_AMBIENT_SHOWGRABHANDLES: vResult = CComVariant(m_bAmbientShowGrabHandles); break; case DISPID_AMBIENT_SHOWHATCHING: vResult = CComVariant(m_bAmbientShowHatching); break; default: return DISP_E_MEMBERNOTFOUND; } VariantCopy(pVarResult, &vResult); return S_OK; } return E_FAIL; } /////////////////////////////////////////////////////////////////////////////// // IAdviseSink implementation void STDMETHODCALLTYPE CControlSite::OnDataChange(/* [unique][in] */ FORMATETC __RPC_FAR *pFormatetc, /* [unique][in] */ STGMEDIUM __RPC_FAR *pStgmed) { } void STDMETHODCALLTYPE CControlSite::OnViewChange(/* [in] */ DWORD dwAspect, /* [in] */ LONG lindex) { // Redraw the control InvalidateRect(NULL, FALSE); } void STDMETHODCALLTYPE CControlSite::OnRename(/* [in] */ IMoniker __RPC_FAR *pmk) { } void STDMETHODCALLTYPE CControlSite::OnSave(void) { } void STDMETHODCALLTYPE CControlSite::OnClose(void) { } /////////////////////////////////////////////////////////////////////////////// // IAdviseSink2 implementation void STDMETHODCALLTYPE CControlSite::OnLinkSrcChange(/* [unique][in] */ IMoniker __RPC_FAR *pmk) { } /////////////////////////////////////////////////////////////////////////////// // IAdviseSinkEx implementation void STDMETHODCALLTYPE CControlSite::OnViewStatusChange(/* [in] */ DWORD dwViewStatus) { } /////////////////////////////////////////////////////////////////////////////// // IOleWindow implementation HRESULT STDMETHODCALLTYPE CControlSite::GetWindow(/* [out] */ HWND __RPC_FAR *phwnd) { *phwnd = m_hWndParent; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::ContextSensitiveHelp(/* [in] */ BOOL fEnterMode) { return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IOleClientSite implementation HRESULT STDMETHODCALLTYPE CControlSite::SaveObject(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetMoniker(/* [in] */ DWORD dwAssign, /* [in] */ DWORD dwWhichMoniker, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmk) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::GetContainer(/* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer) { if (!ppContainer) return E_INVALIDARG; *ppContainer = m_spContainer; if (*ppContainer) { (*ppContainer)->AddRef(); } return (*ppContainer) ? S_OK : E_NOINTERFACE; } HRESULT STDMETHODCALLTYPE CControlSite::ShowObject(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnShowWindow(/* [in] */ BOOL fShow) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::RequestNewObjectLayout(void) { return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// // IOleInPlaceSite implementation HRESULT STDMETHODCALLTYPE CControlSite::CanInPlaceActivate(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivate(void) { m_bInPlaceActive = TRUE; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnUIActivate(void) { m_bUIActive = TRUE; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetWindowContext(/* [out] */ IOleInPlaceFrame __RPC_FAR *__RPC_FAR *ppFrame, /* [out] */ IOleInPlaceUIWindow __RPC_FAR *__RPC_FAR *ppDoc, /* [out] */ LPRECT lprcPosRect, /* [out] */ LPRECT lprcClipRect, /* [out][in] */ LPOLEINPLACEFRAMEINFO lpFrameInfo) { *lprcPosRect = m_rcObjectPos; *lprcClipRect = m_rcObjectPos; CControlSiteIPFrameInstance *pIPFrame = NULL; CControlSiteIPFrameInstance::CreateInstance(&pIPFrame); pIPFrame->AddRef(); *ppFrame = (IOleInPlaceFrame *) pIPFrame; *ppDoc = NULL; lpFrameInfo->fMDIApp = FALSE; lpFrameInfo->hwndFrame = NULL; lpFrameInfo->haccel = NULL; lpFrameInfo->cAccelEntries = 0; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::Scroll(/* [in] */ SIZE scrollExtant) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnUIDeactivate(/* [in] */ BOOL fUndoable) { m_bUIActive = FALSE; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivate(void) { m_bInPlaceActive = FALSE; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::DiscardUndoState(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::DeactivateAndUndo(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnPosRectChange(/* [in] */ LPCRECT lprcPosRect) { if (lprcPosRect == NULL) { return E_INVALIDARG; } SetPosition(m_rcObjectPos); return S_OK; } /////////////////////////////////////////////////////////////////////////////// // IOleInPlaceSiteEx implementation HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceActivateEx(/* [out] */ BOOL __RPC_FAR *pfNoRedraw, /* [in] */ DWORD dwFlags) { m_bInPlaceActive = TRUE; if (pfNoRedraw) { *pfNoRedraw = FALSE; } if (dwFlags & ACTIVATE_WINDOWLESS) { if (!m_bSupportWindowlessActivation) { return E_INVALIDARG; } m_bWindowless = TRUE; } return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnInPlaceDeactivateEx(/* [in] */ BOOL fNoRedraw) { m_bInPlaceActive = FALSE; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::RequestUIActivate(void) { return S_FALSE; } /////////////////////////////////////////////////////////////////////////////// // IOleInPlaceSiteWindowless implementation HRESULT STDMETHODCALLTYPE CControlSite::CanWindowlessActivate(void) { // Allow windowless activation? return (m_bSupportWindowlessActivation) ? S_OK : S_FALSE; } HRESULT STDMETHODCALLTYPE CControlSite::GetCapture(void) { // TODO capture the mouse for the object return S_FALSE; } HRESULT STDMETHODCALLTYPE CControlSite::SetCapture(/* [in] */ BOOL fCapture) { // TODO capture the mouse for the object return S_FALSE; } HRESULT STDMETHODCALLTYPE CControlSite::GetFocus(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::SetFocus(/* [in] */ BOOL fFocus) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetDC(/* [in] */ LPCRECT pRect, /* [in] */ DWORD grfFlags, /* [out] */ HDC __RPC_FAR *phDC) { if (phDC == NULL) { return E_INVALIDARG; } // Can't do nested painting if (m_hDCBuffer != NULL) { return E_UNEXPECTED; } m_rcBuffer = m_rcObjectPos; if (pRect != NULL) { m_rcBuffer = *pRect; } m_hBMBuffer = NULL; m_dwBufferFlags = grfFlags; // See if the control wants a DC that is onscreen or offscreen if (m_dwBufferFlags & OLEDC_OFFSCREEN) { m_hDCBuffer = CreateCompatibleDC(NULL); if (m_hDCBuffer == NULL) { // Error return E_OUTOFMEMORY; } long cx = m_rcBuffer.right - m_rcBuffer.left; long cy = m_rcBuffer.bottom - m_rcBuffer.top; m_hBMBuffer = CreateCompatibleBitmap(m_hDCBuffer, cx, cy); m_hBMBufferOld = (HBITMAP) SelectObject(m_hDCBuffer, m_hBMBuffer); SetViewportOrgEx(m_hDCBuffer, m_rcBuffer.left, m_rcBuffer.top, NULL); // TODO When OLEDC_PAINTBKGND we must draw every site behind this one } else { // TODO When OLEDC_PAINTBKGND we must draw every site behind this one // Get the window DC m_hDCBuffer = GetWindowDC(m_hWndParent); if (m_hDCBuffer == NULL) { // Error return E_OUTOFMEMORY; } // Clip the control so it can't trash anywhere it isn't allowed to draw if (!(m_dwBufferFlags & OLEDC_NODRAW)) { m_hRgnBuffer = CreateRectRgnIndirect(&m_rcBuffer); // TODO Clip out opaque areas of sites behind this one SelectClipRgn(m_hDCBuffer, m_hRgnBuffer); } } *phDC = m_hDCBuffer; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::ReleaseDC(/* [in] */ HDC hDC) { // Release the DC if (hDC == NULL || hDC != m_hDCBuffer) { return E_INVALIDARG; } // Test if the DC was offscreen or onscreen if ((m_dwBufferFlags & OLEDC_OFFSCREEN) && !(m_dwBufferFlags & OLEDC_NODRAW)) { // BitBlt the buffer into the control's object SetViewportOrgEx(m_hDCBuffer, 0, 0, NULL); HDC hdc = GetWindowDC(m_hWndParent); long cx = m_rcBuffer.right - m_rcBuffer.left; long cy = m_rcBuffer.bottom - m_rcBuffer.top; BitBlt(hdc, m_rcBuffer.left, m_rcBuffer.top, cx, cy, m_hDCBuffer, 0, 0, SRCCOPY); ::ReleaseDC(m_hWndParent, hdc); } else { // TODO If OLEDC_PAINTBKGND is set draw the DVASPECT_CONTENT of every object above this one } // Clean up settings ready for next drawing if (m_hRgnBuffer) { SelectClipRgn(m_hDCBuffer, NULL); DeleteObject(m_hRgnBuffer); m_hRgnBuffer = NULL; } SelectObject(m_hDCBuffer, m_hBMBufferOld); if (m_hBMBuffer) { DeleteObject(m_hBMBuffer); m_hBMBuffer = NULL; } // Delete the DC if (m_dwBufferFlags & OLEDC_OFFSCREEN) { ::DeleteDC(m_hDCBuffer); } else { ::ReleaseDC(m_hWndParent, m_hDCBuffer); } m_hDCBuffer = NULL; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRect(/* [in] */ LPCRECT pRect, /* [in] */ BOOL fErase) { // Clip the rectangle against the object's size and invalidate it RECT rcI = { 0, 0, 0, 0 }; if (pRect == NULL) { rcI = m_rcObjectPos; } else { IntersectRect(&rcI, &m_rcObjectPos, pRect); } ::InvalidateRect(m_hWndParent, &rcI, fErase); return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::InvalidateRgn(/* [in] */ HRGN hRGN, /* [in] */ BOOL fErase) { if (hRGN == NULL) { ::InvalidateRect(m_hWndParent, &m_rcObjectPos, fErase); } else { // Clip the region with the object's bounding area HRGN hrgnClip = CreateRectRgnIndirect(&m_rcObjectPos); if (CombineRgn(hrgnClip, hrgnClip, hRGN, RGN_AND) != ERROR) { ::InvalidateRgn(m_hWndParent, hrgnClip, fErase); } DeleteObject(hrgnClip); } return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::ScrollRect(/* [in] */ INT dx, /* [in] */ INT dy, /* [in] */ LPCRECT pRectScroll, /* [in] */ LPCRECT pRectClip) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::AdjustRect(/* [out][in] */ LPRECT prc) { if (prc == NULL) { return E_INVALIDARG; } // Clip the rectangle against the object position RECT rcI = { 0, 0, 0, 0 }; IntersectRect(&rcI, &m_rcObjectPos, prc); *prc = rcI; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnDefWindowMessage(/* [in] */ UINT msg, /* [in] */ WPARAM wParam, /* [in] */ LPARAM lParam, /* [out] */ LRESULT __RPC_FAR *plResult) { if (plResult == NULL) { return E_INVALIDARG; } // Pass the message to the windowless control if (m_bWindowless && m_spIOleInPlaceObjectWindowless) { return m_spIOleInPlaceObjectWindowless->OnWindowMessage(msg, wParam, lParam, plResult); } else if (m_spIOleInPlaceObject) { HWND wnd; if (SUCCEEDED(m_spIOleInPlaceObject->GetWindow(&wnd))) SendMessage(wnd, msg, wParam, lParam); } return S_FALSE; } /////////////////////////////////////////////////////////////////////////////// // IOleControlSite implementation HRESULT STDMETHODCALLTYPE CControlSite::OnControlInfoChanged(void) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::LockInPlaceActive(/* [in] */ BOOL fLock) { m_bInPlaceLocked = fLock; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetExtendedControl(/* [out] */ IDispatch __RPC_FAR *__RPC_FAR *ppDisp) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::TransformCoords(/* [out][in] */ POINTL __RPC_FAR *pPtlHimetric, /* [out][in] */ POINTF __RPC_FAR *pPtfContainer, /* [in] */ DWORD dwFlags) { HRESULT hr = S_OK; if (pPtlHimetric == NULL) { return E_INVALIDARG; } if (pPtfContainer == NULL) { return E_INVALIDARG; } HDC hdc = ::GetDC(m_hWndParent); ::SetMapMode(hdc, MM_HIMETRIC); POINT rgptConvert[2]; rgptConvert[0].x = 0; rgptConvert[0].y = 0; if (dwFlags & XFORMCOORDS_HIMETRICTOCONTAINER) { rgptConvert[1].x = pPtlHimetric->x; rgptConvert[1].y = pPtlHimetric->y; ::LPtoDP(hdc, rgptConvert, 2); if (dwFlags & XFORMCOORDS_SIZE) { pPtfContainer->x = (float)(rgptConvert[1].x - rgptConvert[0].x); pPtfContainer->y = (float)(rgptConvert[0].y - rgptConvert[1].y); } else if (dwFlags & XFORMCOORDS_POSITION) { pPtfContainer->x = (float)rgptConvert[1].x; pPtfContainer->y = (float)rgptConvert[1].y; } else { hr = E_INVALIDARG; } } else if (dwFlags & XFORMCOORDS_CONTAINERTOHIMETRIC) { rgptConvert[1].x = (int)(pPtfContainer->x); rgptConvert[1].y = (int)(pPtfContainer->y); ::DPtoLP(hdc, rgptConvert, 2); if (dwFlags & XFORMCOORDS_SIZE) { pPtlHimetric->x = rgptConvert[1].x - rgptConvert[0].x; pPtlHimetric->y = rgptConvert[0].y - rgptConvert[1].y; } else if (dwFlags & XFORMCOORDS_POSITION) { pPtlHimetric->x = rgptConvert[1].x; pPtlHimetric->y = rgptConvert[1].y; } else { hr = E_INVALIDARG; } } else { hr = E_INVALIDARG; } ::ReleaseDC(m_hWndParent, hdc); return hr; } HRESULT STDMETHODCALLTYPE CControlSite::TranslateAccelerator(/* [in] */ MSG __RPC_FAR *pMsg, /* [in] */ DWORD grfModifiers) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::OnFocus(/* [in] */ BOOL fGotFocus) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::ShowPropertyFrame(void) { return E_NOTIMPL; } /////////////////////////////////////////////////////////////////////////////// // IBindStatusCallback implementation HRESULT STDMETHODCALLTYPE CControlSite::OnStartBinding(DWORD dwReserved, IBinding __RPC_FAR *pib) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetPriority(LONG __RPC_FAR *pnPriority) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnLowResource(DWORD reserved) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnProgress(ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText) { return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnStopBinding(HRESULT hresult, LPCWSTR szError) { m_bBindingInProgress = FALSE; m_hrBindResult = hresult; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::GetBindInfo(DWORD __RPC_FAR *pgrfBINDF, BINDINFO __RPC_FAR *pbindInfo) { *pgrfBINDF = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_GETNEWESTVERSION | BINDF_NOWRITECACHE; pbindInfo->cbSize = sizeof(BINDINFO); pbindInfo->szExtraInfo = NULL; memset(&pbindInfo->stgmedData, 0, sizeof(STGMEDIUM)); pbindInfo->grfBindInfoF = 0; pbindInfo->dwBindVerb = 0; pbindInfo->szCustomVerb = NULL; return S_OK; } HRESULT STDMETHODCALLTYPE CControlSite::OnDataAvailable(DWORD grfBSCF, DWORD dwSize, FORMATETC __RPC_FAR *pformatetc, STGMEDIUM __RPC_FAR *pstgmed) { return E_NOTIMPL; } HRESULT STDMETHODCALLTYPE CControlSite::OnObjectAvailable(REFIID riid, IUnknown __RPC_FAR *punk) { return S_OK; } // IWindowForBindingUI HRESULT STDMETHODCALLTYPE CControlSite::GetWindow( /* [in] */ REFGUID rguidReason, /* [out] */ HWND *phwnd) { *phwnd = NULL; return S_OK; }
zzhongster-activex
ff-activex-host/ffactivex/common/ControlSite.cpp
C++
lgpl
44,015
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@netscape.com> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef CONTROLSITEIPFRAME_H #define CONTROLSITEIPFRAME_H class CControlSiteIPFrame : public CComObjectRootEx<CComSingleThreadModel>, public IOleInPlaceFrame { public: CControlSiteIPFrame(); virtual ~CControlSiteIPFrame(); HWND m_hwndFrame; BEGIN_COM_MAP(CControlSiteIPFrame) COM_INTERFACE_ENTRY_IID(IID_IOleWindow, IOleInPlaceFrame) COM_INTERFACE_ENTRY_IID(IID_IOleInPlaceUIWindow, IOleInPlaceFrame) COM_INTERFACE_ENTRY(IOleInPlaceFrame) END_COM_MAP() // IOleWindow virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetWindow(/* [out] */ HWND __RPC_FAR *phwnd); virtual HRESULT STDMETHODCALLTYPE ContextSensitiveHelp(/* [in] */ BOOL fEnterMode); // IOleInPlaceUIWindow implementation virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE GetBorder(/* [out] */ LPRECT lprectBorder); virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE RequestBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetBorderSpace(/* [unique][in] */ LPCBORDERWIDTHS pborderwidths); virtual HRESULT STDMETHODCALLTYPE SetActiveObject(/* [unique][in] */ IOleInPlaceActiveObject __RPC_FAR *pActiveObject, /* [unique][string][in] */ LPCOLESTR pszObjName); // IOleInPlaceFrame implementation virtual HRESULT STDMETHODCALLTYPE InsertMenus(/* [in] */ HMENU hmenuShared, /* [out][in] */ LPOLEMENUGROUPWIDTHS lpMenuWidths); virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetMenu(/* [in] */ HMENU hmenuShared, /* [in] */ HOLEMENU holemenu, /* [in] */ HWND hwndActiveObject); virtual HRESULT STDMETHODCALLTYPE RemoveMenus(/* [in] */ HMENU hmenuShared); virtual /* [input_sync] */ HRESULT STDMETHODCALLTYPE SetStatusText(/* [in] */ LPCOLESTR pszStatusText); virtual HRESULT STDMETHODCALLTYPE EnableModeless(/* [in] */ BOOL fEnable); virtual HRESULT STDMETHODCALLTYPE TranslateAccelerator(/* [in] */ LPMSG lpmsg, /* [in] */ WORD wID); }; typedef CComObject<CControlSiteIPFrame> CControlSiteIPFrameInstance; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/ControlSiteIPFrame.h
C++
lgpl
3,891
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef IOLECOMMANDIMPL_H #define IOLECOMMANDIMPL_H // Implementation of the IOleCommandTarget interface. The template is // reasonably generic and reusable which is a good thing given how needlessly // complicated this interface is. Blame Microsoft for that and not me. // // To use this class, derive your class from it like this: // // class CComMyClass : public IOleCommandTargetImpl<CComMyClass> // { // ... Ensure IOleCommandTarget is listed in the interface map ... // BEGIN_COM_MAP(CComMyClass) // COM_INTERFACE_ENTRY(IOleCommandTarget) // // etc. // END_COM_MAP() // ... And then later on define the command target table ... // BEGIN_OLECOMMAND_TABLE() // OLECOMMAND_MESSAGE(OLECMDID_PRINT, NULL, ID_PRINT, L"Print", L"Print the page") // OLECOMMAND_MESSAGE(OLECMDID_SAVEAS, NULL, 0, L"SaveAs", L"Save the page") // OLECOMMAND_HANDLER(IDM_EDITMODE, &CGID_MSHTML, EditModeHandler, L"EditMode", L"Switch to edit mode") // END_OLECOMMAND_TABLE() // ... Now the window that OLECOMMAND_MESSAGE sends WM_COMMANDs to ... // HWND GetCommandTargetWindow() const // { // return m_hWnd; // } // ... Now procedures that OLECOMMAND_HANDLER calls ... // static HRESULT _stdcall EditModeHandler(CMozillaBrowser *pThis, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); // } // // The command table defines which commands the object supports. Commands are // defined by a command id and a command group plus a WM_COMMAND id or procedure, // and a verb and short description. // // Notice that there are two macros for handling Ole Commands. The first, // OLECOMMAND_MESSAGE sends a WM_COMMAND message to the window returned from // GetCommandTargetWindow() (that the derived class must implement if it uses // this macro). // // The second, OLECOMMAND_HANDLER calls a static handler procedure that // conforms to the OleCommandProc typedef. The first parameter, pThis means // the static handler has access to the methods and variables in the class // instance. // // The OLECOMMAND_HANDLER macro is generally more useful when a command // takes parameters or needs to return a result to the caller. // template< class T > class IOleCommandTargetImpl : public IOleCommandTarget { struct OleExecData { const GUID *pguidCmdGroup; DWORD nCmdID; DWORD nCmdexecopt; VARIANT *pvaIn; VARIANT *pvaOut; }; public: typedef HRESULT (_stdcall *OleCommandProc)(T *pT, const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); struct OleCommandInfo { ULONG nCmdID; const GUID *pCmdGUID; ULONG nWindowsCmdID; OleCommandProc pfnCommandProc; wchar_t *szVerbText; wchar_t *szStatusText; }; // Query the status of the specified commands (test if is it supported etc.) virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID __RPC_FAR *pguidCmdGroup, ULONG cCmds, OLECMD __RPC_FAR prgCmds[], OLECMDTEXT __RPC_FAR *pCmdText) { T* pT = static_cast<T*>(this); if (prgCmds == NULL) { return E_INVALIDARG; } OleCommandInfo *pCommands = pT->GetCommandTable(); ATLASSERT(pCommands); BOOL bCmdGroupFound = FALSE; BOOL bTextSet = FALSE; // Iterate through list of commands and flag them as supported/unsupported for (ULONG nCmd = 0; nCmd < cCmds; nCmd++) { // Unsupported by default prgCmds[nCmd].cmdf = 0; // Search the support command list for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) { OleCommandInfo *pCI = &pCommands[nSupported]; if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) { continue; } bCmdGroupFound = TRUE; if (pCI->nCmdID != prgCmds[nCmd].cmdID) { continue; } // Command is supported so flag it and possibly enable it prgCmds[nCmd].cmdf = OLECMDF_SUPPORTED; if (pCI->nWindowsCmdID != 0) { prgCmds[nCmd].cmdf |= OLECMDF_ENABLED; } // Copy the status/verb text for the first supported command only if (!bTextSet && pCmdText) { // See what text the caller wants wchar_t *pszTextToCopy = NULL; if (pCmdText->cmdtextf & OLECMDTEXTF_NAME) { pszTextToCopy = pCI->szVerbText; } else if (pCmdText->cmdtextf & OLECMDTEXTF_STATUS) { pszTextToCopy = pCI->szStatusText; } // Copy the text pCmdText->cwActual = 0; memset(pCmdText->rgwz, 0, pCmdText->cwBuf * sizeof(wchar_t)); if (pszTextToCopy) { // Don't exceed the provided buffer size size_t nTextLen = wcslen(pszTextToCopy); if (nTextLen > pCmdText->cwBuf) { nTextLen = pCmdText->cwBuf; } wcsncpy(pCmdText->rgwz, pszTextToCopy, nTextLen); pCmdText->cwActual = nTextLen; } bTextSet = TRUE; } break; } } // Was the command group found? if (!bCmdGroupFound) { OLECMDERR_E_UNKNOWNGROUP; } return S_OK; } // Execute the specified command virtual HRESULT STDMETHODCALLTYPE Exec(const GUID __RPC_FAR *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT __RPC_FAR *pvaIn, VARIANT __RPC_FAR *pvaOut) { T* pT = static_cast<T*>(this); BOOL bCmdGroupFound = FALSE; OleCommandInfo *pCommands = pT->GetCommandTable(); ATLASSERT(pCommands); // Search the support command list for (int nSupported = 0; pCommands[nSupported].pCmdGUID != &GUID_NULL; nSupported++) { OleCommandInfo *pCI = &pCommands[nSupported]; if (pguidCmdGroup && pCI->pCmdGUID && memcmp(pguidCmdGroup, pCI->pCmdGUID, sizeof(GUID)) == 0) { continue; } bCmdGroupFound = TRUE; if (pCI->nCmdID != nCmdID) { continue; } // Send ourselves a WM_COMMAND windows message with the associated // identifier and exec data OleExecData cData; cData.pguidCmdGroup = pguidCmdGroup; cData.nCmdID = nCmdID; cData.nCmdexecopt = nCmdexecopt; cData.pvaIn = pvaIn; cData.pvaOut = pvaOut; if (pCI->pfnCommandProc) { pCI->pfnCommandProc(pT, pCI->pCmdGUID, pCI->nCmdID, nCmdexecopt, pvaIn, pvaOut); } else if (pCI->nWindowsCmdID != 0 && nCmdexecopt != OLECMDEXECOPT_SHOWHELP) { HWND hwndTarget = pT->GetCommandTargetWindow(); if (hwndTarget) { ::SendMessage(hwndTarget, WM_COMMAND, LOWORD(pCI->nWindowsCmdID), (LPARAM) &cData); } } else { // Command supported but not implemented continue; } return S_OK; } // Was the command group found? if (!bCmdGroupFound) { OLECMDERR_E_UNKNOWNGROUP; } return OLECMDERR_E_NOTSUPPORTED; } }; // Macros to be placed in any class derived from the IOleCommandTargetImpl // class. These define what commands are exposed from the object. #define BEGIN_OLECOMMAND_TABLE() \ OleCommandInfo *GetCommandTable() \ { \ static OleCommandInfo s_aSupportedCommands[] = \ { #define OLECOMMAND_MESSAGE(id, group, cmd, verb, desc) \ { id, group, cmd, NULL, verb, desc }, #define OLECOMMAND_HANDLER(id, group, handler, verb, desc) \ { id, group, 0, handler, verb, desc }, #define END_OLECOMMAND_TABLE() \ { 0, &GUID_NULL, 0, NULL, NULL, NULL } \ }; \ return s_aSupportedCommands; \ }; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/IOleCommandTargetImpl.h
C++
lgpl
10,589
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef PROPERTYLIST_H #define PROPERTYLIST_H // A simple array class for managing name/value pairs typically fed to controls // during initialization by IPersistPropertyBag class PropertyList { struct Property { BSTR bstrName; VARIANT vValue; } *mProperties; unsigned long mListSize; unsigned long mMaxListSize; bool EnsureMoreSpace() { // Ensure enough space exists to accomodate a new item const unsigned long kGrowBy = 10; if (!mProperties) { mProperties = (Property *) malloc(sizeof(Property) * kGrowBy); if (!mProperties) return false; mMaxListSize = kGrowBy; } else if (mListSize == mMaxListSize) { Property *pNewProperties; pNewProperties = (Property *) realloc(mProperties, sizeof(Property) * (mMaxListSize + kGrowBy)); if (!pNewProperties) return false; mProperties = pNewProperties; mMaxListSize += kGrowBy; } return true; } public: PropertyList() : mProperties(NULL), mListSize(0), mMaxListSize(0) { } ~PropertyList() { } void Clear() { if (mProperties) { for (unsigned long i = 0; i < mListSize; i++) { SysFreeString(mProperties[i].bstrName); // Safe even if NULL VariantClear(&mProperties[i].vValue); } free(mProperties); mProperties = NULL; } mListSize = 0; mMaxListSize = 0; } unsigned long GetSize() const { return mListSize; } const BSTR GetNameOf(unsigned long nIndex) const { if (nIndex > mListSize) { return NULL; } return mProperties[nIndex].bstrName; } const VARIANT *GetValueOf(unsigned long nIndex) const { if (nIndex > mListSize) { return NULL; } return &mProperties[nIndex].vValue; } bool AddOrReplaceNamedProperty(const BSTR bstrName, const VARIANT &vValue) { if (!bstrName) return false; for (unsigned long i = 0; i < GetSize(); i++) { // Case insensitive if (wcsicmp(mProperties[i].bstrName, bstrName) == 0) { return SUCCEEDED( VariantCopy(&mProperties[i].vValue, const_cast<VARIANT *>(&vValue))); } } return AddNamedProperty(bstrName, vValue); } bool AddNamedProperty(const BSTR bstrName, const VARIANT &vValue) { if (!bstrName || !EnsureMoreSpace()) return false; Property *pProp = &mProperties[mListSize]; pProp->bstrName = ::SysAllocString(bstrName); if (!pProp->bstrName) { return false; } VariantInit(&pProp->vValue); if (FAILED(VariantCopy(&pProp->vValue, const_cast<VARIANT *>(&vValue)))) { SysFreeString(pProp->bstrName); return false; } mListSize++; return true; } }; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/PropertyList.h
C++
lgpl
5,004
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * Adam Lock <adamlock@eircom.net> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #ifndef ITEMCONTAINER_H #define ITEMCONTAINER_H // typedef std::map<tstring, CIUnkPtr> CNamedObjectList; // Class for managing a list of named objects. class CItemContainer : public CComObjectRootEx<CComSingleThreadModel>, public IOleItemContainer { // CNamedObjectList m_cNamedObjectList; public: CItemContainer(); virtual ~CItemContainer(); BEGIN_COM_MAP(CItemContainer) COM_INTERFACE_ENTRY_IID(IID_IParseDisplayName, IOleItemContainer) COM_INTERFACE_ENTRY_IID(IID_IOleContainer, IOleItemContainer) COM_INTERFACE_ENTRY_IID(IID_IOleItemContainer, IOleItemContainer) END_COM_MAP() // IParseDisplayName implementation virtual HRESULT STDMETHODCALLTYPE ParseDisplayName(/* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ LPOLESTR pszDisplayName, /* [out] */ ULONG __RPC_FAR *pchEaten, /* [out] */ IMoniker __RPC_FAR *__RPC_FAR *ppmkOut); // IOleContainer implementation virtual HRESULT STDMETHODCALLTYPE EnumObjects(/* [in] */ DWORD grfFlags, /* [out] */ IEnumUnknown __RPC_FAR *__RPC_FAR *ppenum); virtual HRESULT STDMETHODCALLTYPE LockContainer(/* [in] */ BOOL fLock); // IOleItemContainer implementation virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObject(/* [in] */ LPOLESTR pszItem, /* [in] */ DWORD dwSpeedNeeded, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); virtual /* [local] */ HRESULT STDMETHODCALLTYPE GetObjectStorage(/* [in] */ LPOLESTR pszItem, /* [unique][in] */ IBindCtx __RPC_FAR *pbc, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvStorage); virtual HRESULT STDMETHODCALLTYPE IsRunning(/* [in] */ LPOLESTR pszItem); }; typedef CComObject<CItemContainer> CItemContainerInstance; #endif
zzhongster-activex
ff-activex-host/ffactivex/common/ItemContainer.h
C++
lgpl
3,631
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is RSJ Software GmbH code. * * The Initial Developer of the Original Code is * RSJ Software GmbH. * Portions created by the Initial Developer are Copyright (C) 2009 * the Initial Developer. All Rights Reserved. * * Contributors: * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ BOOL TestAuthorization (NPP Instance, int16 ArgC, char *ArgN[], char *ArgV[], const char *MimeType);
zzhongster-activex
ff-activex-host/ffactivex/authorize.h
C
lgpl
2,050
/* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is RSJ Software GmbH code. * * The Initial Developer of the Original Code is * RSJ Software GmbH. * Portions created by the Initial Developer are Copyright (C) 2009 * the Initial Developer. All Rights Reserved. * * Contributors: * Ruediger Jungbeck <ruediger.jungbeck@rsj.de> * * Alternatively, the contents of this file may be used under the terms of * either the GNU General Public License Version 2 or later (the "GPL"), or * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ #include <stdio.h> #include <windows.h> #include <winbase.h> // ---------------------------------------------------------------------------- int main (int ArgC, char *ArgV[]) { const char *sourceName; const char *targetName; HANDLE targetHandle; void *versionPtr; DWORD versionLen; int lastError; int ret = 0; if (ArgC < 3) { fprintf(stderr, "Usage: %s <source> <target>\n", ArgV[0]); exit (1); } sourceName = ArgV[1]; targetName = ArgV[2]; if ((versionLen = GetFileVersionInfoSize(sourceName, NULL)) == 0) { fprintf(stderr, "Could not retrieve version len from %s\n", sourceName); exit (2); } if ((versionPtr = calloc(1, versionLen)) == NULL) { fprintf(stderr, "Error allocating temp memory\n"); exit (3); } if (!GetFileVersionInfo(sourceName, NULL, versionLen, versionPtr)) { fprintf(stderr, "Could not retrieve version info from %s\n", sourceName); exit (4); } if ((targetHandle = BeginUpdateResource(targetName, FALSE)) == INVALID_HANDLE_VALUE) { fprintf(stderr, "Could not begin update of %s\n", targetName); free(versionPtr); exit (5); } if (!UpdateResource(targetHandle, RT_VERSION, MAKEINTRESOURCE(VS_VERSION_INFO), MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL), versionPtr, versionLen)) { lastError = GetLastError(); fprintf(stderr, "Error %d updating resource\n", lastError); ret = 6; } if (!EndUpdateResource(targetHandle, FALSE)) { fprintf(stderr, "Error finishing update\n"); ret = 7; } free(versionPtr); return (ret); }
zzhongster-activex
ff-activex-host/transver/transver.cpp
C++
lgpl
3,963
<html> <head> </head> <body> <script language="JavaScript"> function Test() { var result = plugin.invoke("<QueryStatus />"); alert(result); } /* instantiate the plugin */ var plugin = document.createElement("object"); plugin.setAttribute("type", "application/x-itst-activex"); plugin.setAttribute("progid", "prodown.GenRSJ"); document.body.appendChild(plugin); window.setTimeout("Test()", 100); </script> <button onclick="Test()">Test</button> </body> </html>
zzhongster-activex
ff-activex-host/test.html
HTML
lgpl
571
setlocal cd install "c:\Program Files\Inno Setup 5\iscc" /O../dist /dxversion=%1 /dxbasepath=../ ffactivex.iss cd .. copy dist\ffactivex-setup.exe dist\ffactivex-setup-%1.exe endlocal
zzhongster-activex
ff-activex-host/tool/mkinst.cmd
Batchfile
lgpl
200
#ifndef MyAppName #define MyAppName "Firefox ActiveX Plugin" #endif #ifndef MyAppURL #define MyAppURL "http://code.google.com/p/ff-activex-host/" #endif #ifndef xversion #define xversion "r37" #endif #ifndef xbasepath #define xbasepath "c:\src\ff-activex-host\ff-activex-host\" #endif [Setup] AppId={{97F2985C-B74A-4672-960E-E3769AE5657A}} AppName={#MyAppName} AppVerName={#MyAppName} {#xversion} AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={pf}\{#MyAppName} DefaultGroupName={#MyAppName} OutputBaseFilename=ffactivex-setup Compression=lzma SolidCompression=yes InternalCompressLevel=ultra ArchitecturesInstallIn64BitMode=x64 ia64 #include "ffactivex.inc" [Registry] Root: HKLM32; Subkey: "SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes\application/x-itst-activex\clsid\*"; ValueType: string; ValueName: "*"; ValueData: true; Root: HKLM32; Subkey: "SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes\application/x-itst-activex\progid\*"; ValueType: string; ValueName: "*"; ValueData: true; Root: HKLM32; Subkey: "SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes\application/x-itst-activex\codeBaseUrl\*"; ValueType: string; ValueName: "*"; ValueData: true; [Files] Source: {#xbasepath}\Release\transver.exe; DestDir: {app}; DestName: npffax.dll; Flags: overwritereadonly restartreplace uninsrestartdelete
zzhongster-activex
ff-activex-host/install/ffactivex.iss
Inno Setup
lgpl
1,415
[Files] Source: {#xbasepath}\Release\npffax.dll; DestDir: {app}; DestName: npffax.dll; Flags: overwritereadonly restartreplace uninsrestartdelete [Registry] Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex; Flags: uninsdeletekey Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex; ValueType: string; ValueName: Description; ValueData: {#MyAppName} {#xversion} Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex; ValueType: string; ValueName: ProductName; ValueData: {#MyAppName} {#xversion} Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex; ValueType: string; ValueName: Path; ValueData: {app}\npffax.dll Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex; ValueType: string; ValueName: Version; ValueData: {#xversion} Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes; ValueType: string; ValueName: Dummy; ValueData: {#xversion} Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes\application/x-itst-activex Root: HKLM32; Subkey: SOFTWARE\MozillaPlugins\@itstructures.com/ffactivex\MimeTypes\application/x-itst-activex; ValueType: string; ValueName: "Dummy"; ValueData: "{#xversion}"
zzhongster-activex
ff-activex-host/install/ffactivex.inc
C++
lgpl
1,366
package work.TP.IS.tp1.v1; import fr.dyade.aaa.agent.*; public class HelloWorldNot extends Notification { public String msg ="Hello World"; public HelloWorldNot(String msg){ this.msg=msg; } }
zzmgttz-ricm4-ar-3a
work/TP/IS/tp1/v1/HelloWorldNot.java
Java
gpl3
203
package work.TP.IS.tp1.v1; import fr.dyade.aaa.agent.*; public class HelloWorld extends Agent { public AgentId dest; public HelloWorld(short to) { super(to); } public void react(AgentId from, Notification n) throws Exception { if(n instanceof HelloWorldNot){ System.out.println(((HelloWorldNot)n).msg); //TO DO send a new notification } else super.react(from, n); } }
zzmgttz-ricm4-ar-3a
work/TP/IS/tp1/v1/HelloWorld.java
Java
gpl3
397
package work.TP.IS.tp1.v1; import java.io.*; import fr.dyade.aaa.agent.*; public class Launch { public static void main (String args[]) { // TO DO try{ AgentServer.init(args); // TO DO create agent ag to be deployed on AgentServer 0 //TO DO send a notification AgentServer.start(); }catch(Exception e){ e.printStackTrace(System.out); } } }
zzmgttz-ricm4-ar-3a
work/TP/IS/tp1/v1/Launch.java
Java
gpl3
393
package work.TP.IS.tp1.v1; import java.io.*; import fr.dyade.aaa.agent.*; public class HelloWorldClient extends Agent { public AgentId dest; public HelloWorldClient(short to) {super(to);} public void react(AgentId from, Notification n) throws Exception { //TO DO } }
zzmgttz-ricm4-ar-3a
work/TP/IS/tp1/v1/HelloWorldClient.java
Java
gpl3
272
package work.TP.IS.tp1.v1; import fr.dyade.aaa.agent.*; public class StartNot extends Notification { }
zzmgttz-ricm4-ar-3a
work/TP/IS/tp1/v1/StartNot.java
Java
gpl3
106
package fr.dyade.aaa.agent; import java.io.*; import fr.dyade.aaa.util.*; public class AgentId { public short from; public short to; public int stamp; }
zzmgttz-ricm4-ar-3a
fr/dyade/aaa/agent/AgentId.java
Java
gpl3
158
package fr.dyade.aaa.agent; public class Agent { public Agent(short to){ } public Agent(short to, String n){ } public final void deploy(){ } @Override public String toString(){ return null; } public final AgentId getId(){ return null; } public void react(AgentId from, Notification not) throws Exception{ } protected final void sendTo(AgentId id, Notification not){ } }
zzmgttz-ricm4-ar-3a
fr/dyade/aaa/agent/Agent.java
Java
gpl3
553
package fr.dyade.aaa.agent; public class Notification { }
zzmgttz-ricm4-ar-3a
fr/dyade/aaa/agent/Notification.java
Java
gpl3
60
using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Data; using ExtAspNet; using Sale_Operation; using DevExpress.XtraCharts; using Sale_Common; namespace SaleSystem { public class PageBase : System.Web.UI.Page { protected override void OnInit(EventArgs e) { base.OnInit(e); if (!IsPostBack) { if (PageManager.Instance != null) { HttpCookie themeCookie = Request.Cookies["Theme"]; if (themeCookie != null) { string themeValue = themeCookie.Value; PageManager.Instance.Theme = (Theme)Enum.Parse(typeof(Theme), themeValue, true); } HttpCookie langCookie = Request.Cookies["Language"]; if (langCookie != null) { string langValue = langCookie.Value; PageManager.Instance.Language = (Language)Enum.Parse(typeof(Language), langValue, true); } } } } protected void FormatGrid(Grid gv) { gv.PageSize = LinkService.PageSize; gv.RowHeight = "25"; gv.AutoScroll = true; } /// <summary> /// 生成柱状图 /// </summary> /// <param name="Chart">控件对象</param> /// <param name="DataName">显示的数据名称</param> /// <param name="DataValue">显示的数据值</param> /// <param name="Dt">数据源</param> /// <param name="HeaderText">标题文本</param> /// <param name="SmallTitle">统计文本</param> public void GetChart(DevExpress.XtraCharts.Web.WebChartControl Chart, string DataName, string DataValue, DataTable Dt, string HeaderText, string SmallTitle) { try { Chart.Height = Unit.Pixel(460); Chart.Width = Unit.Pixel(800); Chart.Series.Clear(); Chart.Titles.Clear(); Chart.BorderOptions.Visible = false; Chart.Legend.Border.Visible = false; for (int i = 0; i < Dt.Rows.Count; i++) { Series series = new Series(Dt.Rows[i][DataName].ToString(), ViewType.Bar3D); series.Label.Visible = true; series.Points.Add(new SeriesPoint(SmallTitle, new double[] { double.Parse( ValueHandler.GetDecNumberValue (Dt.Rows[i][DataValue].ToString()).ToString()) })); Chart.Series.Add(series); } Chart.Titles.Clear(); ChartTitle ct = new ChartTitle(); ct.Text = HeaderText; Chart.Titles.Add(ct); } catch (Exception ex) { } } /// <summary> /// 生成饼状图 /// </summary> /// <param name="Chart">控件对象</param> /// <param name="dt">数据源</param> /// <param name="DataName">名称</param> /// <param name="DataValue">值</param> public void GetPie(DevExpress.XtraCharts.Web.WebChartControl Chart, DataTable dt, string DataName, string DataValue, string HeaderText) { try { Chart.Height = Unit.Pixel(460); Chart.Width = Unit.Pixel(800); Chart.Series[0].Points.Clear(); DevExpress.XtraCharts.SeriesPoint p = null; //double[] d = { 0 }; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { p = new DevExpress.XtraCharts.SeriesPoint(); double[] d = { double.Parse( ValueHandler.GetDecNumberValue( dt.Rows[i][DataValue]).ToString()) }; p.Argument = dt.Rows[i][DataName].ToString(); p.ArgumentSerializable = dt.Rows[i][DataName].ToString(); p.Values = d; Chart.Series[0].Points.Add(p); } } Chart.Titles.Clear(); ChartTitle ct = new ChartTitle(); ct.Text = HeaderText; Chart.Titles.Add(ct); } catch { } } #region Property private string _strCondition; /// <summary> /// 子类可用 /// </summary> public string strCondition { get { return _strCondition; } set { _strCondition=value; } } /// <summary> /// 子类重写 /// </summary> public virtual void InitCondition() { } public int iRecordCount; public DataTable dtList; public object SModel; /// <summary> /// 如果是编辑界面,记录编辑界面的ID /// </summary> public int Id { get { if (ViewState["Id"] != null) return int.Parse(ViewState["Id"].ToString()); else return 0; } set { ViewState["Id"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Code/PageBase.cs
C#
asf20
5,815
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_StockDetailList.aspx.cs" Inherits="SaleSystem.Stock.frm_StockDetailList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>库存查询</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click"> </ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" Hidden="true"> </ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SDeta_Stock_Id" Label="仓库名称" Width="200px" DataValueField="Stock_Id" DataTextField="Stock_Name" TabIndex="1"> </ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_PInfo_PSort_ID" Label="产品类别" Width="200px" Required="true" CompareValue="-1" CompareOperator="NotEqual" ShowRedStar="true" DataTextField="PSort_Name" DataValueField="PSort_ID" EnableSimulateTree="true" TabIndex="2" DataSimulateTreeLevelField="ilevel"> </ext:DropDownList> <ext:TwinTriggerBox Width="200px" EnableEdit="false" runat="server" ID="tb_SDeta_PInfo_Id" Trigger1Icon="Clear" Trigger2Icon="Search" Label="产品名称" OnTrigger1Click="tb_SDeta_PInfo_Id_TriggerClick" TabIndex="3"> </ext:TwinTriggerBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_SDeta_RealNumber1" DecimalPrecision="0" Label="库存量>=" Width="200px" TabIndex="4"></ext:NumberBox> <ext:NumberBox runat="server" ID="nb_SDeta_RealNumber2" DecimalPrecision="0" Label="库存量<=" Width="200px" TabIndex="5"> </ext:NumberBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="库存明细列表" IsDatabasePaging="true" DataKeyNames="SDeta_PInfo_Id,PInfo_Name" EnableRowNumber="true" AllowPaging="true" OnPageIndexChange="gv_List_PageIndexChange" AutoHeight="true" OnRowCommand="gv_List_RowCommand" > <Columns> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" DataTextField="PInfo_Code" DataTooltipField="PInfo_Code" Text="产品编码" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="150px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="类别" Width="80px" /> <%-- <ext:BoundField ColumnID="PInfo_Cost" DataField="PInfo_Cost" DataTooltipField="PInfo_Cost" HeaderText="成本价" Width="80px" /> <ext:BoundField ColumnID="PInfo_Price" DataField="PInfo_Price" DataTooltipField="PInfo_Price" HeaderText="零售价" Width="80px" />--%> <ext:LinkButtonField ColumnID="SDeta_InputNumber" DataTextField="SDeta_InputNumber" DataTooltipField="SDeta_InputNumber" HeaderText="入库总量" Width="80px" CommandName="SDeta_InputNumber" /> <ext:LinkButtonField ColumnID="SDeta_OutputNumber" DataTextField="SDeta_OutputNumber" DataTooltipField="SDeta_OutputNumber" HeaderText="已出库量" Width="80px" CommandName="SDeta_OutputNumber"/> <ext:BoundField ColumnID="SDeta_RealNumber" DataField="SDeta_RealNumber" DataTooltipField="SDeta_RealNumber" HeaderText="当前库存" Width="80px" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="产品选择" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"> </ext:Window> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增产品" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="500px"> </ext:Window> <ext:Window runat="server" ID="win_Content3" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="单据列表" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="false"></ext:Window> <ext:HiddenField runat="server" ID="hf_Other"> </ext:HiddenField> <ext:HiddenField runat="server" ID="hf_SDeta_PInfo_Id"> </ext:HiddenField> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Stock/frm_StockDetailList.aspx
ASP.NET
asf20
5,829
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_StockList.aspx.cs" Inherits="SaleSystem.Stock.frm_StockList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="仓库列表" EnableRowNumber="true" > <Columns> <ext:BoundField ColumnID="Stock_Code" DataField="Stock_Code" DataTooltipField="Stock_Code" HeaderText="编码" Width="150px" /> <ext:BoundField ColumnID="Stock_Name" DataField="Stock_Name" DataTooltipField="Stock_Name" HeaderText="名称" Width="200px" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增数据字典" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="250px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Stock/frm_StockList.aspx
ASP.NET
asf20
1,215
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Stock { public partial class frm_StockDetailList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { tb_SDeta_PInfo_Id.OnClientTrigger2Click = win_Content.GetSaveStateReference(tb_SDeta_PInfo_Id.ClientID, this.hf_SDeta_PInfo_Id.ClientID, this.hf_Other.ClientID, this.hf_Other.ClientID, this.hf_Other.ClientID, this.hf_Other.ClientID) + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id="); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "edit") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../BaseData/frm_ProductInfoEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (e.CommandName.ToLower() == "sdeta_outputnumber") { win_Content3.Hidden = false; win_Content3.IFrameUrl = "../ComPage/frm_BillList.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0])+"&Type=1"; win_Content3.Title = "销售明细-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (e.CommandName.ToLower() == "sdeta_inputnumber") { win_Content3.Hidden = false; win_Content3.IFrameUrl = "../ComPage/frm_BillList.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]) + "&Type=2"; win_Content3.Title = "进货明细-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void tb_SDeta_PInfo_Id_TriggerClick(object sender, EventArgs e) { this.hf_Other.Text = ""; this.tb_SDeta_PInfo_Id.Text = ""; } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField lbfAction1 = gv_List.FindColumn("edit") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField lbfAction2 = gv_List.FindColumn("delete") as ExtAspNet.LinkButtonField; DataRowView row = e.DataItem as DataRowView; if (ValueHandler.GetIntNumberValue(row["BBill_Input"]) == 1) { // lbfAction1.Enabled = false; lbfAction1.Text = "查看"; lbfAction2.Enabled = false; } else { lbfAction1.Enabled = true; lbfAction2.Enabled = true; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (ddl_SDeta_Stock_Id.SelectedValue != "-1") { strCondition += "SDeta_Stock_Id="+this.ddl_SDeta_Stock_Id.SelectedValue+" AND "; } if (this.ddl_PInfo_PSort_ID.SelectedValue != "0") { int PSortId = ValueHandler.GetIntNumberValue(this.ddl_PInfo_PSort_ID.SelectedValue); ProductSortOp SortManager = new ProductSortOp(); DataTable dtSortList = SortManager.GetSubProductSort(PSortId); string strSortIds = "PInfo_PSort_ID IN("+PSortId.ToString()+","; for (int i = 0; i < dtSortList.Rows.Count; i++) { strSortIds += ValueHandler.GetIntNumberValue(dtSortList.Rows[i]["PSort_ID"]).ToString() + ","; } strCondition += strSortIds.Substring(0, strSortIds.Length - 1) + ") AND "; } if (tb_SDeta_PInfo_Id.Text.Trim() != "") { strCondition += " SDeta_PInfo_Id=" + this.hf_SDeta_PInfo_Id.Text + " AND "; } if (this.nb_SDeta_RealNumber1.Text.Trim() != "") { strCondition += " SDeta_RealNumber>=" + this.nb_SDeta_RealNumber1.Text + " AND "; } if (this.nb_SDeta_RealNumber2.Text.Trim() != "") { strCondition += "SDeta_RealNumber<="+this.nb_SDeta_RealNumber2.Text+" AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { ProductSortOp SortManager = new ProductSortOp(); dtList = SortManager.GetList(""); dtList.Columns.Add(new DataColumn("ilevel", typeof(System.Int32))); DataTable dtRes = dtList.Clone(); DataRow dr = dtRes.NewRow(); dr["PSort_ID"] = 0; dr["PSort_Code"] = ""; dr["PSort_Name"] = "公司产品库"; dr["PSort_PSort_ID"] = 0; dr["ilevel"] = 1; dtRes.Rows.Add(dr); ConstructLevel(dtRes, 0, 1); ddl_PInfo_PSort_ID.DataSource = dtRes; ddl_PInfo_PSort_ID.DataBind(); //获取仓库列表 DataTable dtStockList= Manager.GetStockList(""); this.ddl_SDeta_Stock_Id.DataSource = dtStockList; this.ddl_SDeta_Stock_Id.DataBind(); // ddl_PInfo_PSort_ID.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void ConstructLevel(DataTable dtRes, int id, int ilevel) { DataView dv = new DataView(dtList); dv.RowFilter = "PSort_PSort_ID=" + id.ToString(); if (dv.Count > 0) ilevel++; for (int i = 0; i < dv.Count; i++) { dv[i]["ilevel"] = ilevel; dtRes.ImportRow(dv[i].Row); ConstructLevel(dtRes, ValueHandler.GetIntNumberValue(dv[i]["PSort_ID"]), ilevel); } } #endregion #region Property StockOp Manager = new StockOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Stock/frm_StockDetailList.aspx.cs
C#
asf20
7,700
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Stock { public partial class frm_StockList : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } private void GetAndBind() { FormatGrid(gv_List); dtList = Manager.GetStockList(""); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } #region Property StockOp Manager = new StockOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Stock/frm_StockList.aspx.cs
C#
asf20
1,136
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using ExtAspNet; using Sale_Operation; using Sale_Model; using Sale_Common; namespace SaleSystem { public partial class main : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnExit.OnClientClick = "window.location='index.aspx';return false;"; bnStyle.OnClientClick = win_Content.GetShowReference("./Other/frm_StyleList.aspx", "主题切换"); GetAndBind(); GetWrokPlan(); GetHomeUrl(); } } public void timer_getInfo_Tick(object sender, EventArgs e) { } /// <summary> /// Change theme. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlTheme_SelectedIndexChanged(object sender, EventArgs e) { //HttpCookie themeCookie = new HttpCookie("Theme", ddlTheme.SelectedValue); //themeCookie.Expires = DateTime.Now.AddYears(1); //Response.Cookies.Add(themeCookie); //PageContext.Refresh(); } /// <summary> /// 一但有子窗口打开,该按钮报错 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bnExitClick(object sender, EventArgs e) { Session.Abandon(); Response.Redirect("index.aspx"); } #endregion private void GetHomeUrl() { SysConfigOp Manager = new SysConfigOp(); SysConfig SM = new SysConfig(); SM.SConf_Id = 6; Manager.GetConfig(SM); this.tab_Home.IFrameUrl= SM.SConf_Value; } private void GetWrokPlan() { //工作计划 WorkPlanOp workManager = new WorkPlanOp(); DataTable dt = workManager.GetList("WPlan_WarningTime<='" + System.DateTime.Now.ToString("yyyy-MM-dd") + "' AND WPlan_Enable=1 AND WPlan_State=0 AND A.State=1 "); if (dt.Rows.Count > 0) { WorkForm.Title = "您最近有<font color='red'>" + dt.Rows.Count.ToString() + "</font>件事情需要处理!"; bnWorkFlow.Text = "(<font color='red'>" + dt.Rows.Count + "</font>)"; bnWorkFlow.ToolTip = "您最近有<font color='red'>" + dt.Rows.Count.ToString() + "</font>件事情需要处理!"; PageContext.RegisterStartupScript("GetPosition();"); } } private void GetAndBind() { //获取系统名称 SysConfigOp sysConfigOp = new SysConfigOp(); SysConfig config = new SysConfig(); config.SConf_Id = (int)EConfig.系统名称; sysConfigOp.GetConfig(config); lbSystemInfo.Text = config.SConf_Value; config.SConf_Id = (int)EConfig.版本号; sysConfigOp.GetConfig(config); this.Title = lbSystemInfo.Text + config.SConf_Value; lbSystemInfo.Text = lbSystemInfo.Text + "&nbsp;" + config.SConf_Value; //获取登陆信息 tb_UserName.Text = "欢迎 &nbsp;<font color='red' bold='true'>" + LinkService.GetCurrentUser().SUser_Name + "</font>&nbsp;登陆系统!"; SysMenuOp menuOp = new SysMenuOp(); List<SysMenu> LSMenu = menuOp.GetList(); BindTree(LSMenu, 0, tv_Menu.Nodes); tv_Menu.Expanded = true; tv_Menu.ExpandAllNodes(); } private void BindTree(List<SysMenu> LS, int id,ExtAspNet.TreeNodeCollection tns) { List<SysMenu> LS1 = LS.FindAll(t => t.SMenu_PId == id); for (int i = 0; i < LS1.Count; i++) { ExtAspNet.TreeNode tn = new ExtAspNet.TreeNode(); tn.NodeID = LS1[i].SMenu_Id.ToString(); tn.Text = LS1[i].SMenu_Title; if (LS1[i].SMenu_PId == 0) tn.Icon = Icon.Folder; else { tn.Icon = Icon.NoteEdit; tn.Leaf = true; } tn.NavigateUrl = LS1[i].SMenu_Page; tn.Target = "main"; tns.Add(tn); BindTree(LS, LS1[i].SMenu_Id, tn.Nodes); } } } }
zzyxyh
trunk/SaleSystem/SaleSystem/main.aspx.cs
C#
asf20
4,902
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; namespace SaleSystem.ComPage { public partial class frm_SaleBillSubList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.Id = ValueHandler.GetIntNumberValue(Request["Id"]); bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); InitControl(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } public void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "edit") { if (Request["Type"] == "1") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_SaleBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (Request["Type"] == "2") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_BuyEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (Request["Type"] == "3") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_SaleBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } else if (e.CommandName.ToLower() == "ok") { //TreeNodeCollection nodes string strText = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); string strValue = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][0]); ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetWriteBackValueReference(strText, strValue) + ExtAspNet.ActiveWindow.GetHidePostBackReference("GetSaleBillDetail")); } } #endregion #region Method private void InitControl() { //销售单类型 BaseDataOp BaseManager = new BaseDataOp(); DataTable dtList1 = BaseManager.GetList("BData_Type=4"); this.ddl_SBill_Type.DataSource = dtList1; this.ddl_SBill_Type.DataBind(); this.ddl_SBill_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //经办人 SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_SBill_User.DataSource = dtUser; this.ddl_SBill_User.DataBind(); this.ddl_SBill_User.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { //获取销售单 InitCondition(); int iRecordCount = 0; dtList = Manager.GetSaleBillDetail(strCondition, gv_List.PageIndex, ref iRecordCount); this.gv_List.DataSource = dtList; this.gv_List.DataBind(); this.gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (this.tb_SBill_Code.Text.Trim() != "") { strCondition += "SBill_Code LIKE '%" + ValueHandler.GetStringValue(this.tb_SBill_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (this.tb_SBill_Code2.Text.Trim() != "") { strCondition += "SBill_Code2 LIKE '%" + ValueHandler.GetStringValue(this.tb_SBill_Code2.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (this.tb_SBill_Cust_Id.Text.Trim() != "") { strCondition += " Cust_Name LIKE '%" + ValueHandler.GetStringValue(this.tb_SBill_Cust_Id.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (this.ddl_SBill_Type.SelectedValue.Trim() != "-1") { strCondition += " SBill_Type =" + this.ddl_SBill_Type.SelectedValue + " AND "; } if (this.tb_PInfo_Name.Text.Trim() != "") { strCondition += " PInfo_Name LIKE '%" + ValueHandler.GetStringValue(this.tb_PInfo_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (this.tb_PInfo_CH.Text.Trim() != "") { strCondition += " PInfo_CH LIKE '%" + ValueHandler.GetStringValue(this.tb_PInfo_CH.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (this.ddl_SBill_User.SelectedValue != "-1") { strCondition += " SBill_User =" + this.ddl_SBill_User.SelectedValue + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } #endregion #region Property BillListOp Manager = new BillListOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_SaleBillSubList.aspx.cs
C#
asf20
6,448
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_CustomerChooseList.aspx.cs" Inherits="SaleSystem.ComPage.frm_CustomerChooseList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bn_Close" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Cust_Code" Label="客户编码" Width="200px"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Name" Label="客户名称" Width="200px"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_Cust_BData_Id" Label="客户类型" Width="200px" DataTextField="BData_Name" DataValueField="BData_Id" ></ext:DropDownList> <ext:TextBox runat="server" ID="tb_Cust_IdentityCode" Label="身份证" Width="200px"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Cust_Tel1" Label="手机" Width="200px" ></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Tel2" Label="电话" Width="200px"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Email" Label="Email" Width="200px"></ext:TextBox> <ext:TextBox runat="server" ID="tb_QQ" Label="QQ" Width="200px"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="客户信息列表" IsDatabasePaging="true" DataKeyNames="Cust_Id,Cust_Name" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" onrowdatabound="gv_List_RowDataBound"> <Columns> <ext:LinkButtonField ColumnID="OK" CommandName="OK" Text="确定" HeaderText="" Width="60px" /> <ext:BoundField ColumnID="Cust_Code" DataField="Cust_Code" DataTooltipField="Cust_Code" HeaderText="客户编码" Width="100px" /> <ext:BoundField ColumnID="Cust_Name" DataField="Cust_Name" DataTooltipField="Cust_Name" HeaderText="客户名称" Width="150px"/> <ext:BoundField ColumnID="CustomerType" DataField="CustomerType" DataTooltipField="CustomerType" HeaderText="客户类型" Width="80px"/> <ext:BoundField ColumnID="Cust_Sex" DataField="Cust_Sex" DataTooltipField="Cust_Sex" HeaderText="性别" Width="50px"/> <ext:BoundField ColumnID="Cust_IdentityCode" DataField="Cust_IdentityCode" DataTooltipField="Cust_IdentityCode" HeaderText="身份证" Width="80px"/> <ext:BoundField ColumnID="Cust_Tel1" DataField="Cust_Tel1" DataTooltipField="Cust_Tel1" HeaderText="手机" Width="80px"/> <ext:BoundField ColumnID="Cust_Tel2" DataField="Cust_Tel2" DataTooltipField="Cust_Tel2" HeaderText="电话" Width="80px"/> <ext:BoundField ColumnID="Email" DataField="Email" DataTooltipField="Email" HeaderText="Email" Width="80px"/> <ext:BoundField ColumnID="QQ" DataField="QQ" DataTooltipField="QQ" HeaderText="QQ" Width="80px"/> <ext:BoundField ColumnID="Cust_ProfessionalName" DataField="Cust_ProfessionalName" DataTooltipField="Cust_ProfessionalName" HeaderText="职业" Width="80px" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增客户" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="500px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_CustomerChooseList.aspx
ASP.NET
asf20
4,733
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_BillList.aspx.cs" Inherits="SaleSystem.ComPage.frm_BillList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>销售单,进货单明细</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="列表" IsDatabasePaging="true" DataKeyNames="Id,Code" EnableRowNumber="true" AllowPaging="true" OnPageIndexChange="gv_List_PageIndexChange" AutoHeight="true" ShowHeader="false" BodyPadding="5px" ShowBorder="false" OnRowCommand="gv_List_RowCommand"> <Columns> <ext:LinkButtonField ColumnID="OK" CommandName="OK" Text="确定" HeaderText="确定" Width="50px" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="50px" /> <ext:BoundField ColumnID="Code" DataField="Code" DataTooltipField="Code" HeaderText="销售单号" Width="100px" /> <ext:BoundField ColumnID="CustName" DataField="CustName" DataTooltipField="CustName" HeaderText="客户名称" Width="100px"/> <ext:TemplateField HeaderText="销售日期" Width="80px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "SBill_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:BoundField ColumnID="SBDeta_Count" DataField="SBDeta_Count" DataTooltipField="SBDeta_Count" HeaderText="数量" Width="50px"/> <ext:BoundField ColumnID="SBDeta_Price" DataField="SBDeta_Price" DataTooltipField="SBDeta_Price" HeaderText="单价" Width="50px"/> <ext:BoundField ColumnID="SBDeta_Money" DataField="SBDeta_Money" DataTooltipField="SBDeta_Money" HeaderText="金额" Width="80px"/> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="60px"/> <ext:CheckBoxField ColumnID="SBill_State" DataField="SBill_State" DataTooltipField="SBill_State" HeaderText="结算" Width="50px"/> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" EnableMaximize="false" Title="新增销售单" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" ></ext:Window> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_BillList.aspx
ASP.NET
asf20
2,715
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ProductChooseList.aspx.cs" Inherits="SaleSystem.ComPage.frm_ProductChooseList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bn_Search" Icon="FolderFind" Text="查询" OnClick="bn_SearchClick" Type="Submit"> </ext:Button> <ext:Button runat="server" ID="bn_Close" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <ext:Form runat="server" ID="SimpleForm1" EnableBackgroundColor="true" ShowBorder="false" AutoWidth="true" ShowHeader="false" BodyPadding="5px" AutoHeight="true"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_Code" Label="产品编码" Width="200px" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Name" Label="产品名称" Width="200px" MaxLength="100"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_Number" Label="号码" Width="200px" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Pwd" Label="密码" Width="200px" MaxLength="100"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_CH" Label="串号" Width="200px" MaxLength="100"> </ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="产品信息列表" IsDatabasePaging="true" DataKeyNames="PInfo_Id,PInfo_Name,PInfo_Cost,PInfo_Price" EnableRowNumber="true" AllowPaging="true" onrowcommand="gv_List_RowCommand" OnPageIndexChange="gv_List_PageIndexChange" > <Columns> <ext:LinkButtonField ColumnID="OK" CommandName="OK" Text="确定" HeaderText="" Width="60px" /> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="90px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="90px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类别" Width="80px" /> <ext:BoundField ColumnID="PInfo_Number" DataField="PInfo_Number" DataTooltipField="PInfo_Number" HeaderText="号码" Width="90px" /> <ext:BoundField ColumnID="PInfo_Pwd" DataField="PInfo_Pwd" DataTooltipField="PInfo_Pwd" HeaderText="密码" Width="60px" /> <ext:BoundField ColumnID="PInfo_CH" DataField="PInfo_CH" DataTooltipField="PInfo_CH" HeaderText="串号" Width="80px" /> <ext:BoundField ColumnID="PInfo_Price" DataField="PInfo_Price" DataTooltipField="PInfo_Price" HeaderText="零售价" Width="70px" /> <ext:BoundField ColumnID="SDeta_RealNumber" DataField="SDeta_RealNumber" DataTooltipField="SDeta_RealNumber" HeaderText="库存" Width="60px" /> </Columns> </ext:Grid> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_ProductChooseList.aspx
ASP.NET
asf20
5,094
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SaleBillSubList.aspx.cs" Inherits="SaleSystem.ComPage.frm_SaleBillSubList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Text="关闭" Icon="SystemClose"> </ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" AutoScroll="true" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Code" Label="销售单号" Width="200px" TabIndex="1"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_SBill_Code2" Label="出库单号" Width="200px" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_Type" Label="销售单类型" Width="200px" DataValueField="BData_Id" TabIndex="3" DataTextField="BData_Name"> </ext:DropDownList> <ext:TextBox runat="server" ID="tb_SBill_Cust_Id" Label="客户名称" Width="200px" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_Name" Label="产品名称" Width="200px" TabIndex="2"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_CH" Label="串号" Width="200px" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_User" Label="经办人" Width="200px" DataValueField="SUser_Id" TabIndex="11" DataTextField="SUser_Name"> </ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="列表" IsDatabasePaging="true" DataKeyNames="Id,Code" EnableRowNumber="true" AllowPaging="true" OnPageIndexChange="gv_List_PageIndexChange" AutoHeight="true" ShowHeader="false" BodyPadding="5px" ShowBorder="false" OnRowCommand="gv_List_RowCommand"> <Columns> <ext:LinkButtonField ColumnID="OK" CommandName="OK" Text="确定" HeaderText="确定" Width="50px" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="50px" /> <ext:BoundField ColumnID="Code" DataField="Code" DataTooltipField="Code" HeaderText="销售单号" Width="100px" /> <ext:BoundField ColumnID="SBill_Code2" DataField="SBill_Code2" DataTooltipField="SBill_Code2" HeaderText="出库单号" Width="100px" /> <ext:BoundField ColumnID="CustName" DataField="CustName" DataTooltipField="CustName" HeaderText="客户名称" Width="100px"/> <ext:TemplateField HeaderText="销售日期" Width="80px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "SBill_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px"/> <ext:BoundField ColumnID="PInfo_CH" DataField="PInfo_CH" DataTooltipField="PInfo_CH" HeaderText="串号" Width="100px"/> <ext:CheckBoxField ColumnID="SBill_State" DataField="SBill_State" DataTooltipField="SBill_State" HeaderText="结算" Width="50px"/> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" EnableMaximize="false" Title="新增销售单" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" ></ext:Window> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_SaleBillSubList.aspx
ASP.NET
asf20
5,006
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Text; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; using ExtAspNet; namespace SaleSystem.ComPage { public partial class frm_ProductChooseList : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bn_Close.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); GetAndBind(); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void bn_SearchClick(object sender, EventArgs e) { GetAndBind(); } private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { if (tb_PInfo_CH.Text.Trim() != "") { strCondition += " PInfo_CH LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_CH.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Code.Text.Trim() != "") { strCondition += " PInfo_Code LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Name.Text.Trim() != "") { strCondition += " PInfo_Name LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Number.Text.Trim() != "") { strCondition += " PInfo_Number LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Number.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Pwd.Text.Trim() != "") { strCondition += " PInfo_Pwd LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Pwd.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "ok") { //TreeNodeCollection nodes string strText = ValueHandler.GetStringValue( gv_List.DataKeys[e.RowIndex][1] ); string strValue = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][0]); string strBBDeta_Count = "1"; string strBBDeta_CostPrice = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][2]); string strPInfo_Price = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][3]); string strTotal = (ValueHandler.GetDecNumberValue(strBBDeta_CostPrice) * ValueHandler.GetIntNumberValue(strBBDeta_Count)).ToString(); PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(strText, strValue, strBBDeta_Count, strBBDeta_CostPrice,strTotal, strPInfo_Price) + ActiveWindow.GetHidePostBackReference()); } } #region Property ProductInfoOp Manager = new ProductInfoOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_ProductChooseList.aspx.cs
C#
asf20
4,098
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Common; using Sale_Model; using Sale_Operation; namespace SaleSystem.ComPage { public partial class frm_PutInUploadList : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } FormatGrid(gv_List); } // this.gv_List.PageIndexChange += new EventHandler<ExtAspNet.GridPageEventArgs>(gv_List_PageIndexChange); } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; SortPags sp = new SortPags(dtDetail); this.gv_List.DataSource = sp.GetCurrentPage(LinkService.PageSize, gv_List.PageIndex+1); this.gv_List.DataBind(); this.gv_List.RecordCount = dtDetail.Rows.Count; this.gv_List.Title = "进货单明细,共[" + dtDetail.Rows.Count.ToString() + "]条"; DataView dv = new DataView(dtDetail); dv.RowFilter = "IsError=0"; if (dv.Count > 0) this.gv_List.Title += "错误信息<font color='red'>[" + dv.Count + "]</font>条"; } protected void bnInput_Click(object sender, EventArgs e) { SModel.BBill_Id = Id; DataTable dtSave= Manager.GetDetail(SModel); if (SModel.BBill_Input == 1) { ExtAspNet.Alert.Show("该进货单已经入库,不能导入!"); return; } else { dtSave.Rows.Clear(); dtSave.AcceptChanges(); DataTable dtCurrent =dtDetail; for(int i = 0 ; i <dtCurrent.Rows.Count;i++) { if (dtCurrent.Rows[i]["IsError"].ToString() == "0")//校验不通过的,则不能导入 continue; DataRow dr = dtSave.NewRow(); dr["BBDeta_SBill_Id"]=SModel.BBill_Id; dr["BBDeta_PInfo_Id"] = dtCurrent.Rows[i]["ProductInfo"]; dr["BBDeta_Count"] = ValueHandler.GetIntNumberValue( dtCurrent.Rows[i]["数量"]); dr["BBDeta_CostPrice"] = ValueHandler.GetDecNumberValue( dtCurrent.Rows[i]["成本价"]); dr["BBDeta_Price"] = ValueHandler.GetDecNumberValue( dtCurrent.Rows[i]["零售价"]); dr["BBDeta_Money"] = ValueHandler.GetDecNumberValue(dtCurrent.Rows[i]["数量"]) * ValueHandler.GetDecNumberValue(dtCurrent.Rows[i]["成本价"]); dr["BBDeta_Memo"] = ""; dtSave.Rows.Add(dr); } SModel.BBill_Count = ValueHandler.GetIntNumberValue(dtSave.Compute("sum(BBDeta_Count)", "")); SModel.BBill_Money = ValueHandler.GetDecNumberValue(dtSave.Compute("sum(BBDeta_Money)", "")); bool blRes = Manager.Save(SModel, dtSave); if (blRes) { ExtAspNet.Alert.Show("导入完成!", "提示!", "" + ExtAspNet.ActiveWindow.GetHideRefreshReference()); } else { ExtAspNet.Alert.Show("导入失败!", "操作提示", ExtAspNet.MessageBoxIcon.Error); } } } protected void bnUpload_Click(object sender, EventArgs e) { if (bn_Excel.FileName.ToString() == "") { ExtAspNet.Alert.Show("请选择要导入的文件!"); return; } string strName = System.DateTime.Now.ToString("yyyyMMddhhmmss")+".xls"; string M_ApplicationPath = Request.ApplicationPath; if (M_ApplicationPath == "") M_ApplicationPath = "/"; if (!M_ApplicationPath.EndsWith("/")) M_ApplicationPath += "/"; bn_Excel.SaveAs(Server.MapPath( M_ApplicationPath )+ "/Upload/" + strName); DataTable dt = ExcelHandler.GetTableFrom(Server.MapPath(M_ApplicationPath) + "/Upload/" + strName, "入库单模版"); dt.Columns.Add("ProductInfo");//导入的产品的ID dt.Columns.Add("IsError",typeof(System.Int16));//IsError 0:则该产品有问题,不能插入到进货单中, 1:则没有问题,可以插入 dt.Columns.Add("ErrorMessage");//存储错误信息 int iUserId= LinkService.GetCurrentUser().SUser_Id; #region 1)将每个产品插入数据库中,如果该产品在数据库中存在,则将该产品信息(ProductInfo)从数据库中取出,并放到内存中 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt.Rows[i]; try { //插入该产品前,先校验该产品类别是否存在 ProductSortOp SortOp = new ProductSortOp(); ProductSort SortSM = new ProductSort(); SortSM.PSort_Name = ValueHandler.GetStringValue(dr["产品类别"], ValueHandler.CharHandlerType.IsRepChar); SortSM = SortOp.GetModel(SortSM); dr["IsError"] = 0; //大类不存在,则跳过 if (SortSM.PSort_ID == 0) { dr["ErrorMessage"] = "该产品大类不存在,请在数据库中添加后再做此操作!"; continue; } //校验产品编码是否重复 ProductInfoOp ProductOp = new ProductInfoOp(); ProductInfo ProductSM = new ProductInfo(); ProductSM.PInfo_Code = ValueHandler.GetStringValue(dr["产品编码"], ValueHandler.CharHandlerType.IsRepChar); ProductSM.PInfo_Name = ValueHandler.GetStringValue(dr["产品名称"], ValueHandler.CharHandlerType.IsRepChar); ProductSM.PInfo_Cost = ValueHandler.GetDecNumberValue(ProductSM.PInfo_Cost); ProductSM.PInfo_Price = ValueHandler.GetDecNumberValue(ProductSM.PInfo_Price); if (ProductSM.PInfo_Name.Trim() != "") { ProductSM = ProductOp.GetModelByName(ProductSM); } if (ProductSM.PInfo_Id != 0) { dr["ProductInfo"] = ProductSM.PInfo_Id; dr["产品编码"] = ProductSM.PInfo_Code; dr["IsError"] = 1; } else { //新增产品 ProductSM.PInfo_Code= Coder.CreateCoder(EMenuList.产品管理); ProductSM.CreateMan = iUserId; ProductSM.CreateTime = System.DateTime.Now; ProductSM.PInfo_CH = ValueHandler.GetStringValue(dr["串号"], ValueHandler.CharHandlerType.IsRepChar); ProductSM.PInfo_Cost = ValueHandler.GetDecNumberValue(dr["成本价"]); ProductSM.PInfo_Number = ValueHandler.GetStringValue(dr["号码"], ValueHandler.CharHandlerType.IsRepChar); ProductSM.PInfo_Price = ValueHandler.GetDecNumberValue(dr["零售价"]); ProductSM.PInfo_PSort_ID = SortSM.PSort_ID; ProductSM.PInfo_Pwd = ValueHandler.GetStringValue(dr["密码"], ValueHandler.CharHandlerType.IsRepChar); ProductSM.State = 1; ProductSM.PInfo_Memo = ValueHandler.GetStringValue( dr["备注"]); bool blRes = ProductOp.Save(ProductSM); if (blRes) { dr["ProductInfo"] = ProductSM.PInfo_Id; dr["产品编码"] = ProductSM.PInfo_Code; dr["IsError"] = 1; } else { dr["IsError"] = 0; dr["ErrorMessage"] = "产品导入到数据库中失败,请查看操作日志!"; } } } catch (Exception ex) { dr["IsError"] = 0; dr["ErrorMessage"] = ex.ToString(); } } #endregion #region 将内存中标志为正确的数据,保存到该入库单中 gv_List.PageSize = LinkService.PageSize; SortPags sp = new SortPags(dt); this.gv_List.DataSource = sp.GetCurrentPage(LinkService.PageSize, gv_List.PageIndex+1); this.gv_List.DataBind(); this.gv_List.RecordCount = dt.Rows.Count; this.gv_List.Title = "进货单明细,共["+dt.Rows.Count.ToString()+"]条"; DataView dv = new DataView(dt); dv.RowFilter = "IsError=0"; if (dv.Count > 0) this.gv_List.Title += "错误信息<font color='red'>["+dv.Count+"]</font>条"; this.bnInput.Hidden = false ; dtDetail = dt; #endregion } #region public DataTable dtDetail { get { return ViewState["dtDetail"] as DataTable; } set { ViewState["dtDetail"] = value; } } BuyBillOp Manager = new BuyBillOp(); new Sale_Model.BuyBill SModel = new Sale_Model.BuyBill(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_PutInUploadList.aspx.cs
C#
asf20
10,406
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_PutInUploadList.aspx.cs" Inherits="SaleSystem.ComPage.frm_PutInUploadList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager" EnableAjax="false" /> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="false" BodyPadding="5px" ShowHeader="false"> <Rows> <ext:FormRow> <Items> <ext:ContentPanel runat="server" ID="contentPanel" BodyPadding="10px" ShowHeader="false" ShowBorder="false"> <ext:HyperLink runat="server" ID="hl_down" Text="1)单击此处下载模板" NavigateUrl="../Temp/Input.xls" Label="单击此处下载模板"></ext:HyperLink><br /> 2)选择上传路径: <asp:FileUpload runat="server" ID="bn_Excel" /> </ext:ContentPanel> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:Button runat="server" ID="bnUpload" Text="下一步" OnClick="bnUpload_Click"> </ext:Button> <ext:Button runat="server" ID="bnInput" Text="导入" ConfirmText="确定将下面的产品信息导入到此进货单中(<font color='red'>将会覆盖该进货单现有的产品明细</font>),错误的信息不会导入,确认导入?" ConfirmTitle="操作提示!" ConfirmIcon="Question" OnClick="bnInput_Click" Hidden="true"> </ext:Button> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form3" EnableBackgroundColor="false" BodyPadding="5px" ShowHeader="false"> <Rows> <ext:FormRow> <Items> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="导入的数据列表" IsDatabasePaging="true" DataKeyNames="ProductInfo" EnableRowNumber="true" AllowPaging="true" AutoHeight="true" OnPageIndexChange="gv_List_PageIndexChange"> <Columns> <ext:BoundField ColumnID="产品类别" DataField="产品类别" DataTooltipField="产品类别" HeaderText="产品类别" Width="100px" /> <ext:BoundField ColumnID="产品编码" DataField="产品编码" DataTooltipField="产品编码" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="产品名称" DataField="产品名称" DataTooltipField="产品名称" HeaderText="产品名称" Width="80px" /> <ext:BoundField ColumnID="号码" DataField="号码" DataTooltipField="号码" HeaderText="号码" Width="80px" /> <ext:BoundField ColumnID="数量" DataField="数量" DataTooltipField="数量" HeaderText="数量" Width="80px" /> <ext:BoundField ColumnID="成本价" DataField="成本价" DataTooltipField="成本价" HeaderText="成本价" Width="80px" /> <ext:BoundField ColumnID="零售价" DataField="零售价" DataTooltipField="零售价" HeaderText="零售价" Width="80px" /> <ext:CheckBoxField DataField="IsError" HeaderText="状态" Width="60px"/> <ext:BoundField ColumnID="状态" DataField="ErrorMessage" DataTooltipField="ErrorMessage" HeaderText="错误信息" Width="80px" /> </Columns> </ext:Grid> </Items> </ext:FormRow> </Rows> </ext:Form> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_PutInUploadList.aspx
ASP.NET
asf20
4,512
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; namespace SaleSystem.ComPage { public partial class frm_BillList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.Id = ValueHandler.GetIntNumberValue( Request["Id"]); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "edit") { if (Request["Type"] == "1") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_SaleBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (Request["Type"] == "2") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_BuyEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } else if (Request["Type"] == "3") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "../Business/frm_SaleBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } else if (e.CommandName.ToLower() == "ok") { if (Request["Type"] == "3") { //TreeNodeCollection nodes string strText = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); string strValue = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][0]); ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetWriteBackValueReference(strText, strValue) + ExtAspNet.ActiveWindow.GetHidePostBackReference("GetSaleBillDetail")); } } } #endregion #region Method private void GetAndBind() { //获取销售单 int iRecordCount=0; if (Request["Type"] == "1") { dtList = Manager.GetSallBillList("SBDeta_PInfo_Id="+this.Id, gv_List.PageIndex, ref iRecordCount); this.gv_List.Columns[2].HeaderText = "销售单号"; this.gv_List.Columns[3].HeaderText = "客户名称"; this.gv_List.Columns[4].HeaderText = "销售日期"; } else if (Request["Type"] == "2") { dtList = Manager.GetBuyBillList("BBDeta_PInfo_Id=" + this.Id, gv_List.PageIndex, ref iRecordCount); this.gv_List.Columns[2].HeaderText = "进货单号"; this.gv_List.Columns[3].HeaderText = "供应商"; this.gv_List.Columns[4].HeaderText = "进货日期"; } else if (Request["Type"] == "3") { dtList = Manager.GetSaleBill("", gv_List.PageIndex, ref iRecordCount); this.gv_List.Columns[2].HeaderText = "销售单号"; this.gv_List.Columns[3].HeaderText = "客户名称"; this.gv_List.Columns[4].HeaderText = "销售日期"; gv_List.Columns[5].Hidden = true; gv_List.Columns[6].Hidden = true; } this.gv_List.DataSource = dtList; this.gv_List.DataBind(); this.gv_List.RecordCount = iRecordCount; } #endregion #region Property BillListOp Manager = new BillListOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_BillList.aspx.cs
C#
asf20
4,751
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; using ExtAspNet; namespace SaleSystem.ComPage { public partial class frm_CustomerChooseList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bn_Close.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.Customer SM = new Sale_Model.Customer(); SM.Cust_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.Cust_Name = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = LinkService.CheckIsUsing("Customer", Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if (e.CommandName.ToLower() == "ok") { //TreeNodeCollection nodes string strText = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); string strValue = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][0]); PageContext.RegisterStartupScript(ActiveWindow.GetWriteBackValueReference(strText, strValue) + ActiveWindow.GetHidePostBackReference()); } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_CustomerEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { DataRowView row = e.DataItem as DataRowView; if (row != null) { if (ValueHandler.GetIntNumberValue(row["Cust_Sex"]) == 1) e.Values[3] = "男"; else e.Values[3] = "女"; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { if (tb_Cust_Code.Text.Trim() != "") { strCondition += " Cust_Code LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Cust_Name.Text.Trim() != "") { strCondition += " Cust_Name LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (ddl_Cust_BData_Id.SelectedValue != "-1") { strCondition += " Cust_BData_Id ='" + ddl_Cust_BData_Id.SelectedValue + "' AND "; } if (tb_Cust_IdentityCode.Text.Trim() != "") { strCondition += " Cust_IdentityCode LIKE '%" + ValueHandler.GetStringValue(tb_Cust_IdentityCode.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Cust_Tel1.Text.Trim() != "") { strCondition += " Cust_Tel1 LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Tel1.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Cust_Tel2.Text.Trim() != "") { strCondition += " Cust_Tel1 LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Tel2.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Email.Text.Trim() != "") { strCondition += " Email LIKE '%" + ValueHandler.GetStringValue(tb_Email.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_QQ.Text.Trim() != "") { strCondition += " QQ LIKE '%" + ValueHandler.GetStringValue(tb_QQ.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { BaseDataOp Manager = new BaseDataOp(); //客户类型 DataTable dtList1 = Manager.GetList("BData_Type=2 "); ddl_Cust_BData_Id.DataSource = dtList1; ddl_Cust_BData_Id.DataBind(); ddl_Cust_BData_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property CustomerOp Manager = new CustomerOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/ComPage/frm_CustomerChooseList.aspx.cs
C#
asf20
6,732
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ProductInfoEdit.aspx.cs" Inherits="SaleSystem.BaseData.frm_ProductInfoEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>产品编辑</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Panel runat="server" ID="plContent" Layout="Fit" ShowBorder="false" ShowHeader="false" BodyPadding="5px" EnableBackgroundColor="true" AutoHeight="true" Height="465px"> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnMore" Icon="Coins" Text="更多" > </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:SimpleForm runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Items> <ext:DropDownList runat="server" ID="ddl_PInfo_PSort_ID" Label="产品类别" Width="200px" Required="true" CompareValue="-1" CompareOperator="NotEqual" ShowRedStar="true" DataTextField="PSort_Name" DataValueField="PSort_ID" EnableSimulateTree="true" DataSimulateTreeLevelField="ilevel"> </ext:DropDownList> <ext:TextBox runat="server" ID="tb_PInfo_Code" Label="产品编码" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Name" Label="产品名称" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Number" Label="号码" Width="200px" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Pwd" Label="密码" Width="200px" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_CH" Label="串号" Width="200px" MaxLength="100"> </ext:TextBox> <ext:NumberBox runat="server" ID="tb_PInfo_Price" Label="零售价" Width="200px" MaxLength="10" DecimalPrecision="2"> </ext:NumberBox> <ext:NumberBox runat="server" ID="tb_PInfo_Cost" Label="成本价" Width="200px" MaxLength="10" DecimalPrecision="2"> </ext:NumberBox> <ext:TextArea runat="server" ID="tb_PInfo_Memo" Label="备注" MaxLength="2000"> </ext:TextArea> </Items> </ext:SimpleForm> </Items> </ext:Panel> </div> <ext:Window runat="server" ID="win_Content" IsModal="true" EnableDrag="true" EnableClose="true" Height="120px" Width="332px" Hidden="true" Layout="Column" EnableIFrame="true" Title="请输入查询密码"> <Items> <ext:Form runat="server" ID="SimpleForm2" EnableBackgroundColor="true" BodyPadding="5px" ShowHeader=false Height="80px"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Pwd" Width="200px" Label="密码"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow > <Items> <ext:ToolbarSeparator></ext:ToolbarSeparator> <ext:ToolbarSeparator></ext:ToolbarSeparator> <ext:Button runat="server" ID="tb_OK" Text="确定" OnClick="tb_OK_Click"> </ext:Button> </Items> </ext:FormRow> </Rows> </ext:Form> </Items> </ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductInfoEdit.aspx
ASP.NET
asf20
4,980
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.BaseData { public partial class frm_CustomerEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitControl(); BindDropDownList(); GetAndBind(); } } protected void bnSave_Click(object sender, EventArgs e) { SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; //SModel.Cust_BData_Id = ValueHandler.GetIntNumberValue( this.ddl_Cust_BData_Id.SelectedValue ); //SModel.Cust_Code = this.tb_Cust_Code.Text; SModel.Cust_CompanyAddress = this.tb_Cust_CompanyAddress.Text; //SModel.Cust_FamilyAddress = this.tb_Cust_FamilyAddress.Text; //SModel.Cust_Id = Id; //SModel.Cust_IdentityCode = this.tb_Cust_IdentityCode.Text; //SModel.Cust_Memo = this.tb_Cust_Memo.Text; SModel.Cust_Name = this.tb_Cust_Name.Text; //SModel.Cust_Professional = ValueHandler.GetIntNumberValue(this.ddl_Cust_Professional.SelectedValue); //SModel.Cust_Sex = ValueHandler.GetIntNumberValue( this.rbl_Cust_Sex.SelectedValue); //SModel.Cust_Tel1 = this.tb_Cust_Tel1.Text; //SModel.Cust_Tel2 = this.tb_Cust_Tel2.Text; //SModel.Email = this.tb_Email.Text; //SModel.QQ = this.tb_QQ.Text; //SModel.State = 1; bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("编码或者名称已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.Show("客户信息编辑失败!", MessageBoxIcon.Error); } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } } private void BindDropDownList() { BaseDataOp Manager = new BaseDataOp(); //客户类型 //DataTable dtList1 = Manager.GetList("BData_Type=2 "); //ddl_Cust_BData_Id.DataSource = dtList1; //ddl_Cust_BData_Id.DataBind(); //ddl_Cust_BData_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //职业 //DataTable dtList2 = Manager.GetList("BData_Type=3 "); //ddl_Cust_Professional.DataSource = dtList2; //ddl_Cust_Professional.DataBind(); //ddl_Cust_Professional.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //DataTable dtType = Manager.GetTypeList(); //ddl_BData_Type.DataSource = dtType; //ddl_BData_Type.DataBind(); //ddl_BData_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { if (Id != 0) { SModel.Cust_Id = Id; SModel = Manager.GetModel(SModel) as Customer; this.tb_Cust_Code.Text = SModel.Cust_Code; this.tb_Cust_CompanyAddress.Text = SModel.Cust_Tel1; //this.tb_Cust_FamilyAddress.Text = SModel.Cust_FamilyAddress; //this.tb_Cust_IdentityCode.Text = SModel.Cust_IdentityCode; //this.tb_Cust_Memo.Text = SModel.Cust_Memo; this.tb_Cust_Name.Text = SModel.Cust_Name; //this.tb_Cust_Tel1.Text = SModel.Cust_Tel1; //this.tb_Cust_Tel2.Text = SModel.Cust_Tel2; //this.tb_Email.Text = SModel.Email; //this.tb_QQ.Text = SModel.QQ; //this.ddl_Cust_BData_Id.SelectedValue = SModel.Cust_BData_Id.ToString(); //this.ddl_Cust_Professional.SelectedValue = SModel.Cust_Professional.ToString(); //this.rbl_Cust_Sex.SelectedValue = SModel.Cust_Sex.ToString(); } else { this.tb_Cust_Code.Text = Coder.CreateCoder(EMenuList.客户管理); } } #endregion #region Property CustomerOp Manager = new CustomerOp(); new Sale_Model.Customer SModel = new Sale_Model.Customer(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_CustomerEdit.aspx.cs
C#
asf20
5,314
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.BaseData { public partial class ProductSortEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitControl(); GetAndBind(); } } protected void bnSave_Click(object sender, EventArgs e) { SModel.PSort_Code = this.tb_PSort_Code.Text; SModel.PSort_Name = this.tb_PSort_Name.Text; SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.PSort_ID = Id; SModel.PSort_PSort_ID = ValueHandler.GetIntNumberValue(Request["PSort_PSort_ID"]); SModel.PSort_Type = 0; SModel.State = 1; bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("编码或者名称已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel); if (blRes) { ExtAspNet.Alert.Show("产品类别保存完成!", "提示!", "" + ExtAspNet.ActiveWindow.GetHidePostBackReference("refreshSort")); } else ExtAspNet.Alert.Show("产品类别编辑失败!", MessageBoxIcon.Error); } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } } private void GetAndBind() { int ipid = 0; if (Id != 0) { SModel.PSort_ID = Id; SModel = Manager.GetModelById(SModel) as ProductSort; this.tb_PSort_Code.Text = SModel.PSort_Code; this.tb_PSort_Name.Text = SModel.PSort_Name; ipid = SModel.PSort_PSort_ID; } else //获取父类Id ipid= ValueHandler.GetIntNumberValue(Request["PSort_PSort_ID"]); if (ipid == 0) { this.lb_ParentName.Text = "公司产品库"; } else { Sale_Model.ProductSort ps2 = new ProductSort(); ps2.PSort_ID = ipid; ps2 = Manager.GetModelById(ps2) as ProductSort; this.lb_ParentName.Text = ps2.PSort_Name; } } #endregion #region Property ProductSortOp Manager = new ProductSortOp(); new Sale_Model.ProductSort SModel = new Sale_Model.ProductSort(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductSortEdit.aspx.cs
C#
asf20
3,422
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_CustomerList.aspx.cs" Inherits="SaleSystem.BaseData.frm_CustomerList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>工艺美术类别管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Cust_Code" Label="编码" Width="200px" TabIndex="1"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Name" Label="职务名称" Width="200px" TabIndex="2"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="协会职务信息列表" IsDatabasePaging="true" DataKeyNames="AssociationId,AssociationName" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange"> <Columns> <ext:BoundField ColumnID="Cust_Code" DataField="AssociationId" DataTooltipField="AssociationId" HeaderText="编码" Width="100px" /> <ext:BoundField ColumnID="Cust_Name" DataField="AssociationName" DataTooltipField="AssociationName" HeaderText="名称" Width="400px"/> <ext:BoundField ColumnID="CustomerType" DataField="AssociationCost" DataTooltipField="AssociationCost" HeaderText="会费" Width="80px"/> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增客户" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="500px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_CustomerList.aspx
ASP.NET
asf20
2,788
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.BaseData { public partial class frm_BaseDataEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitControl(); BindDropDownList(); ddl_BData_InOrOut.Hidden = true; ddl_BData_InOrOut.Label = ""; GetAndBind(); } } protected void bnSave_Click(object sender, EventArgs e) { SModel.BData_Code = this.tb_BData_Code.Text; SModel.BData_Name = this.tb_BData_Name.Text; SModel.BData_Type = ValueHandler.GetIntNumberValue( this.ddl_BData_Type.SelectedValue); SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.BData_Id = Id; SModel.State = 1; SModel.BData_InOrOut = ValueHandler.GetIntNumberValue( this.ddl_BData_InOrOut.SelectedValue); bool blHasExists= Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("编码或者名称在此类别下已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel); if (blRes) { //ExtAspNet.PageContext.RegisterStartupScript("parent.__doPostBack('','"+LinkService.RefreshString+"')"); // ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow. //ExtAspNet.Alert.Show("OK","OK", ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else ExtAspNet.Alert.Show("字典编辑失败!", MessageBoxIcon.Error); } } protected void ddl_BData_Type_SelectedChange(object sender, EventArgs e) { if (ddl_BData_Type.SelectedValue == "1") ddl_BData_InOrOut.Hidden = false; else { ddl_BData_InOrOut.Hidden = true; ddl_BData_InOrOut.Label = "资金流向"; } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } } private void BindDropDownList() { DataTable dtType = Manager.GetTypeList(); ddl_BData_Type.DataSource = dtType; ddl_BData_Type.DataBind(); ddl_BData_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { if (Id != 0) { SModel.BData_Id = Id; SModel = Manager.GetModel(SModel); this.tb_BData_Code.Text = SModel.BData_Code; this.tb_BData_Name.Text = SModel.BData_Name; this.ddl_BData_Type.SelectedValue = SModel.BData_Type.ToString(); ddl_BData_InOrOut.SelectedValue = SModel.BData_InOrOut.ToString(); if (SModel.BData_Type == 1) { ddl_BData_InOrOut.Hidden = false; } else ddl_BData_InOrOut.Hidden = true; } } #endregion #region Property BaseDataOp Manager = new BaseDataOp(); new Sale_Model.BaseData SModel = new Sale_Model.BaseData(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_BaseDataEdit.aspx.cs
C#
asf20
4,401
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_BaseDataList.aspx.cs" Inherits="SaleSystem.BaseData.frm_BaseDataList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>基础数据管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click"></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:SimpleForm runat="server" ID="SimpleForm1" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Items> <ext:TextBox runat="server" ID="tb_BData_Code" Label="编码" Width="200px"></ext:TextBox> <ext:TextBox runat="server" ID="tb_BData_Name" Label="名称" Width="200px"></ext:TextBox> <ext:DropDownList runat="server" ID="ddl_BData_Type" Label="类型" Width="200px" DataValueField="Code" DataTextField="Name"></ext:DropDownList> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="基础信息列表" IsDatabasePaging="true" DataKeyNames="BData_Id,BData_Name" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" onrowdatabound="gv_List_RowDataBound"> <Columns> <ext:BoundField ColumnID="BData_Code" DataField="BData_Code" DataTooltipField="BData_Code" HeaderText="编码" Width="150px" /> <ext:BoundField ColumnID="BData_Name" DataField="BData_Name" DataTooltipField="BData_Name" HeaderText="名称" Width="200px" /> <ext:BoundField ColumnID="BData_TypeName" DataField="BData_TypeName" DataTooltipField="BData_TypeName" HeaderText="类型" Width="150px"/> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" CommandArgument="BData_Id" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增数据字典" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="250px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_BaseDataList.aspx
ASP.NET
asf20
2,906
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.BaseData { public partial class frm_SupplierList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_SupplierEdit.aspx?Id=0", "新增供应商"); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.Supplier SM = new Sale_Model.Supplier(); SM.Supp_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.Supp_Name = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = LinkService.CheckIsUsing("Supplier", Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_SupplierEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { if (tb_Supp_Code.Text.Trim() != "") { strCondition += " Supp_Code LIKE '%" + ValueHandler.GetStringValue(tb_Supp_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Supp_Name.Text.Trim() != "") { strCondition += " Supp_Name LIKE '%" + ValueHandler.GetStringValue(tb_Supp_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Supp_LinkMan1.Text.Trim() != "") { strCondition += " Supp_LinkMan1 LIKE '%" + ValueHandler.GetStringValue(tb_Supp_LinkMan1.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Supp_Tel1.Text.Trim() != "") { strCondition += " Supp_Tel1 LIKE '%" + ValueHandler.GetStringValue(tb_Supp_Tel1.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Supp_LinkMan2.Text.Trim() != "") { strCondition += " Supp_LinkMan2 LIKE '%" + ValueHandler.GetStringValue(tb_Supp_LinkMan2.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_Supp_Tel2.Text.Trim() != "") { strCondition += " Supp_Tel2 LIKE '%" + ValueHandler.GetStringValue(tb_Supp_Tel2.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } #endregion #region Property SupplierOp Manager = new SupplierOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_SupplierList.aspx.cs
C#
asf20
5,039
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.BaseData { public partial class frm_ProductInfoEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitControl(); BindDropDownList(); GetAndBind(); } } protected void bnSave_Click(object sender, EventArgs e) { SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.PInfo_CH = this.tb_PInfo_CH.Text; SModel.PInfo_Code = this.tb_PInfo_Code.Text; SModel.PInfo_Cost = ValueHandler.GetDecNumberValue( this.tb_PInfo_Cost.Text); SModel.PInfo_Memo = this.tb_PInfo_Memo.Text; SModel.PInfo_Name = this.tb_PInfo_Name.Text; SModel.PInfo_Number = this.tb_PInfo_Number.Text; SModel.PInfo_Price = ValueHandler.GetDecNumberValue( this.tb_PInfo_Price.Text); SModel.PInfo_PSort_ID = ValueHandler.GetIntNumberValue(this.ddl_PInfo_PSort_ID.SelectedValue); SModel.PInfo_Pwd = this.tb_PInfo_Pwd.Text; SModel.PInfo_Id = Id; bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("编码或者名称已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.Show("产品信息编辑失败!", MessageBoxIcon.Error); } } protected void tb_OK_Click(object sender, EventArgs e) { if (tb_Pwd.Text.Trim() == LinkService.GetCurrentUser().SUser_Pwd) { tb_PInfo_Cost.Hidden = false; win_Content.Hidden = true; tb_Pwd.Text = ""; } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } tb_PInfo_Cost.Hidden = true; bnMore.OnClientClick = win_Content.GetShowReference(); } private void BindDropDownList() { ProductSortOp SortManager = new ProductSortOp(); dtList = SortManager.GetList(""); dtList.Columns.Add(new DataColumn("ilevel", typeof(System.Int32))); DataTable dtRes=dtList.Clone(); ConstructLevel(dtRes, 0,0); ddl_PInfo_PSort_ID.DataSource = dtRes; ddl_PInfo_PSort_ID.DataBind(); // ddl_PInfo_PSort_ID.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void ConstructLevel(DataTable dtRes, int id, int ilevel) { DataView dv = new DataView(dtList); dv.RowFilter = "PSort_PSort_ID="+id.ToString(); if(dv.Count>0) ilevel++; for (int i = 0; i < dv.Count; i++) { dv[i]["ilevel"] = ilevel; dtRes.ImportRow(dv[i].Row); ConstructLevel(dtRes, ValueHandler.GetIntNumberValue(dv[i]["PSort_ID"]), ilevel); } } private void GetAndBind() { if (Id != 0) { SModel.PInfo_Id = Id; SModel = Manager.GetModel(SModel) as ProductInfo; this.tb_PInfo_CH.Text = SModel.PInfo_CH; this.tb_PInfo_Code.Text = SModel.PInfo_Code; this.tb_PInfo_Cost.Text = SModel.PInfo_Cost.ToString(); this.tb_PInfo_Memo.Text = SModel.PInfo_Memo; this.tb_PInfo_Name.Text = SModel.PInfo_Name; this.tb_PInfo_Number.Text = SModel.PInfo_Number; this.tb_PInfo_Price.Text = SModel.PInfo_Price.ToString(); this.tb_PInfo_Pwd.Text = SModel.PInfo_Pwd; this.ddl_PInfo_PSort_ID.SelectedValue = SModel.PInfo_PSort_ID.ToString(); } else { this.tb_PInfo_Code.Text = Coder.CreateCoder(EMenuList.产品管理); } } #endregion #region Property ProductInfoOp Manager = new ProductInfoOp(); new Sale_Model.ProductInfo SModel = new Sale_Model.ProductInfo(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductInfoEdit.aspx.cs
C#
asf20
5,332
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.BaseData { public partial class frm_SupplierEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { InitControl(); GetAndBind(); } } protected void bnSave_Click(object sender, EventArgs e) { SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.Supp_Code = this.tb_Supp_Code.Text; SModel.Supp_Id = Id; SModel.Supp_LinkMan1 = this.tb_Supp_LinkMan1.Text; SModel.Supp_LinkMan2 = this.tb_Supp_LinkMan2.Text; SModel.Supp_Memo = this.tb_Supp_Memo.Text; SModel.Supp_Name = this.tb_Supp_Name.Text; SModel.Supp_Tel1 = this.tb_Supp_Tel1.Text; SModel.Supp_Tel2 = this.tb_Supp_Tel2.Text; bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("编码或者名称已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.Show("客户信息编辑失败!", MessageBoxIcon.Error); } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } } private void GetAndBind() { if (Id != 0) { SModel.Supp_Id = Id; SModel = Manager.GetModel(SModel) as Supplier; this.tb_Supp_Code.Text = SModel.Supp_Code; this.tb_Supp_LinkMan1.Text = SModel.Supp_LinkMan1; this.tb_Supp_LinkMan2.Text = SModel.Supp_LinkMan2; this.tb_Supp_Memo.Text = SModel.Supp_Memo; this.tb_Supp_Name.Text = SModel.Supp_Name; this.tb_Supp_Tel1.Text = SModel.Supp_Tel1; this.tb_Supp_Tel2.Text = SModel.Supp_Tel2; } else { this.tb_Supp_Code.Text = Coder.CreateCoder(EMenuList.供应商管理); } } #endregion #region Property SupplierOp Manager = new SupplierOp(); new Sale_Model.Supplier SModel = new Sale_Model.Supplier(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_SupplierEdit.aspx.cs
C#
asf20
3,366
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Text; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.BaseData { public partial class frm_ProductInfoList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { this.bn_AddProduct.OnClientClick = win_Content2.GetShowReference("frm_ProductInfoEdit.aspx?Id=0","新增产品"); this.bn_DeleteProduct.OnClientClick = gv_List.GetNoSelectionAlertInParentReference("您至少选择一项产品才能删除!"); BindSort(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } else if (Request[LinkService.RefreshTag] == "refreshSort") { BindSort(); } } protected void tv_Menu_NodeCommand(object sender, ExtAspNet.TreeCommandEventArgs e) { ExtAspNet.Alert.Show("OK"); } protected void tv_Menu_NodeCheck(object sender, ExtAspNet.TreeCheckEventArgs e) { } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.ProductInfo SM = new Sale_Model.ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.PInfo_Name = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = LinkService.CheckIsUsing("ProductInfo", SM.PInfo_Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if (e.CommandName.ToLower() == "edit") { win_Content2.Hidden = false; win_Content2.IFrameUrl = "frm_ProductInfoEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content2.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void bn_DeleteProductClick(object sender, EventArgs e) { int[] indexs= gv_List.SelectedRowIndexArray; StringBuilder sbNodelete = new StringBuilder(); StringBuilder sbDelete = new StringBuilder(); int iDelteCount = 0; for (int i = 0; i < indexs.Length; i++) { Sale_Model.ProductInfo SM = new Sale_Model.ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[indexs[i]][0]); SM.PInfo_Name = ValueHandler.GetStringValue(gv_List.DataKeys[indexs[i]][1]); bool blIsUsing = LinkService.CheckIsUsing("ProductInfo", SM.PInfo_Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { sbDelete.Append(SM.PInfo_Name + ","); iDelteCount++; } } else { sbNodelete.Append(SM.PInfo_Name + ","); } } if (sbDelete.Length > 0) GetAndBind(); if (sbNodelete.Length > 0) { ExtAspNet.Alert.ShowInTop("已经删除的产品信息为:" + sbDelete.ToString() + "!<br>" + "正在使用无法删除的为:" + sbNodelete.ToString() + "!"); } else { ExtAspNet.Alert.ShowInTop("已经删除<font color='red'>(" + iDelteCount.ToString() + ")</font>个产品!"); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { } protected void bn_ReloadClick(object sender, EventArgs e) { BindSort(); } protected void bn_ReloadProductClick(object sender, EventArgs e) { GetAndBind() ; } protected void bn_AddClick(object sender, EventArgs e) { if(tv_Menu.SelectedNodeIDArray.Length>0) { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_ProductSortEdit.aspx?PSort_PSort_ID=" + tv_Menu.SelectedNodeIDArray[0] ; } else { ExtAspNet.Alert.Show("请选择某个产品大类后再做此操作!", ExtAspNet.MessageBoxIcon.Warning); } } protected void bn_EditClick(object sender, EventArgs e) { if (tv_Menu.SelectedNodeIDArray.Length > 0) { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_ProductSortEdit.aspx?Id=" + tv_Menu.SelectedNodeIDArray[0]; ExtAspNet.TreeNode tn = tv_Menu.FindNode(tv_Menu.SelectedNodeIDArray[0]); win_Content.Title = "编辑产品类别"; } } protected void bn_DeleteClick(object sender, EventArgs e) { if (tv_Menu.SelectedNodeIDArray.Length <= 0) { ExtAspNet.Alert.ShowInTop("请选择您要删除的类别!", ExtAspNet.MessageBoxIcon.Information); } else { Sale_Model.ProductSort SM = new Sale_Model.ProductSort(); SM.PSort_ID = ValueHandler.GetIntNumberValue(tv_Menu.SelectedNodeIDArray[0]); SM = SortManager.GetModel(SM) as ProductSort; if (SM.PSort_Type == 1) { ExtAspNet.Alert.ShowInTop("此类别为系统初始化类别,无法删除!", ExtAspNet.MessageBoxIcon.Warning); } else { bool blIsUsing = LinkService.CheckIsUsing("ProductSort", SM.PSort_ID.ToString()); if (!blIsUsing) { bool blDelete = SortManager.Delete(SM); if (blDelete) { BindSort(); ExtAspNet.Alert.ShowInTop("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.ShowInTop("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.ShowInTop("该类别下有子类或者产品,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } private void BindSort() { tv_Menu.Nodes.Clear(); DataTable dtSort = SortManager.GetList(""); ExtAspNet.TreeNode tn = new ExtAspNet.TreeNode(); tn.NodeID = "0"; tn.Text = "<a href='#' onclick=\"__doPostBack('','" + LinkService.RefreshString + "');\">公司产品库</a>"; tv_Menu.Nodes.Add(tn); BindTree(dtSort, tn.Nodes, 0); tv_Menu.Nodes[0].Expanded = true; //设置类别是否leaf SetLeaf(tv_Menu.Nodes); } private void SetLeaf(ExtAspNet.TreeNodeCollection tns) { for (int i = 0; i < tns.Count; i++) { if (tns[i].Nodes.Count > 0) { tns[i].Leaf = false; SetLeaf(tns[i].Nodes); } else { tns[i].Leaf = true; } } } private void BindTree(DataTable dt, ExtAspNet.TreeNodeCollection tns, int id) { DataView dv = new DataView(dt); dv.RowFilter = "PSort_PSort_ID="+id; for (int i = 0; i < dv.Count; i++) { ExtAspNet.TreeNode tn = new ExtAspNet.TreeNode(); tn.NodeID = ValueHandler.GetStringValue(dv[i]["PSort_ID"]); tn.Text = "<a href='#' onclick=\"__doPostBack('','"+LinkService.RefreshString+"');\">" + ValueHandler.GetStringValue(dv[i]["PSort_Name"]) + "</a>"; tn.EnablePostBack = false; tn.Expanded = true; tns.Add(tn); tn.Icon = ExtAspNet.Icon.Folder; BindTree(dt,tn.Nodes,ValueHandler.GetIntNumberValue(dv[i]["PSort_ID"])); } } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { if (tb_PInfo_CH.Text.Trim() != "") { strCondition += " PInfo_CH LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_CH.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Code.Text.Trim() != "") { strCondition += " PInfo_Code LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if(tb_PInfo_Name.Text.Trim() != "") { strCondition += " PInfo_Name LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Number.Text.Trim() != "") { strCondition += " PInfo_Number LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Number.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_PInfo_Pwd.Text.Trim() != "") { strCondition += " PInfo_Pwd LIKE '%" + ValueHandler.GetStringValue(tb_PInfo_Pwd.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } //通过选中的节点,获取产品大类信息 if (this.tv_Menu.SelectedNodeIDArray.Length > 0) { string pid = this.tv_Menu.SelectedNodeIDArray[0]; ExtAspNet.TreeNode tn= tv_Menu.FindNode(pid); string ids = "(" + pid + ","; GetSubIds(tn.Nodes, ref ids); ids = ids.Substring(0, ids.Length - 1) + ") "; strCondition += "PInfo_PSort_ID in " + ids + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void GetSubIds(ExtAspNet.TreeNodeCollection tns, ref string ids) { for (int i = 0; i < tns.Count; i++) { ids += tns[i].NodeID + ","; if (tns[i].Nodes.Count > 0) GetSubIds(tns[i].Nodes, ref ids); } } #endregion #region Property ProductSortOp SortManager = new ProductSortOp(); ProductInfoOp Manager = new ProductInfoOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductInfoList.aspx.cs
C#
asf20
12,920
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ProductSortEdit.aspx.cs" Inherits="SaleSystem.BaseData.ProductSortEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>类别编辑</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Panel runat="server" ID="plContent" Layout="Fit" ShowBorder="false" ShowHeader="false" BodyPadding="5px" EnableBackgroundColor="true" AutoHeight="true" Height="210px"> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:SimpleForm runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Items> <ext:Label runat="server" ID="lb_ParentName" Label="父级别" Text="ok"></ext:Label> <ext:TextBox runat="server" ID="tb_PSort_Code" Label="类别编码" Width="200px" Required="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_PSort_Name" Label="类别名称" Width="200px" Required="true" MaxLength="100"></ext:TextBox> </Items> </ext:SimpleForm> </Items> </ext:Panel> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductSortEdit.aspx
ASP.NET
asf20
1,997
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ProductInfoList.aspx.cs" Inherits="SaleSystem.BaseData.frm_ProductInfoList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <ext:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" runat="server"> </ext:PageManager> <ext:Panel ID="Panel1" runat="server" BodyPadding="5px" EnableBackgroundColor="true" Layout="Column" ShowBorder="false" ShowHeader="false" Title="Panel"> <Items> <ext:Panel runat="server" ID="PanelLeft" Width="250px" ShowBorder="false" ShowHeader="false"> <Items> <ext:Tree ID="tv_Menu" OnNodeCommand="tv_Menu_NodeCommand" OnNodeCheck="tv_Menu_NodeCheck" Width="250px" ShowHeader="false" Title="Tree(Inline)" runat="server" Expanded="true" AutoHeight="true" Height="700px"> <Toolbars> <ext:Toolbar runat="server"> <Items> <ext:Button runat="server" ID="bn_Reload" Icon="Reload" OnClick="bn_ReloadClick" Text="刷新"> </ext:Button> <ext:Button runat="server" ID="bn_AddSort" Icon="FolderAdd" Text="新增" OnClick="bn_AddClick"> </ext:Button> <ext:Button runat="server" ID="bn_EditSort" Icon="FolderEdit" Text="编辑" OnClick="bn_EditClick"> </ext:Button> <ext:Button runat="server" ID="bn_Delete" Icon="FolderDelete" Text="删除" OnClick="bn_DeleteClick" ConfirmIcon="Question" ConfirmTarget="Top" ConfirmText="确认删除您选择的产品类别?" ConfirmTitle="删除确认"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> </ext:Tree> </Items> </ext:Panel> <ext:Panel runat="server" ID="PanelMain" ShowHeader="false" ShowBorder="true" AutoScroll="true" Width="800px" AutoWidth="true" AutoHeight="true"> <Toolbars> <ext:Toolbar runat="server"> <Items> <ext:Button runat="server" ID="bn_ReloadProduct" Icon="FolderFind" Type="Submit" OnClick="bn_ReloadProductClick" Text="查询"> </ext:Button> <ext:Button runat="server" ID="bn_AddProduct" Icon="Add" Text="新增"> </ext:Button> <ext:Button runat="server" ID="bn_DeleteProduct" Icon="Delete" Text="删除" OnClick="bn_DeleteProductClick" ConfirmIcon="Question" ConfirmTarget="Top" ConfirmText="确认删除您选择的产品信息?" ConfirmTitle="删除确认"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:Form runat="server" ID="SimpleForm1" EnableBackgroundColor="true" ShowBorder="false" ShowHeader="false" BodyPadding="5px" AutoHeight="true"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_Code" Label="产品编码" Width="150px" MaxLength="100" TabIndex="1"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Name" Label="产品名称" Width="150px" MaxLength="100" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_Number" Label="号码" Width="150px" MaxLength="100" TabIndex="3"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_PInfo_Pwd" Label="密码" Width="150px" MaxLength="100" TabIndex="4"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_PInfo_CH" Label="串号" Width="150px" MaxLength="100" TabIndex="5"> </ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="产品信息列表" IsDatabasePaging="true" DataKeyNames="PInfo_Id,PInfo_Name" EnableRowNumber="true" EnableCheckBoxSelect="true" OnRowCommand="gv_List_RowCommand" AllowPaging="true" OnPageIndexChange="gv_List_PageIndexChange" OnRowDataBound="gv_List_RowDataBound"> <Columns> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类别" Width="80px" /> <ext:BoundField ColumnID="PInfo_Number" DataField="PInfo_Number" DataTooltipField="PInfo_Number" HeaderText="号码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Pwd" DataField="PInfo_Pwd" DataTooltipField="PInfo_Pwd" HeaderText="密码" Width="60px" /> <ext:BoundField ColumnID="PInfo_CH" DataField="PInfo_CH" DataTooltipField="PInfo_CH" HeaderText="串号" Width="80px" /> <ext:BoundField ColumnID="PInfo_Price" DataField="PInfo_Price" DataTooltipField="PInfo_Price" HeaderText="零售价" Width="70px" /> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> </Items> </ext:Panel> </Items> </ext:Panel> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增产品类别" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="500px" Height="250px"> </ext:Window> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增产品" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="500px"> </ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_ProductInfoList.aspx
ASP.NET
asf20
8,240
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SupplierEdit.aspx.cs" Inherits="SaleSystem.BaseData.frm_SupplierEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Panel runat="server" ID="plContent" Layout="Fit" ShowBorder="false" ShowHeader="false" BodyPadding="5px" EnableBackgroundColor="true" AutoHeight="true" Height="465px"> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:SimpleForm runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Items> <ext:TextBox runat="server" ID="tb_Supp_Code" Label="供应商编码" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Name" Label="供应商名称" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_LinkMan1" Label="联系人1" Width="200px" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Tel1" Label="手机1" Width="200px" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_LinkMan2" Label="联系人2" Width="200px" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Tel2" Label="手机2" Width="200px" MaxLength="100"></ext:TextBox> <ext:TextArea runat="server" ID="tb_Supp_Memo" Label="备注" MaxLength="2000"></ext:TextArea> </Items> </ext:SimpleForm> </Items> </ext:Panel> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_SupplierEdit.aspx
ASP.NET
asf20
2,639
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.BaseData { public partial class frm_CustomerList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_CustomerEdit.aspx?Id=0", "新增客户"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.Customer SM = new Sale_Model.Customer(); SM.Cust_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.Cust_Name = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = LinkService.CheckIsUsing("Assciation_Info", Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_CustomerEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { DataRowView row = e.DataItem as DataRowView; if (row != null) { if (ValueHandler.GetIntNumberValue(row["Cust_Sex"]) == 1) e.Values[3] = "男"; else e.Values[3] = "女"; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { if (tb_Cust_Code.Text.Trim() != "") { strCondition += " AssociationId = " + ValueHandler.GetIntNumberValue(tb_Cust_Code.Text) + "AND "; } if (tb_Cust_Name.Text.Trim() != "") { strCondition += " AssociationName LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } // if (ddl_Cust_BData_Id.SelectedValue != "-1") //{ // strCondition += " Cust_BData_Id ='" + ddl_Cust_BData_Id.SelectedValue + "' AND "; // } //if (tb_Cust_IdentityCode.Text.Trim() != "") //{ // strCondition += " Cust_IdentityCode LIKE '%" + ValueHandler.GetStringValue(tb_Cust_IdentityCode.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; // } //if (tb_Cust_Tel1.Text.Trim() != "") //{ // strCondition += " Cust_Tel1 LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Tel1.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; // } //if (tb_Cust_Tel2.Text.Trim() != "") //{ // strCondition += " Cust_Tel1 LIKE '%" + ValueHandler.GetStringValue(tb_Cust_Tel2.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; // } //if (tb_Email.Text.Trim() != "") //{ // strCondition += " Email LIKE '%" + ValueHandler.GetStringValue(tb_Email.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; //} // if (tb_QQ.Text.Trim() != "") //{ // strCondition += " QQ LIKE '%" + ValueHandler.GetStringValue(tb_QQ.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; // } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { BaseDataOp Manager = new BaseDataOp(); //客户类型 //DataTable dtList1 = Manager.GetList("BData_Type=2 "); //ddl_Cust_BData_Id.DataSource = dtList1; //ddl_Cust_BData_Id.DataBind(); //ddl_Cust_BData_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property CustomerOp Manager = new CustomerOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_CustomerList.aspx.cs
C#
asf20
6,307
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SupplierList.aspx.cs" Inherits="SaleSystem.BaseData.frm_SupplierList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>供应商管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Supp_Code" Label="供应商编码" Width="200px" TabIndex="1"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Name" Label="供应商名称" Width="200px" TabIndex="2"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Supp_LinkMan1" Label="联系人1" Width="200px" TabIndex="3"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Tel1" Label="手机1" Width="200px" TabIndex="4"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Supp_LinkMan2" Label="联系人2" Width="200px" TabIndex="5"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Supp_Tel2" Label="手机2" Width="200px" TabIndex="6"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="供应商信息列表" IsDatabasePaging="true" DataKeyNames="Supp_Id,Supp_Name" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" > <Columns> <ext:BoundField ColumnID="Supp_Code" DataField="Supp_Code" DataTooltipField="Supp_Code" HeaderText="供应商编码" Width="100px" /> <ext:BoundField ColumnID="Supp_Name" DataField="Supp_Name" DataTooltipField="Supp_Name" HeaderText="供应商名称" Width="150px"/> <ext:BoundField ColumnID="Supp_LinkMan1" DataField="Supp_LinkMan1" DataTooltipField="Supp_LinkMan1" HeaderText="联系人1" Width="80px"/> <ext:BoundField ColumnID="Supp_Tel1" DataField="Supp_Tel1" DataTooltipField="Supp_Tel1" HeaderText="手机1" Width="80px"/> <ext:BoundField ColumnID="Supp_LinkMan2" DataField="Supp_LinkMan2" DataTooltipField="Supp_LinkMan2" HeaderText="联系人2" Width="80px"/> <ext:BoundField ColumnID="Supp_Tel2" DataField="Supp_Tel2" DataTooltipField="Supp_Tel2" HeaderText="手机2" Width="80px"/> <ext:BoundField ColumnID="Supp_Memo" DataField="Supp_Memo" DataTooltipField="Supp_Memo" HeaderText="备注" Width="80px"/> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增供应商" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="500px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_SupplierList.aspx
ASP.NET
asf20
4,073
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_BaseDataEdit.aspx.cs" Inherits="SaleSystem.BaseData.frm_BaseDataEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Panel runat="server" ID="plContent" Layout="Fit" ShowBorder="false" ShowHeader="false" BodyPadding="5px" EnableBackgroundColor="true" AutoHeight="true" Height="210px"> <Toolbars> <ext:Toolbar runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:SimpleForm runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Items> <ext:DropDownList runat="server" ID="ddl_BData_Type" Label="类型" Width="200px" DataValueField="Code" DataTextField="Name" Required="true" CompareValue="-1" CompareOperator="NotEqual" OnSelectedIndexChanged="ddl_BData_Type_SelectedChange" AutoPostBack="true" HideMode="Display"></ext:DropDownList> <ext:TextBox runat="server" ID="tb_BData_Code" Label="编码" Width="200px" Required="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_BData_Name" Label="名称" Width="200px" Required="true" MaxLength="100"></ext:TextBox> <ext:DropDownList runat="server" ID="ddl_BData_InOrOut" Width="200px" Label="资金流向" > <ext:ListItem Text="支出" Value="1" Selected="true" /> <ext:ListItem Text="收入" Value="2" /> </ext:DropDownList> </Items> </ext:SimpleForm> </Items> </ext:Panel> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_BaseDataEdit.aspx
ASP.NET
asf20
2,487
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.BaseData { public partial class frm_BaseDataList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_BaseDataEdit.aspx?Id=0", "新增字典信息"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.BaseData SM = new Sale_Model.BaseData(); SM.BData_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.BData_Name = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = LinkService.CheckIsUsing("BaseData1", Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if(e.CommandName.ToLower()=="edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_BaseDataEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } #endregion #region Method private void BindDropDownList() { DataTable dtType= Manager.GetTypeList(); ddl_BData_Type.DataSource = dtType; ddl_BData_Type.DataBind(); ddl_BData_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition,gv_List.PageIndex+1,ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (tb_BData_Code.Text.Trim() != "") { strCondition += " BData_Code LIKE '%" + ValueHandler.GetStringValue(tb_BData_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_BData_Name.Text.Trim() != "") { strCondition += " BData_Name LIKE '%" + ValueHandler.GetStringValue(tb_BData_Name.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (ddl_BData_Type.SelectedValue != "-1") { strCondition += " BData_Type ='" + ddl_BData_Type.SelectedValue + "' AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } #endregion #region Property BaseDataOp Manager = new BaseDataOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_BaseDataList.aspx.cs
C#
asf20
4,778
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_CustomerEdit.aspx.cs" Inherits="SaleSystem.BaseData.frm_CustomerEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Panel runat="server" ID="plContent" Layout="Fit" ShowBorder="false" ShowHeader="false" BodyPadding="5px" EnableBackgroundColor="true" AutoHeight="true" Height="465px"> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:SimpleForm runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Items> <ext:TextBox runat="server" ID="tb_Cust_Code" Label="编码" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Name" Label="名称" Width="200px" Required="true" ShowRedStar="true" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_CompanyAddress" Label="公司地址" MaxLength="100"></ext:TextBox> </Items> </ext:SimpleForm> </Items> </ext:Panel> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/BaseData/frm_CustomerEdit.aspx
ASP.NET
asf20
2,126
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="main.aspx.cs" Inherits="SaleSystem.main" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> <link href="css/default.css" rel="stylesheet" type="text/css" /> </head> <body> <form id="form1" runat="server"> <ext:PageManager ID="PageManager1" AutoSizePanelID="RegionPanel1" runat="server"> </ext:PageManager> <ext:RegionPanel ID="RegionPanel1" ShowBorder="false" runat="server"> <Regions> <ext:Region ID="Region1" Margins="0 0 0 0" Height="62px" ShowBorder="false" ShowHeader="false" Position="Top" Layout="Fit" runat="server"> <Toolbars> <ext:Toolbar ID="Toolbar1" Position="Bottom" runat="server"> <Items> <ext:ToolbarText ID="tb_UserName" Text="&nbsp;欢迎您:登陆系统!" runat="server"> </ext:ToolbarText> <ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill> <%-- <ext:DropDownList ID="ddlTheme" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="ddlTheme_SelectedIndexChanged" runat="server"> <ext:ListItem Text="Blue" Selected="true" Value="blue" /> <ext:ListItem Text="Gray" Value="gray" /> <ext:ListItem Text="Access" Value="access" /> </ext:DropDownList>--%> <ext:ToolbarText ID="ToolbarText2" Text="&nbsp;" runat="server"> </ext:ToolbarText> <ext:Button runat="server" ID="bnWorkFlow" ToolTip="日程" Icon="Date" OnClientClick="addTab('dynamic_added_tab20','./Other/frm_WorkPlanList.aspx','其他工具 -> 日程安排');return false;"></ext:Button> <ext:Button runat="server" ID="Button1" ToolTip="利润分析" Icon="ChartLine" OnClientClick="addTab('dynamic_added_tab23','./Analysis/frm_ProfitList.aspx','统计分析 -> 利润分析');return false;"></ext:Button> <ext:Button runat="server" ID="bnStyle" Icon="Paint" ToolTip="风格切换" ></ext:Button> <ext:Button ID="Button2" runat="server" Icon="Calendar" ToolTip="万年历" EnablePostBack="false" OnClientClick="addTab('calendar', './Other/wannianli.htm', '万年历')"> </ext:Button> <ext:Button ID="Button3" runat="server" Icon="Calculator" ToolTip="科学计算器" EnablePostBack="false" OnClientClick="addTab('jisuanqi', './Other/jisuanqi.htm', '科学计算器')"></ext:Button> <ext:ToolbarSeparator ID="ToolbarSeparator1" runat="server"> </ext:ToolbarSeparator> <ext:Button runat="server" ID="bnExit" Text="退出" OnClick="bnExitClick"></ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:ContentPanel ShowBorder="false" ShowHeader="false" BodyStyle="background-color:#1C3E7E;" ID="ContentPanel1" runat="server"> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td> <div class="header"> <a href="#" style="color:#fff;"><asp:Label ID="lbSystemInfo" runat="server"></asp:Label></a> </div> </td> <td style="text-align:right;color:#ccc;"><a href="mailto:CopyRight WUJING0209@163.com" style="color:#ccc;">CopyRight WUJING Mail: WUJING0209@163.com&nbsp;</a> </td> </tr> </table> </ext:ContentPanel> </Items> </ext:Region> <ext:Region ID="Region2" Split="true" Width="200px" Margins="0 0 0 0" ShowHeader="true" Title="系统菜单" EnableCollapse="true" Layout="Fit" Position="Left" runat="server"> <Items> <ext:Tree runat="server" ID="tv_Menu" EnableBackgroundColor="true" ShowHeader="false" > </ext:Tree> </Items> </ext:Region> <ext:Region ID="Region3" ShowHeader="false" EnableIFrame="true" Layout="Fit" IFrameName="main" Margins="0 0 0 0" Position="Center" runat="server"> <Items> <ext:TabStrip ID="mainTabStrip" EnableTabCloseMenu="true" ShowBorder="false" runat="server"> <Tabs> <ext:Tab ID="tab_Home" Title="Home" Layout="Fit" Icon="House" runat="server" EnableIFrame="true" IFrameUrl="about:blank" > </ext:Tab> </Tabs> </ext:TabStrip> </Items> </ext:Region> </Regions> </ext:RegionPanel> <ext:Window runat="server" ID="WorkForm" IsModal="false" EnableDrag="false" EnableClose="true" Height="172px" Width="332px" Hidden="true" Layout="Absolute" IFrameUrl="./Other/frm_WorkPlanDetailList.aspx" EnableIFrame="true" Icon="Email" > </ext:Window> <ext:Window runat="server" ID="win_Content" IsModal="true" EnableDrag="true" EnableClose="true" Height="152px" Width="332px" Hidden="true" Layout="Absolute" IFrameUrl="" EnableIFrame="true" > </ext:Window> </form> <script type="text/javascript"> function onReady() { var treeMenu = Ext.getCmp('<%= tv_Menu.ClientID %>'); function addExampleTab(node) { var href = node.attributes.href; var refreshButton = new Ext.Button({ text: 'Refresh', type: "button", cls: "x-btn-text-icon", icon: '<%= IconHelper.GetIconUrl(Icon.Reload) %>', listeners: { click: function(button, e) { // Note: button.ownerCt is toolbar, button.ownerCt.ownerCt is current active tab. Ext.DomQuery.selectNode('iframe', button.ownerCt.ownerCt.getEl().dom).contentWindow.location.replace(href); e.stopEvent(); } } }); // Add a dynamic tab (With toolbar). var mainTabStrip = Ext.getCmp('<%= mainTabStrip.ClientID %>'); var tabID = 'dynamic_added_tab' + node.id.replace('__', '-'); mainTabStrip.addTab({ 'id': tabID, 'url': href, 'title': node.parentNode.text + ' -> ' + node.text, 'closable': true, 'bodyStyle': 'padding:0px;' }); } // Click the tree node. treeMenu.on('click', function(node, event) { if (node.isLeaf()) { var href = node.attributes.href; // Modify the location of current url. window.location.href = '#' + href; addExampleTab(node); // Don't response to this tree node's default behavior. event.stopEvent(); } }); (function pageFirstLoad() { var currentHash = window.location.hash.substr(1); var level1Nodes = treeMenu.getRootNode().childNodes; for (var i = 0; i < level1Nodes.length; i++) { var level2Nodes = level1Nodes[i].childNodes; for (var j = 0; j < level2Nodes.length; j++) { var currentNode = level2Nodes[j]; if (currentNode.attributes.href === currentHash) { level1Nodes[i].expand(); // We must retrieve this node again, because currentNode doesn't has parentNode property. var foundNode = treeMenu.getNodeById(currentNode.id); foundNode.select(); addExampleTab(foundNode); return; } } } })(); } function GetPosition() { var wform = Ext.getCmp('<%= WorkForm.ClientID %>'); wform.x = Ext.getBody().getWidth() - 332; wform.y = Ext.getBody().getHeight() - 172; wform.show(); } function addTab(id, url, title) { // Add a dynamic tab. var mainTabStrip = Ext.getCmp('<%= mainTabStrip.ClientID %>'); var tabID = id; mainTabStrip.addTab(tabID, url, title, true); } </script> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/main.aspx
ASP.NET
asf20
9,799
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ClientBackBillEdit.aspx.cs" Inherits="SaleSystem.Business.frm_ClientBackBillEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <%-- <ext:Button runat="server" ID="bnImport" Icon="TableEdit" Text="导入" > </ext:Button>--%> <ext:Button runat="server" ID="bnInput" Text="入库" Icon="PackageIn" ConfirmIcon="Warning" ConfirmText="进货单入库后,则不能修改,请确认保存数据再入库,确认入库?" ConfirmTitle="入库确认" OnClick="bnInput_Click"></ext:Button> <ext:Button runat="server" ID="bn_Total" Icon="Coins" Text="结算" OnClick="bn_Total_Click" ConfirmText="结算后,此单据不能修改,确认结算?" ConfirmTitle="操作提示!"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </toolbars> <ext:Form runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_CBB_Code" Label="退货单号" Width="200px" Required="true" TabIndex="1" ShowRedStar="true" MaxLength="100"> </ext:TextBox> <ext:TriggerBox Width="200px" EnablePostBack="false" runat="server" EnableEdit="false" TabIndex="2" ID="tb_SBill_Code" Label="销售单" TriggerIcon="Search" Required="true" ></ext:TriggerBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DatePicker runat="server" ID="tb_CBB_Date" Label="退货日期" Width="200px" Required="true" TabIndex="3" ShowRedStar="true"> </ext:DatePicker> <ext:DropDownList runat="server" ID="ddl_CBB_SUser_Id" Label="经办人" Width="200px" TabIndex="4" DataValueField="SUser_Id" DataTextField="SUser_Name" Required="true" ShowRedStar="true" CompareValue="-1" CompareOperator="NotEqual"> </ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Code2" Label="出库单号" Width="200px" > </ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Name" Label="客户名称" Width="200px" > </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:Label runat="server" ID="tb_CBB_Input" Label="入库状态" Width="200px" EncodeText="false"> </ext:Label> <ext:Label runat="server" ID="tb_CBB_State" Label="结算状态" Width="200px" EncodeText="false"> </ext:Label> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form2" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" EnableCollapse="true" ShowBorder="true" ShowHeader="true" BodyPadding="5px" Title="更多信息"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_RealMoney" Label="实收金额" Enabled="false" Width="200px" MaxLength="100"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_CBB_Money" Label="退货金额" Width="200px" TabIndex="5" MaxLength="100"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_CBB_PayType" Label="结算方式" Width="200px" TabIndex="6" DataValueField="Id" DataTextField="Name" OnSelectedIndexChanged="ddl_SBill_PayTypeSelectedChanged" AutoPostBack="true"> </ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_CBB_AList_Id" Label="结算帐户" Width="200px" TabIndex="7" DataValueField="AList_Id" DataTextField="AccountInfo"> </ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_CBB_Reason" Label="退货原因" MaxLength="200" Width="200px" TabIndex="8"> </ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:SimpleForm ID="SimpleForm2" ShowBorder="true" ShowHeader="false" runat="server" BodyPadding="5px" EnableBackgroundColor="true" Title="新增产品" Hidden="true"> <Toolbars> <ext:Toolbar ID="Toolbar2" runat="server"> <Items> <ext:Label ID="lblTitle1" runat="server" Text="新增产品" CssStyle="font-weight:bold;"> </ext:Label> <ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill> <ext:Button ID="btnAdd" Text="添加" runat="server" Icon="Add" OnClick="btnAdd_Click" ValidateForms="SimpleForm2"> </ext:Button> <ext:Button ID="btnCancle" Text="取消" runat="server" Icon="Cancel" Hidden="true" OnClick="btnCancel_Click"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:ContentPanel ID="ContentPanel2" runat="server" EnableBackgroundColor="true" ShowBorder="false" ShowHeader="false"> <table width="100%" border=0> <tr> <td width="300">产品名称</td> <td width="60">数量</td> <td width="60">单价</td> <td width="60" style="display:none">金额</td> <td width="60">零售价</td> </tr> <tr> <td> <ext:TriggerBox Width="300px" EnableEdit="false" runat="server" ID="tb_CBBDeta_PInfo_Id" TriggerIcon="Search" EnablePostBack="false" Required="true" ></ext:TriggerBox> <ext:HiddenField ID="hf_CBBDeta_PInfo_Id" runat="server"> </ext:HiddenField></td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_Count" Required="true" DecimalPrecision="0"></ext:NumberBox></td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_CostPrice" Required="true" DecimalPrecision="0"></ext:NumberBox></td> <td style="display:none"><ext:NumberBox runat="server" ID="nb_BBDeta_Money" Required="true" Enabled="false" DecimalPrecision="0"></ext:NumberBox></td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_Price" Required="true" DecimalPrecision="0"></ext:NumberBox></td> </tr> </table> </ext:ContentPanel> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="退货单明细" DataKeyNames="CBBDeta_Id,CBBDeta_PInfo_Id,PInfo_Code" EnableRowNumber="true" AllowPaging="true" AutoHeight="true" OnRowCommand="gv_List_RowCommand" PageSize="10" OnPageIndexChange="gv_List_PageIndexChange"> <Columns> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类型" Width="100px" /> <ext:BoundField ColumnID="CBBDeta_Count" DataField="CBBDeta_Count" DataTooltipField="CBBDeta_Count" HeaderText="数量" Width="50px" /> <ext:BoundField ColumnID="CBBDeta_Price" DataField="CBBDeta_Price" DataTooltipField="CBBDeta_Price" HeaderText="单价" Width="60px" /> <ext:BoundField ColumnID="CBBDeta_Money" DataField="CBBDeta_Money" DataTooltipField="CBBDeta_Money" HeaderText="金额" Width="60px" /> <%-- <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" />--%> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择产品" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"> </ext:Window> <ext:Window runat="server" ID="win_Import" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="进货单导入" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"> </ext:Window> </div> <ext:HiddenField ID="hf_SBill_Code" runat="server"> </ext:HiddenField> <ext:Window runat="server" ID="win_Confirm" IsModal="true" EnableDrag="true" EnableClose="true" Height="250px" Width="400px" Hidden="true" Layout="Absolute" IFrameUrl="" EnableIFrame="true" > </ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_ClientBackBillEdit.aspx
ASP.NET
asf20
11,745
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SaleBillList.aspx.cs" Inherits="SaleSystem.Business.frm_SaleBillList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>进货管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click"> </ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add"> </ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" AutoScroll="true" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Code" Label="销售单号" Width="200px" TabIndex="1"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_SBill_Code2" Label="出库单号" Width="200px" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_Type" Label="销售单类型" Width="200px" DataValueField="BData_Id" TabIndex="3" DataTextField="BData_Name"> </ext:DropDownList> <ext:TwinTriggerBox Width="200px" runat="server" ID="tb_SBill_Cust_Id" Label="客户名称" ShowTrigger1="true" ShowTrigger2="true" Trigger1Icon="Clear" Trigger2Icon="Search" OnTrigger1Click="OnTrigger1Click" EnableEdit="false" TabIndex="4"></ext:TwinTriggerBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_PayType" Label="结算方式" Width="200px" DataValueField="Id" DataTextField="Name" TabIndex="5"></ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_SBill_State" Label="结算状态" Width="200px" DataValueField="Id" DataTextField="Name" TabIndex="6"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_SBill_RealMoney1" Label="实收金额>=" Width="200px" TabIndex="7" ></ext:NumberBox> <ext:NumberBox runat="server" ID="nb_SBill_RealMoney2" Label="实收金额<=" Width="200px" TabIndex="8"> </ext:NumberBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DatePicker runat="server" ID="dp_SBill_Date1" Label="销售日期>=" Width="200px" TabIndex="9" ></ext:DatePicker> <ext:DatePicker runat="server" ID="dp_SBill_Date2" Label="销售日期<=" Width="200px" TabIndex="10"> </ext:DatePicker> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_User" Label="经办人" Width="200px" DataValueField="SUser_Id" TabIndex="11" DataTextField="SUser_Name"> </ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="进货单列表" AutoScroll="true" IsDatabasePaging="true" DataKeyNames="SBill_Id,SBill_Code" EnableRowNumber="true" AutoWidth="true" OnRowCommand="gv_List_RowCommand" AllowPaging="true" OnPageIndexChange="gv_List_PageIndexChange" AutoHeight="true" OnPreRowDataBound="gv_List_PreRowDataBound"> <Columns> <ext:BoundField ColumnID="SBill_Code" DataField="SBill_Code" DataTooltipField="SBill_Code" HeaderText="销售单号" Width="100px" /> <ext:BoundField ColumnID="SBill_Code2" DataField="SBill_Code2" DataTooltipField="SBill_Code2" HeaderText="出库单号" Width="100px" /> <ext:BoundField ColumnID="SBill_TypeName" DataField="SBill_TypeName" DataTooltipField="SBill_TypeName" HeaderText="单据类型" Width="80px" /> <ext:BoundField ColumnID="Cust_Name" DataField="Cust_Name" DataTooltipField="Cust_Name" HeaderText="客户" Width="80px" /> <ext:BoundField ColumnID="SBill_PayTypeName" DataField="SBill_PayTypeName" DataTooltipField="SBill_PayTypeName" HeaderText="结算方式" Width="80px" /> <ext:BoundField ColumnID="AList_Name" DataField="AList_Name" DataTooltipField="AList_Name" HeaderText="结算帐户" Width="100px" /> <ext:BoundField ColumnID="SBill_RealMoney" DataField="SBill_RealMoney" DataTooltipField="SBill_RealMoney" HeaderText="实收金额" Width="80px" /> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="60px" /> <ext:TemplateField HeaderText="销售日期" Width="80px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "SBill_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:CheckBoxField DataTooltipField="SBill_State" Width="60px" RenderAsStaticField="true" DataField="SBill_State" HeaderText="是否结算" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择客户" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"> </ext:Window> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增销售单" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"></ext:Window> <ext:HiddenField ID="hf_SBill_Cust_Id" runat="server"></ext:HiddenField> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_SaleBillList.aspx
ASP.NET
asf20
7,406
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_BuyList.aspx.cs" Inherits="SaleSystem.Business.frm_BuyList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>进货管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增会员" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false" > <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_BBill_Code" Label="会员证号" Width="200px" TabIndex="1"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Member_Name" Label="会员姓名" Width="200px" TabIndex="2"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_BBill_Supp_Id" Label="地市" Width="200px" DataValueField="Supp_Id" DataTextField="Supp_Name" TabIndex="2"></ext:DropDownList> <ext:DatePicker runat="server" ID="dp_BBill_Date2" Label="进货日期<=" Width="200px" TabIndex="4"></ext:DatePicker> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_BBill_Money1" Label="总额>=" Width="200px" TabIndex="5"></ext:NumberBox> <ext:NumberBox runat="server" ID="nb_BBill_Money2" Label="总额<=" Width="200px" TabIndex="6"></ext:NumberBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_BBill_Input" Label="入库状态" Width="200px" TabIndex="8"> <ext:ListItem Text="-未选择-" Value="-1" Selected="true" /> <ext:ListItem Text="未入库" Value="0" /> <ext:ListItem Text="已入库" Value="1" /> </ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_BBill_State" Label="结算状态" Width="200px" TabIndex="8"> <ext:ListItem Text="-未选择-" Value="-1" Selected="true" /> <ext:ListItem Text="未结算" Value="0" /> <ext:ListItem Text="已结算" Value="1" /> </ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_BBill_SUser_Id" Label="经办人" Width="200px" DataValueField="SUser_Id" DataTextField="SUser_Name" TabIndex="7"></ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="进货单列表" IsDatabasePaging="true" DataKeyNames="BBill_Id,BBill_Code" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" AutoHeight="true" OnPreRowDataBound="gv_List_PreRowDataBound"> <Columns> <ext:BoundField ColumnID="BBill_Code" DataField="BBill_Code" DataTooltipField="BBill_Code" HeaderText="进货单号" Width="100px" /> <ext:BoundField ColumnID="BBill_Supp_Id" DataField="Supp_Name" DataTooltipField="Supp_Name" HeaderText="供应商" Width="150px"/> <ext:TemplateField HeaderText="进货日期"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "BBill_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:BoundField ColumnID="BBill_Money" DataField="BBill_Money" DataTooltipField="BBill_Money" HeaderText="总额" Width="80px"/> <ext:BoundField ColumnID="BBill_Count" DataField="BBill_Count" DataTooltipField="BBill_Count" HeaderText="数量" Width="80px"/> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="80px"/> <ext:CheckBoxField DataTooltipField="BBill_Code" Width="60px" RenderAsStaticField="true" DataField="BBill_Input" HeaderText="是否入库" /> <ext:CheckBoxField DataTooltipField="BBill_Code" Width="60px" RenderAsStaticField="true" DataField="BBill_State" HeaderText="是否结算" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增供应商" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_BuyList.aspx
ASP.NET
asf20
5,884
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.Business { public partial class frm_BuyEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { tb_BBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_BBDeta_PInfo_Id.ClientID, this.hf_BBDeta_PInfo_Id.ClientID,this.nb_BBDeta_Count.ClientID, this.nb_BBDeta_CostPrice.ClientID, this.nb_BBDeta_Money.ClientID, this.nb_BBDeta_Price.ClientID) + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id="); //tb_BBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_BBDeta_PInfo_Id.ClientID, this.hf_BBDeta_PInfo_Id.ClientID) // + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id=" + this.tb_BBDeta_PInfo_Id.GetValueReference()); InitControl(); GetAndBind(); bnImport.OnClientClick = win_Import.GetShowReference("~/ComPage/frm_PutInUploadList.aspx?Id=" + this.Id, "进货单明细导入"); } if (Request[LinkService.RefreshTag] == "bnTotal") { bn_Total_Click(null, null); } } protected void bnSave_Click(object sender, EventArgs e) { //如果是修改,保存前先校验下该单据状态是否已经被入库了,如果入库了则不能修改 if (this.Id != 0) { BuyBill SM = new BuyBill(); SM.BBill_Id = Id; Manager.GetModel(SM); if (SM.BBill_Input == 1) { ExtAspNet.Alert.Show("该进货单已经入库,不能修改!", "操作提示!", MessageBoxIcon.Warning); return; } } SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.BBill_Code = this.tb_BBill_Code.Text; SModel.BBill_Count = ValueHandler.GetIntNumberValue(dtDetail.Compute("sum(BBDeta_Count)","")); SModel.BBill_Date = DateTime.Parse( tb_BBill_Date.Text); SModel.BBill_Id = this.Id; SModel.BBill_Memo = this.tb_BBill_Memo.Text; SModel.BBill_Money = ValueHandler.GetDecNumberValue( dtDetail.Compute("sum(BBDeta_Money)", "")); SModel.BBill_Supp_Id = ValueHandler.GetIntNumberValue( this.ddl_BBill_Supp_Id.SelectedValue); SModel.BBill_SUser_Id = ValueHandler.GetIntNumberValue(this.ddl_BBill_SUser_Id.SelectedValue); SModel.BBilll_PayType = ValueHandler.GetIntNumberValue(this.ddl_BBilll_PayType.SelectedValue); SModel.BBill_AList_Id = ValueHandler.GetIntNumberValue(this.ddl_BBill_AList_Id.SelectedValue); bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("进货单编码已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel,dtDetail); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.Show("进货单信息编辑失败!", MessageBoxIcon.Error); } } protected void bn_Total_Click(object sender, EventArgs e) { SModel.BBill_Id = this.Id; Manager.GetModel(SModel); if (SModel.BBill_State == 1) { ExtAspNet.Alert.Show("该销售单已经结算,不能再次结算!", "操作提示!", MessageBoxIcon.Warning); } else { bool blRes = Manager.JS(SModel); if (blRes) { PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("结算完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else { ExtAspNet.Alert.Show("结算失败!", "操作提示!", MessageBoxIcon.Error); } } } protected void ddl_SBill_PayTypeSelectedChanged(object obj, EventArgs e) { SysConfig SM = new SysConfig(); if (this.ddl_BBilll_PayType.SelectedValue == "1")//现金 { SM.SConf_Id = 4; } else SM.SConf_Id = 5; SysConfigOp op = new SysConfigOp(); op.GetConfig(SM); this.ddl_BBill_AList_Id.SelectedValue = SM.SConf_Value; } /// <summary> /// 添加产品明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (hf_BBDeta_PInfo_Id.Text.Trim() == "") { ExtAspNet.Alert.Show("请先选中产品后再做此操作!", "提示!", MessageBoxIcon.Warning); return; } else { DataTable dt = dtDetail; ProductInfoOp ProductManager = new ProductInfoOp(); ProductInfo SM = new ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(hf_BBDeta_PInfo_Id.Text); //判断单据中是否存在该产品 DataView dv = new DataView(dt); dv.RowFilter = "BBDeta_PInfo_Id=" + SM.PInfo_Id.ToString() + " AND BBDeta_Id<>" + BBDeta_Id; if (dv.Count > 0) { ExtAspNet.Alert.Show("单据中已经存在该产品信息!", "提示!", MessageBoxIcon.Warning); return; } DataRow dr = null; if (this.btnAdd.Text == "添加") { dr = dt.NewRow(); dt.Rows.Add(dr); } else { DataView dv0 = new DataView(dt); dv0.RowFilter = "BBDeta_Id=" + BBDeta_Id; if (dv0.Count > 0) dr = dv0[0].Row; } ProductManager.GetModel(SM); dr["PInfo_Code"] = SM.PInfo_Code; dr["PInfo_Name"] = SM.PInfo_Name; dr["BBDeta_PInfo_Id"] = this.hf_BBDeta_PInfo_Id.Text; dr["BBDeta_SBill_Id"] = this.Id; dr["BBDeta_Count"] = ValueHandler.GetIntNumberValue(this.nb_BBDeta_Count.Text); dr["BBDeta_CostPrice"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_CostPrice.Text); dr["BBDeta_Price"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_Price.Text); dr["BBDeta_Money"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_CostPrice.Text) * ValueHandler.GetDecNumberValue(this.nb_BBDeta_Count.Text); //获取产品类别 ProductSortOp sortManager = new ProductSortOp(); ProductSort sortSM = new ProductSort(); sortSM.PSort_ID = SM.PInfo_PSort_ID; sortManager.GetModelById(sortSM); dr["PSort_Name"] = sortSM.PSort_Name; gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 tb_BBill_Count.Text = dt.Compute("sum(BBDeta_Count)", "").ToString(); tb_BBill_Money.Text = dt.Compute("sum(BBDeta_Money)", "").ToString(); ClearContent(); } } protected void bnInput_Click(object sender, EventArgs e) { BuyBill bb = new BuyBill(); bb.BBill_Id = this.Id; Manager.GetModel(bb) ; if (bb.BBill_Input == 1) { ExtAspNet.Alert.Show("该进货单已经入库,不能再次入库!", "操作提示!", MessageBoxIcon.Warning); } //else if (bb.BBilll_PayType == -1) //{ // ExtAspNet.Alert.Show("该单据结算方式并未保存,请保存后再入库!", "操作提示!", MessageBoxIcon.Warning); // return; //} //else if (bb.BBill_AList_Id == 0 || bb.BBill_AList_Id == -1) //{ // ExtAspNet.Alert.Show("该单据结算账户并未保存,请保存后再入库!", "操作提示!", MessageBoxIcon.Warning); // return; //} else { bool blRes= Manager.PutIn(bb); if (blRes) { //bnSave.Enabled = false; //bnInput.Enabled = false; //btnAdd.Enabled = false; //SimpleForm2.Hidden = true; //gv_List.Columns[7].Hidden = true; //gv_List.Columns[8].Hidden = true; this.tb_BBill_Input.Text = "<span style='color:Green;font-weight:bold;'>已入库</span>"; PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("进货单入库完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } } } protected void btnCancel_Click(object sender, EventArgs e) { ClearContent(); } private void ClearContent() { this.tb_BBDeta_PInfo_Id.Text = ""; this.hf_BBDeta_PInfo_Id.Text = ""; this.nb_BBDeta_CostPrice.Text = ""; this.nb_BBDeta_Count.Text = "1"; this.nb_BBDeta_Money.Text = ""; this.nb_BBDeta_Price.Text = ""; BBDeta_Id = 0; this.btnAdd.Text = "添加"; this.btnAdd.Icon = Icon.Add; this.btnCancle.Hidden = true; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { DataView dv = new DataView(dtDetail); BBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "BBDeta_Id=" + BBDeta_Id; if (dv.Count > 0) { dv[0].Delete(); } dtDetail.AcceptChanges(); gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 tb_BBill_Count.Text = dtDetail.Compute("sum(BBDeta_Count)", "").ToString(); tb_BBill_Money.Text = dtDetail.Compute("sum(BBDeta_Money)", "").ToString(); ClearContent(); } else if (e.CommandName.ToLower() == "edit") { DataView dv = new DataView(dtDetail); BBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "BBDeta_Id=" + BBDeta_Id; if (dv.Count > 0) { this.tb_BBDeta_PInfo_Id.Text = ValueHandler.GetStringValue( dv[0]["PInfo_Name"]); this.hf_BBDeta_PInfo_Id.Text = ValueHandler.GetStringValue( dv[0]["BBDeta_PInfo_Id"]); this.nb_BBDeta_CostPrice.Text = ValueHandler.GetDecNumberValue( dv[0]["BBDeta_CostPrice"]).ToString(); this.nb_BBDeta_Count.Text = ValueHandler.GetIntNumberValue(dv[0]["BBDeta_Count"]).ToString(); this.nb_BBDeta_Money.Text = ValueHandler.GetDecNumberValue(dv[0]["BBDeta_Money"]).ToString(); this.nb_BBDeta_Price.Text = ValueHandler.GetDecNumberValue(dv[0]["BBDeta_Price"]).ToString(); this.btnAdd.Icon = Icon.Accept; this.btnAdd.Text = "确定"; this.btnCancle.Hidden = false; } } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; SortPags sp = new SortPags(dtDetail); gv_List.DataSource = sp.GetCurrentPage(LinkService.PageSize, gv_List.PageIndex + 1); gv_List.DataBind(); } #endregion #region Method private void InitControl() { if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); bn_Total.OnClientClick = win_Confirm.GetShowReference("~/Other/frm_TotalEdit.aspx?Type=1&Id=" + this.Id, "结算方式确认") + ";return false"; SysUsersOp userManager = new SysUsersOp(); DataTable dtUser= userManager.GetList(""); this.ddl_BBill_SUser_Id.DataSource = dtUser; this.ddl_BBill_SUser_Id.DataBind(); this.ddl_BBill_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); SupplierOp supplierManager = new SupplierOp(); DataTable dtSupplier = supplierManager.GetList(""); this.ddl_BBill_Supp_Id.DataSource = dtSupplier; this.ddl_BBill_Supp_Id.DataBind(); this.ddl_BBill_Supp_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); this.ddl_BBill_SUser_Id.SelectedValue = LinkService.GetCurrentUser().SUser_Id.ToString(); //结算方式 this.ddl_BBilll_PayType.DataSource = LinkService.GetPayType(); this.ddl_BBilll_PayType.DataBind(); this.ddl_BBilll_PayType.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 //this.ddl_SBill_State.DataSource = LinkService.GetSBill_State(); //this.ddl_SBill_State.DataBind(); //this.ddl_SBill_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //账户 AccountListOp AccountManager = new AccountListOp(); DataTable dtAccountList = AccountManager.GetList(""); this.ddl_BBill_AList_Id.DataSource = dtAccountList; this.ddl_BBill_AList_Id.DataBind(); this.ddl_BBill_AList_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { SModel.BBill_Id = Id; dtDetail = Manager.GetDetail(SModel) ; this.tb_BBill_Code.Text = SModel.BBill_Code; this.tb_BBill_Count.Text = SModel.BBill_Count.ToString(); this.tb_BBill_Date.Text = ValueHandler.GetStringShortDateValue(SModel.BBill_Date); if (SModel.BBill_Input == 1) { this.tb_BBill_Input.Text = "<span style='color:Green;font-weight:bold;'>已入库</span>"; } else this.tb_BBill_Input.Text = "<span style='color:Red;font-weight:bold;'>未入库</span>"; if (SModel.BBill_State == 1) { this.tb_BBill_State.Text = "<span style='color:Green;font-weight:bold;'>已结算</span>"; } else this.tb_BBill_State.Text = "<span style='color:Red;font-weight:bold;'>未结算</span>"; this.tb_BBill_Memo.Text = SModel.BBill_Memo; this.tb_BBill_Money.Text = SModel.BBill_Money.ToString(); this.ddl_BBill_Supp_Id.SelectedValue = SModel.BBill_Supp_Id.ToString(); this.ddl_BBill_SUser_Id.SelectedValue = SModel.BBill_SUser_Id.ToString(); this.ddl_BBill_AList_Id.SelectedValue = SModel.BBill_AList_Id.ToString(); this.ddl_BBilll_PayType.SelectedValue = SModel.BBilll_PayType.ToString(); SortPags sp = new SortPags(dtDetail); gv_List.DataSource = sp.GetCurrentPage(LinkService.PageSize,gv_List.PageIndex+1); gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; if (Id != 0) { //已结算 if (SModel.BBill_State == 1) { bnSave.Enabled = false; bnInput.Enabled = false; btnAdd.Enabled = false; this.bnImport.Enabled = false; this.bn_Total.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[7].Hidden = true; gv_List.Columns[8].Hidden = true; } else//未结算 { //未入库 if (SModel.BBill_Input == 0) { bnSave.Enabled = true; bnInput.Enabled = true; this.bnImport.Enabled = true; this.bn_Total.Enabled=false; } else//已入库 { this.bnSave.Enabled = false; bnInput.Enabled = false; btnAdd.Enabled = false; this.bnImport.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[7].Hidden = true; gv_List.Columns[8].Hidden = true; } } } else { this.tb_BBill_Code.Text = Coder.CreateCoder(EMenuList.进货单管理); this.bnImport.Enabled = false; this.bnInput.Enabled = false; this.bn_Total.Enabled = false; tb_BBill_Date.Text = ValueHandler.GetStringValue(System.DateTime.Now.ToString("yyyy-MM-dd")); } this.bnImport.ToolTip = "只有在编辑状态下才可导入!"; this.bnInput.ToolTip = "只有在编辑状态下才可入库!"; this.bnSave.ToolTip = "只有未入库的才可保存!"; this.bn_Total.ToolTip = "只有入库的进货单才可结算!"; } #endregion #region Property BuyBillOp Manager = new BuyBillOp(); new Sale_Model.BuyBill SModel = new Sale_Model.BuyBill(); public DataTable dtDetail { get { return ViewState["dtDetail"] as DataTable; } set { ViewState["dtDetail"] = value; } } /// <summary> /// 子表当前编辑的关键子 /// </summary> public int BBDeta_Id { get { return ValueHandler.GetIntNumberValue(ViewState["BBDeta_Id"]); } set { ViewState["BBDeta_Id"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_BuyEdit.aspx.cs
C#
asf20
20,431
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_MyBackBillEdit.aspx.cs" Inherits="SaleSystem.Business.frm_MyBackBillEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1" runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnOutput" Icon="PackageGo" Text="出库" ValidateForms="SimpleForm1" OnClick="bnOutput_Click" ConfirmTitle="出库确认!" ConfirmText="出库后,此返货单则不能修改,确认出库?"> </ext:Button> <ext:Button runat="server" ID="bnInput" Text="结算" Icon="Coins" ConfirmIcon="Warning" OnClick="bn_Total_Click"></ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </toolbars> <ext:Form runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_MBB_Code" Label="返货单号" Required="true" ShowRedStar="true" Width="200px" TabIndex="1"> </ext:TextBox> <ext:DropDownList runat="server" ID="ddl_MBB_Supp_Id" Label="供应商" Width="200px" CompareValue="-1" CompareOperator="NotEqual" DataValueField="Supp_Id" DataTextField="Supp_Name" Required="true" ShowRedStar="true" TabIndex="2"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_MBB_SUser_Id" Label="经办人" CompareValue="-1" CompareOperator="NotEqual" Width="200px" DataValueField="SUser_Id" Required="true" ShowRedStar="true" TabIndex="5" DataTextField="SUser_Name"> </ext:DropDownList> <ext:DatePicker runat="server" ID="dp_MBB_Date" Label="返货日期" Required="true" ShowRedStar="true" Width="200px" TabIndex="6"></ext:DatePicker> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:Label runat="server" ID="lb_MBB_Output" Label="出库状态" Width="200px" EncodeText="false"> </ext:Label> <ext:Label runat="server" ID="lb_MBB_State" Label="结算状态" Width="200px" EncodeText="false"> </ext:Label> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form2" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" EnableCollapse="true" ShowBorder="true" ShowHeader="true" BodyPadding="5px" Title="更多信息"> <Rows> <ext:FormRow > <Items> <ext:DropDownList runat="server" ID="ddl_MBB_PayType" Label="结算方式" Width="200px" DataValueField="Id" DataTextField="Name" OnSelectedIndexChanged="ddl_SBill_PayTypeSelectedChanged" AutoPostBack="true" TabIndex="7"></ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_MBB_AList_Id" TabIndex="8" Label="结算帐户" Width="200px" DataValueField="AList_Id" DataTextField="AccountInfo"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_MBB_Money" Label="返货总额" Width="200px" Enabled="false"></ext:NumberBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_MBB_Reason" MaxLength="200" Width="200px" Label="备注" TabIndex="11"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:SimpleForm ID="SimpleForm2" ShowBorder="true" ShowHeader="false" runat="server" BodyPadding="5px" EnableBackgroundColor="true" Title="新增产品"> <Toolbars> <ext:Toolbar ID="Toolbar2" runat="server"> <Items> <ext:Label ID="lblTitle1" runat="server" Text="新增产品" CssStyle="font-weight:bold;"> </ext:Label> <ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill> <ext:Button ID="btnAdd" Text="添加" runat="server" Icon="Add" OnClick="btnAdd_Click" ValidateForms="SimpleForm2"> </ext:Button> <ext:Button ID="btnCancle" Text="取消" runat="server" Icon="Cancel" Hidden="true" OnClick="btnCancel_Click"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:ContentPanel ID="ContentPanel2" runat="server" EnableBackgroundColor="true" ShowBorder="false" ShowHeader="false"> <table width="100%" border=0> <tr> <td width="300">产品名称</td> <td width="60">数量</td> <td width="60">单价</td> <td width="60" style="display:none">金额</td> </tr> <tr> <td> <ext:TriggerBox Width="300px" EnableEdit="false" runat="server" ID="tb_SBDeta_PInfo_Id" TriggerIcon="Search" EnablePostBack="false" Required="true" TabIndex="12"></ext:TriggerBox> <ext:HiddenField ID="hf_SBDeta_PInfo_Id" runat="server"> </ext:HiddenField> </td> <td><ext:NumberBox runat="server" ID="nb_SBDeta_Count" Required="true" DecimalPrecision="0" TabIndex="13"></ext:NumberBox> </td> <td style="display:none"><ext:NumberBox runat="server" ID="nb_SBDeta_Money" Required="true" Enabled="false" DecimalPrecision="0" TabIndex="14"></ext:NumberBox> </td> <td><ext:NumberBox runat="server" ID="nb_SBDeta_Price" Required="true" DecimalPrecision="0" TabIndex="15"></ext:NumberBox> </td> </tr> </table> </ext:ContentPanel> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="返货单明细" DataKeyNames="MBBDeta_Id,MBBDeta_PInfo_Id,PInfo_Code" EnableRowNumber="true" AllowPaging="true" AutoHeight="true" OnRowCommand="gv_List_RowCommand" PageSize="10" OnPageIndexChange="gv_List_PageIndexChange"> <Columns> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类型" Width="100px" /> <ext:BoundField ColumnID="MBBDeta_Count" DataField="MBBDeta_Count" DataTooltipField="MBBDeta_Count" HeaderText="数量" Width="50px" /> <ext:BoundField ColumnID="MBBDeta_Price" DataField="MBBDeta_Price" DataTooltipField="MBBDeta_Price" HeaderText="单价" Width="60px" /> <ext:BoundField ColumnID="MBBDeta_Money" DataField="MBBDeta_Money" DataTooltipField="MBBDeta_Money" HeaderText="金额" Width="60px" /> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择客户" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"> </ext:Window> </div> <ext:HiddenField ID="hf_SBDeta_Price" runat="server"></ext:HiddenField> <ext:HiddenField ID="hf_SBill_Cust_Id" runat="server"></ext:HiddenField> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择产品" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"></ext:Window> <ext:Window runat="server" ID="win_Confirm" IsModal="true" EnableDrag="true" EnableClose="true" Height="250px" Width="400px" Hidden="true" Layout="Absolute" IFrameUrl="" EnableIFrame="true" > </ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_MyBackBillEdit.aspx
ASP.NET
asf20
10,458
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SaleBillEdit.aspx.cs" Inherits="SaleSystem.Business.frm_SaleBillEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnInput" Text="结算" Icon="Coins" ConfirmIcon="Warning" ConfirmText="结算后,此单据不能修改,确认结算?" ConfirmTitle="结算确认!" OnClick="bnInput_Click"></ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </toolbars> <ext:Form runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Code" Label="销售单号" Required="true" ShowRedStar="true" Width="200px" TabIndex="1"> </ext:TextBox> <ext:TextBox runat="server" ID="tb_SBill_Code2" Label="出库单号" Width="200px" Required="true" ShowRedStar="true" TabIndex="2"> </ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_Type" Label="销售单类型" Width="200px" DataValueField="BData_Id" Required="true" ShowRedStar="true" DataTextField="BData_Name" CompareValue="-1" CompareOperator="NotEqual" TabIndex="3"> </ext:DropDownList> <ext:TwinTriggerBox Width="200px" runat="server" ID="tb_SBill_Cust_Id" EnableEdit="false" Label="客户名称" ShowTrigger1="true" ShowTrigger2="true" Trigger1Icon="Clear" Trigger2Icon="Search" OnTrigger1Click="Trigger1_Click" Required="true" ShowRedStar="true" AutoPostBack="true" CompareValue="" CompareOperator="NotEqual" TabIndex="4"> </ext:TwinTriggerBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_SBill_User" Label="经办人" CompareValue="-1" CompareOperator="NotEqual" Width="200px" DataValueField="SUser_Id" Required="true" ShowRedStar="true" TabIndex="5" DataTextField="SUser_Name"> </ext:DropDownList> <ext:DatePicker runat="server" ID="dp_SBill_Date" Label="销售日期" Required="true" ShowRedStar="true" Width="200px" TabIndex="6"></ext:DatePicker> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form2" AutoHeight="true" AutoScroll="true" EnableBackgroundColor="true" EnableCollapse="true" ShowBorder="true" ShowHeader="true" BodyPadding="5px" Title="更多信息"> <Rows> <ext:FormRow > <Items> <ext:DropDownList runat="server" ID="ddl_SBill_PayType" Label="结算方式" Width="200px" DataValueField="Id" DataTextField="Name" OnSelectedIndexChanged="ddl_SBill_PayTypeSelectedChanged" AutoPostBack="true" TabIndex="7"></ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_SBill_AList_Id" TabIndex="8" Label="结算帐户" Width="200px" DataValueField="AList_Id" DataTextField="AccountInfo"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_SBill_TaxMoney" Label="税额" TabIndex="9" Width="200px" AutoPostBack="true" OnTextChanged="nb_SBill_TaxMoney_TextChanged"></ext:NumberBox> <ext:NumberBox runat="server" ID="nb_SBill_Money" Label="总额" Width="200px" Enabled="false"></ext:NumberBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_SBill_RealMoney" Label="实收金额" TabIndex="10" Width="200px" Enabled="false"></ext:NumberBox> <ext:Label runat="server" ID="lb_SBill_State" EncodeText="false" Label="结算状态"></ext:Label> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Remark" MaxLength="200" Width="200px" Label="备注" TabIndex="11"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:SimpleForm ID="SimpleForm2" ShowBorder="true" ShowHeader="false" runat="server" BodyPadding="5px" EnableBackgroundColor="true" Title="新增产品"> <Toolbars> <ext:Toolbar ID="Toolbar2" runat="server"> <Items> <ext:Label ID="lblTitle1" runat="server" Text="新增产品" CssStyle="font-weight:bold;"> </ext:Label> <ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill> <ext:Button ID="btnAdd" Text="添加" runat="server" Icon="Add" OnClick="btnAdd_Click" ValidateForms="SimpleForm2"> </ext:Button> <ext:Button ID="btnCancle" Text="取消" runat="server" Icon="Cancel" Hidden="true" OnClick="btnCancel_Click"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:ContentPanel ID="ContentPanel2" runat="server" EnableBackgroundColor="true" ShowBorder="false" ShowHeader="false"> <table width="100%" border=0> <tr> <td width="300">产品名称</td> <td width="60">数量</td> <td width="60">单价</td> <td width="60" style="display:none">金额</td> </tr> <tr> <td> <ext:TriggerBox Width="300px" EnableEdit="false" runat="server" ID="tb_SBDeta_PInfo_Id" TriggerIcon="Search" EnablePostBack="false" Required="true" TabIndex="12"></ext:TriggerBox> <ext:HiddenField ID="hf_SBDeta_PInfo_Id" runat="server"> </ext:HiddenField></td> <td><ext:NumberBox runat="server" ID="nb_SBDeta_Count" Required="true" DecimalPrecision="0" TabIndex="13"></ext:NumberBox></td> <td style="display:none"><ext:NumberBox runat="server" ID="nb_SBDeta_Money" Required="true" Enabled="false" DecimalPrecision="0" TabIndex="14"></ext:NumberBox></td> <td><ext:NumberBox runat="server" ID="nb_SBDeta_Price" Required="true" DecimalPrecision="0" TabIndex="15"></ext:NumberBox></td> </tr> </table> </ext:ContentPanel> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="进货单明细" DataKeyNames="SBDeta_Id,SBDeta_PInfo_Id,PInfo_Code" EnableRowNumber="true" AllowPaging="true" AutoHeight="true" OnRowCommand="gv_List_RowCommand" PageSize="10" OnPageIndexChange="gv_List_PageIndexChange"> <Columns> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px" /> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类型" Width="100px" /> <ext:BoundField ColumnID="SBDeta_Count" DataField="SBDeta_Count" DataTooltipField="SBDeta_Count" HeaderText="数量" Width="50px" /> <ext:BoundField ColumnID="SBDeta_Price" DataField="SBDeta_Price" DataTooltipField="SBDeta_Price" HeaderText="单价" Width="60px" /> <ext:BoundField ColumnID="SBDeta_Money" DataField="SBDeta_Money" DataTooltipField="SBDeta_Money" HeaderText="金额" Width="60px" /> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px" /> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择客户" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"> </ext:Window> </div> <ext:HiddenField ID="hf_SBill_Cust_Id" runat="server"></ext:HiddenField> <ext:Window runat="server" ID="win_Content2" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择产品" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_SaleBillEdit.aspx
ASP.NET
asf20
10,717
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Business { public partial class frm_MyBackBillList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_MyBackBillEdit.aspx?Id=0", "新增返货单"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.MyBackBill SM = new Sale_Model.MyBackBill(); SM.MBB_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.MBB_Code = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); Manager.GetModel(SM); if (SM.MBB_Output == 1) { ExtAspNet.Alert.Show("该返货单已经出库,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_MyBackBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField lbfAction1 = gv_List.FindColumn("edit") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField lbfAction2 = gv_List.FindColumn("delete") as ExtAspNet.LinkButtonField; DataRowView row = e.DataItem as DataRowView; if (ValueHandler.GetIntNumberValue(row["MBB_Output"]) == 1) { // lbfAction1.Enabled = false; if (ValueHandler.GetIntNumberValue(row["MBB_State"]) == 1) { lbfAction1.Text = "查看"; } else { lbfAction1.Text = "结算"; } lbfAction2.Enabled = false; } else { lbfAction1.Text = "编辑"; lbfAction1.Enabled = true; lbfAction2.Enabled = true; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (tb_MBB_Code.Text.Trim() != "") { strCondition += " MBB_Code LIKE '%" + ValueHandler.GetStringValue(tb_MBB_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (ddl_MBB_Supp_Id.SelectedValue != "-1") { strCondition += " MBB_Supp_Id=" + ddl_MBB_Supp_Id.SelectedValue + " AND "; } if (dp_MBB_Date1.Text.Trim() != "") { DateTime d1 = DateTime.Now; if (DateTime.TryParse(dp_MBB_Date1.Text, out d1)) { strCondition += " MBB_Date >='" + dp_MBB_Date1.Text + "' AND "; } } if (dp_MBB_Date2.Text.Trim() != "") { DateTime d2 = DateTime.Now; if (DateTime.TryParse(dp_MBB_Date2.Text, out d2)) { strCondition += " MBB_Date <='" + dp_MBB_Date2.Text + "' AND "; } } if (nb_MBB_Money1.Text.Trim() != "") { strCondition += " MBB_Money >=" + nb_MBB_Money1.Text + " AND "; } if (nb_MBB_Money2.Text.Trim() != "") { strCondition += " MBB_Money <=" + nb_MBB_Money2.Text + " AND "; } if (ddl_MBB_SUser_Id.SelectedValue != "-1") { strCondition += " MBB_SUser_Id =" + ddl_MBB_SUser_Id.SelectedValue + " AND "; } if (ddl_MBB_Output.SelectedValue != "-1") { strCondition += " MBB_Output =" + ddl_MBB_Output.SelectedValue + " AND "; } if (ddl_MBB_State.SelectedValue != "-1") { strCondition += " MBB_State=" + this.ddl_MBB_State.SelectedValue + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_MBB_SUser_Id.DataSource = dtUser; this.ddl_MBB_SUser_Id.DataBind(); this.ddl_MBB_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); SupplierOp supplierManager = new SupplierOp(); DataTable dtSupplier = supplierManager.GetList(""); this.ddl_MBB_Supp_Id.DataSource = dtSupplier; this.ddl_MBB_Supp_Id.DataBind(); this.ddl_MBB_Supp_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property MyBackBillOp Manager = new MyBackBillOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_MyBackBillList.aspx.cs
C#
asf20
7,330
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Business { public partial class frm_SaleBillList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = this.win_Content2.GetShowReference("frm_SaleBillEdit.aspx?Id=0", "新增销售单"); tb_SBill_Cust_Id.OnClientTrigger2Click = win_Content.GetSaveStateReference(tb_SBill_Cust_Id.ClientID, this.hf_SBill_Cust_Id.ClientID) + win_Content.GetShowReference("~/ComPage/frm_CustomerChooseList.aspx"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.SaleBill SM = new Sale_Model.SaleBill(); SM.SBill_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.SBill_Code = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); Manager.GetModel(SM); if (SM.SBill_State == 1) { ExtAspNet.Alert.Show("该进销售单已经结算,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_SaleBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void OnTrigger1Click(object sender, EventArgs e) { this.hf_SBill_Cust_Id.Text = ""; this.tb_SBill_Cust_Id.Text = ""; } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField lbfAction1 = gv_List.FindColumn("edit") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField lbfAction2 = gv_List.FindColumn("delete") as ExtAspNet.LinkButtonField; DataRowView row = e.DataItem as DataRowView; if (ValueHandler.GetIntNumberValue(row["SBill_State"]) == 1) { // lbfAction1.Enabled = false; lbfAction1.Text = "查看"; lbfAction2.Enabled = false; } else { lbfAction1.Enabled = true; lbfAction2.Enabled = true; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (this.tb_SBill_Code.Text.Trim() != "") { strCondition += "SBill_Code LIKE '%"+ValueHandler.GetStringValue(this.tb_SBill_Code.Text, ValueHandler.CharHandlerType.IsRepChar)+"%' AND "; } if(this.tb_SBill_Code2.Text.Trim()!="") { strCondition += "SBill_Code2 LIKE '%"+ValueHandler.GetStringValue(this.tb_SBill_Code2.Text, ValueHandler.CharHandlerType.IsRepChar)+"%' AND "; } if(this.hf_SBill_Cust_Id.Text.Trim()!="") { strCondition += " SBill_Cust_Id ="+ValueHandler.GetStringValue(this.hf_SBill_Cust_Id.Text, ValueHandler.CharHandlerType.IsRepChar)+" AND "; } if(this.ddl_SBill_Type.SelectedValue.Trim()!="-1") { strCondition +=" SBill_Type ="+this.ddl_SBill_Type.SelectedValue+" AND "; } if(this.ddl_SBill_PayType.SelectedValue.Trim()!="-1") { strCondition +=" SBill_PayType ="+this.ddl_SBill_PayType.SelectedValue+" AND "; } if(this.ddl_SBill_State.SelectedValue.Trim()!="-1") { strCondition +=" SBill_State ="+this.ddl_SBill_State.SelectedValue+" AND "; } if(this.nb_SBill_RealMoney1.Text.Trim()!="") { strCondition +=" SBill_RealMoney >="+this.nb_SBill_RealMoney1.Text+" AND "; } if(this.nb_SBill_RealMoney2.Text.Trim()!="") { strCondition +=" SBill_RealMoney <="+this.nb_SBill_RealMoney2.Text+" AND "; } if (this.ddl_SBill_User.SelectedValue != "-1") { strCondition += " SBill_User =" + this.ddl_SBill_User.SelectedValue + " AND "; } if(dp_SBill_Date1.Text.Trim()!="") { DateTime dt1 =System.DateTime.Now; if(DateTime.TryParse(dp_SBill_Date1.Text, out dt1)) { strCondition +=" SBill_Date >='"+this.dp_SBill_Date1.Text+"' AND "; } } if(dp_SBill_Date2.Text.Trim()!="") { DateTime dt1 =System.DateTime.Now; if (DateTime.TryParse(dp_SBill_Date2.Text, out dt1)) { strCondition +=" SBill_Date <='"+this.dp_SBill_Date2.Text+"' AND "; } } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { //经办人 SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_SBill_User.DataSource = dtUser; this.ddl_SBill_User.DataBind(); this.ddl_SBill_User.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //销售单类型 BaseDataOp BaseManager = new BaseDataOp(); DataTable dtList1= BaseManager.GetList("BData_Type=4"); this.ddl_SBill_Type.DataSource = dtList1; this.ddl_SBill_Type.DataBind(); this.ddl_SBill_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算方式 this.ddl_SBill_PayType.DataSource = LinkService.GetPayType(); this.ddl_SBill_PayType.DataBind(); this.ddl_SBill_PayType.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 this.ddl_SBill_State.DataSource = LinkService.GetSBill_State(); this.ddl_SBill_State.DataBind(); this.ddl_SBill_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property SaleBillOp Manager = new SaleBillOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_SaleBillList.aspx.cs
C#
asf20
8,689
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Business { public partial class frm_ClientBackBillList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_ClientBackBillEdit.aspx?Id=0", "新增退货单"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.ClientBackBill SM = new Sale_Model.ClientBackBill(); SM.CBB_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.CBB_Code = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); Manager.GetModel(SM); if (SM.CBB_Input == 1) { ExtAspNet.Alert.Show("该退货单已经入库,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_ClientBackBillEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField lbfAction1 = gv_List.FindColumn("edit") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField lbfAction2 = gv_List.FindColumn("delete") as ExtAspNet.LinkButtonField; DataRowView row = e.DataItem as DataRowView; if (ValueHandler.GetIntNumberValue(row["CBB_Input"]) == 1) { // lbfAction1.Enabled = false; if (ValueHandler.GetIntNumberValue(row["CBB_State"]) == 1) { lbfAction1.Text = "查看"; } else { lbfAction1.Text = "结算"; } lbfAction2.Enabled = false; } else { lbfAction1.Text = "编辑"; lbfAction1.Enabled = true; lbfAction2.Enabled = true; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (tb_CBB_Code.Text.Trim() != "") { strCondition += " CBB_Code LIKE '%" + ValueHandler.GetStringValue(tb_CBB_Code.Text, ValueHandler.CharHandlerType.IsRepChar) + "%' AND "; } if (tb_SBill_Code.Text.Trim() != "") { strCondition += " SBill_Code LIKE '%" + tb_SBill_Code.Text.Trim() + "%' AND "; } if (tb_SBill_Code2.Text.Trim() != "") { strCondition += " SBill_Code2 LIKE '%" + tb_SBill_Code2.Text.Trim() + "%' AND "; } if (tb_Cust_Name.Text.Trim() != "") { strCondition += " Cust_Name LIKE '%" + tb_Cust_Name.Text.Trim() + "%' AND "; } if (dp_CBB_Date1.Text.Trim() != "") { DateTime d1 = DateTime.Now; if (DateTime.TryParse(dp_CBB_Date1.Text, out d1)) { strCondition += " CBB_Date >='" + dp_CBB_Date1.Text + "' AND "; } } if (dp_CBB_Date2.Text.Trim() != "") { DateTime d2 = DateTime.Now; if (DateTime.TryParse(dp_CBB_Date2.Text, out d2)) { strCondition += " CBB_Date <='" + dp_CBB_Date2.Text + "' AND "; } } if (ddl_CBB_Input.SelectedValue != "-1") { strCondition += " CBB_Input =" + ddl_CBB_Input.SelectedValue + " AND "; } if (ddl_CBB_State.SelectedValue != "-1") { strCondition += " CBB_State =" + ddl_CBB_State.SelectedValue + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { //SysUsersOp userManager = new SysUsersOp(); //DataTable dtUser = userManager.GetList(""); //this.ddl_BBill_SUser_Id.DataSource = dtUser; //this.ddl_BBill_SUser_Id.DataBind(); //this.ddl_BBill_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 this.ddl_CBB_State.DataSource = LinkService.GetSBill_State(); this.ddl_CBB_State.DataBind(); this.ddl_CBB_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property ClientBackBillOp Manager = new ClientBackBillOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_ClientBackBillList.aspx.cs
C#
asf20
7,130
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.Business { public partial class frm_ClientBackBillEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { tb_CBBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_CBBDeta_PInfo_Id.ClientID, this.hf_CBBDeta_PInfo_Id.ClientID, this.nb_BBDeta_Count.ClientID, this.nb_BBDeta_CostPrice.ClientID, this.nb_BBDeta_Money.ClientID, this.nb_BBDeta_Price.ClientID) + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id="); tb_SBill_Code.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_SBill_Code.ClientID, hf_SBill_Code.ClientID) + win_Content.GetShowReference("~/ComPage/frm_SaleBillSubList.aspx", "选择销售单"); //tb_CBBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_CBBDeta_PInfo_Id.ClientID, this.hf_CBBDeta_PInfo_Id.ClientID) // + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id=" + this.tb_CBBDeta_PInfo_Id.GetValueReference()); InitControl(); GetAndBind(); //bnImport.OnClientClick = win_Import.GetShowReference("~/ComPage/frm_PutInUploadList.aspx?Id=" + this.Id, "退货单明细导入"); } else if (Request[LinkService.RefreshTag] == "GetSaleBillDetail") { GetSaleBillDetail(); } else if (Request[LinkService.RefreshTag] == "bnTotal") { bn_Total_Click(null, null); } } protected void bnSave_Click(object sender, EventArgs e) { //如果是修改,保存前先校验下该单据状态是否已经被入库了,如果入库了则不能修改 if (this.Id != 0) { SModel.CBB_Id = Id; Manager.GetModel(SModel); if (SModel.CBB_Input == 1) { ExtAspNet.Alert.Show("该退货单已经入库,不能修改!", "操作提示!", MessageBoxIcon.Warning); return; } } else { SModel.CBB_Input = 0; SModel.CBB_State = 0; } SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.CBB_AList_Id = ValueHandler.GetIntNumberValue( this.ddl_CBB_AList_Id.SelectedValue); SModel.CBB_Code = this.tb_CBB_Code.Text; SModel.CBB_Date = DateTime.Parse(this.tb_CBB_Date.Text); SModel.CBB_Money = ValueHandler.GetDecNumberValue( this.tb_CBB_Money.Text); SModel.CBB_PayType = ValueHandler.GetIntNumberValue( this.ddl_CBB_PayType.SelectedValue); SModel.CBB_Reason = this.tb_CBB_Reason.Text; SModel.CBB_SBill_Id = ValueHandler.GetIntNumberValue( this.hf_SBill_Code.Text); SModel.CBB_State = 0; SModel.CBB_SUser_Id = ValueHandler.GetIntNumberValue( this.ddl_CBB_SUser_Id.SelectedValue); SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 0; bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.Show("退货单编码已经存在,请重新输入!", MessageBoxIcon.Information); } else { bool blRes = Manager.Save(SModel, dtDetail); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.Show("退货单信息编辑失败!", MessageBoxIcon.Error); } } protected void bn_Total_Click(object sender, EventArgs e) { SModel.CBB_Id = this.Id; Manager.GetModel(SModel); if (SModel.CBB_State == 1) { ExtAspNet.Alert.Show("该退货单已经结算,不能再次结算!", "操作提示!", MessageBoxIcon.Warning); } else { bool blRes = Manager.JS(SModel); if (blRes) { PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("结算完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else { ExtAspNet.Alert.Show("结算失败!", "操作提示!", MessageBoxIcon.Error); } } } protected void ddl_SBill_PayTypeSelectedChanged(object obj, EventArgs e) { SysConfig SM = new SysConfig(); if (this.ddl_CBB_PayType.SelectedValue == "1")//现金 { SM.SConf_Id = 4; } else SM.SConf_Id = 5; SysConfigOp op = new SysConfigOp(); op.GetConfig(SM); this.ddl_CBB_AList_Id.SelectedValue = SM.SConf_Value; } /// <summary> /// 添加产品明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (hf_CBBDeta_PInfo_Id.Text.Trim() == "") { ExtAspNet.Alert.Show("请先选中产品后再做此操作!", "提示!", MessageBoxIcon.Warning); return; } else { DataTable dt = dtDetail; ProductInfoOp ProductManager = new ProductInfoOp(); ProductInfo SM = new ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(hf_CBBDeta_PInfo_Id.Text); //判断单据中是否存在该产品 DataView dv = new DataView(dt); dv.RowFilter = "CBBDeta_PInfo_Id=" + SM.PInfo_Id.ToString() + " AND CBBDeta_Id<>" + CBBDeta_Id; if (dv.Count > 0) { ExtAspNet.Alert.Show("单据中已经存在该产品信息!", "提示!", MessageBoxIcon.Warning); return; } DataRow dr = null; if (this.btnAdd.Text == "添加") { dr = dt.NewRow(); dt.Rows.Add(dr); } else { DataView dv0 = new DataView(dt); dv0.RowFilter = "CBBDeta_Id=" + CBBDeta_Id; if (dv0.Count > 0) dr = dv0[0].Row; } ProductManager.GetModel(SM); dr["PInfo_Code"] = SM.PInfo_Code; dr["PInfo_Name"] = SM.PInfo_Name; dr["CBBDeta_PInfo_Id"] = this.hf_CBBDeta_PInfo_Id.Text; dr["BBDeta_SBill_Id"] = this.Id; dr["BBDeta_Count"] = ValueHandler.GetIntNumberValue(this.nb_BBDeta_Count.Text); dr["BBDeta_CostPrice"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_CostPrice.Text); dr["BBDeta_Price"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_Price.Text); dr["BBDeta_Money"] = ValueHandler.GetDecNumberValue(this.nb_BBDeta_CostPrice.Text) * ValueHandler.GetDecNumberValue(this.nb_BBDeta_Count.Text); //获取产品类别 ProductSortOp sortManager = new ProductSortOp(); ProductSort sortSM = new ProductSort(); sortSM.PSort_ID = SM.PInfo_PSort_ID; sortManager.GetModel(sortSM); dr["PSort_Name"] = sortSM.PSort_Name; gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; ClearContent(); } } protected void bnInput_Click(object sender, EventArgs e) { ClientBackBill bb = new ClientBackBill(); bb.CBB_Id = this.Id; Manager.GetModel(bb); if (bb.CBB_Input == 1) { ExtAspNet.Alert.Show("该退货单已经入库,不能再次入库!", "操作提示!", MessageBoxIcon.Warning); } //else if (bb.CBB_PayType == -1) //{ // ExtAspNet.Alert.Show("该单据结算方式并未保存,请保存后再入库!", "操作提示!", MessageBoxIcon.Warning); // return; //} //else if (bb.CBB_AList_Id == 0 || SModel.CBB_AList_Id == -1) //{ // ExtAspNet.Alert.Show("该单据结算账户并未保存,请保存后再入库!", "操作提示!", MessageBoxIcon.Warning); // return; //} else { bool blRes = Manager.PutIn(bb); if (blRes) { //bnSave.Enabled = false; //bnInput.Enabled = false; //btnAdd.Enabled = false; //SimpleForm2.Hidden = true; //gv_List.Columns[7].Hidden = true; //gv_List.Columns[8].Hidden = true; this.tb_CBB_Input.Text = "<span style='color:Green;font-weight:bold;'>已入库</span>"; PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("退货单入库完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } } } protected void btnCancel_Click(object sender, EventArgs e) { ClearContent(); } private void ClearContent() { this.tb_CBBDeta_PInfo_Id.Text = ""; this.hf_CBBDeta_PInfo_Id.Text = ""; this.nb_BBDeta_CostPrice.Text = ""; this.nb_BBDeta_Count.Text = "1"; this.nb_BBDeta_Money.Text = ""; this.nb_BBDeta_Price.Text = ""; CBBDeta_Id = 0; this.btnAdd.Text = "添加"; this.btnAdd.Icon = Icon.Add; this.btnCancle.Hidden = true; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { DataView dv = new DataView(dtDetail); CBBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "CBBDeta_Id=" + CBBDeta_Id; if (dv.Count > 0) { dv[0].Delete(); } dtDetail.AcceptChanges(); gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 ClearContent(); this.tb_CBB_Money.Text = ValueHandler.GetDecNumberValue(dtDetail.Compute("sum(CBBDeta_Money)", "")).ToString(); } else if (e.CommandName.ToLower() == "edit") { DataView dv = new DataView(dtDetail); CBBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "CBBDeta_Id=" + CBBDeta_Id; if (dv.Count > 0) { this.tb_CBBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["PInfo_Name"]); this.hf_CBBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["CBBDeta_PInfo_Id"]); this.nb_BBDeta_CostPrice.Text = ValueHandler.GetDecNumberValue(dv[0]["BBDeta_CostPrice"]).ToString(); this.nb_BBDeta_Count.Text = ValueHandler.GetIntNumberValue(dv[0]["BBDeta_Count"]).ToString(); this.nb_BBDeta_Money.Text = ValueHandler.GetDecNumberValue(dv[0]["BBDeta_Money"]).ToString(); this.nb_BBDeta_Price.Text = ValueHandler.GetDecNumberValue(dv[0]["BBDeta_Price"]).ToString(); this.btnAdd.Icon = Icon.Accept; this.btnAdd.Text = "确定"; this.btnCancle.Hidden = false; } } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } bn_Total.OnClientClick = win_Confirm.GetShowReference("~/Other/frm_TotalEdit.aspx?Type=2&Id=" + this.Id, "结算方式确认") + ";return false"; this.tb_Cust_Name.Enabled = false; this.tb_SBill_Code2.Enabled = false; SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_CBB_SUser_Id.DataSource = dtUser; this.ddl_CBB_SUser_Id.DataBind(); this.ddl_CBB_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); SupplierOp supplierManager = new SupplierOp(); //结算方式 this.ddl_CBB_PayType.DataSource = LinkService.GetPayType(); this.ddl_CBB_PayType.DataBind(); this.ddl_CBB_PayType.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 //this.ddl_SBill_State.DataSource = LinkService.GetSBill_State(); //this.ddl_SBill_State.DataBind(); //this.ddl_SBill_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //账户 AccountListOp AccountManager = new AccountListOp(); DataTable dtAccountList = AccountManager.GetList(""); this.ddl_CBB_AList_Id.DataSource = dtAccountList; this.ddl_CBB_AList_Id.DataBind(); this.ddl_CBB_AList_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { SModel.CBB_Id = Id; dtDetail = Manager.GetDetail(SModel); this.tb_CBB_Code.Text = SModel.CBB_Code; if (SModel.CBB_State == 1) { this.tb_CBB_State.Text = "<span style='color:Green;font-weight:bold;'>已结算</span>"; } else this.tb_CBB_State.Text = "<span style='color:Red;font-weight:bold;'>未结算</span>"; if (SModel.CBB_Input == 1) { this.tb_CBB_Input.Text = "<span style='color:Green;font-weight:bold;'>已入库</span>"; } else this.tb_CBB_Input.Text = "<span style='color:Red;font-weight:bold;'>未入库</span>"; this.tb_CBB_Code.Text = SModel.CBB_Code; this.tb_CBB_Date.Text = SModel.CBB_Date.ToString("yyyy-MM-dd"); this.tb_CBB_Reason.Text = SModel.CBB_Reason; this.tb_CBB_Money.Text = SModel.CBB_Money.ToString(); this.ddl_CBB_SUser_Id.SelectedValue = SModel.CBB_SUser_Id.ToString(); this.ddl_CBB_AList_Id.SelectedValue = SModel.CBB_AList_Id.ToString(); this.ddl_CBB_PayType.SelectedValue = SModel.CBB_PayType.ToString(); this.hf_SBill_Code.Text = SModel.CBB_SBill_Id.ToString(); //Get SaleBillOrder Information By Id SaleBillOp saleManager = new SaleBillOp(); SaleBill SaleSM = new SaleBill(); SaleSM.SBill_Id = SModel.CBB_SBill_Id; saleManager.GetModel(SaleSM); tb_SBill_Code2.Text = SaleSM.SBill_Code2; tb_SBill_RealMoney.Text = SaleSM.SBill_RealMoney.ToString(); tb_SBill_Code.Text = SaleSM.SBill_Code; //Get Customer Information By Id CustomerOp custManager = new CustomerOp(); Customer custSM = new Customer(); custSM.Cust_Id = SaleSM.SBill_Cust_Id; custManager.GetModel(custSM); this.tb_Cust_Name.Text = custSM.Cust_Name; gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; if (Id != 0) { //已结算 if (SModel.CBB_State == 1) { bnSave.Enabled = false; bnInput.Enabled = false; btnAdd.Enabled = false; //this.bnImport.Enabled = false; this.bn_Total.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[6].Hidden = true; //gv_List.Columns[8].Hidden = true; } else//未结算 { //未入库 if (SModel.CBB_Input == 0) { bnSave.Enabled = true; bnInput.Enabled = true; //this.bnImport.Enabled = true; this.bn_Total.Enabled = false; } else//已入库 { this.bnSave.Enabled = false; bnInput.Enabled = false; btnAdd.Enabled = false; //this.bnImport.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[6].Hidden = true; //gv_List.Columns[8].Hidden = true; } } } else { this.tb_CBB_Code.Text = Coder.CreateCoder(EMenuList.退货管理); //this.bnImport.Enabled = false; this.bnInput.Enabled = false; this.bn_Total.Enabled = false; tb_CBB_Date.Text = ValueHandler.GetStringValue(System.DateTime.Now.ToString("yyyy-MM-dd")); this.ddl_CBB_SUser_Id.SelectedValue = LinkService.GetCurrentUser().SUser_Id.ToString(); } //this.bnImport.ToolTip = "只有在编辑状态下才可导入!"; this.bnInput.ToolTip = "只有在编辑状态下才可入库!"; this.bnSave.ToolTip = "只有未入库的才可保存!"; this.bn_Total.ToolTip = "只有入库的退货单才可结算!"; } private void GetSaleBillDetail() { SaleBillOp saleManager = new SaleBillOp(); SaleBill SaleSM = new SaleBill(); SaleSM.SBill_Id = ValueHandler.GetIntNumberValue( this.hf_SBill_Code.Text); DataTable dt= saleManager.GetDetail(SaleSM); DataTable dtThis = dtDetail; dtThis.Rows.Clear(); dtThis.AcceptChanges(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dtThis.NewRow(); dr["PInfo_Code"] = dt.Rows[i]["PInfo_Code"]; dr["PInfo_Name"] = dt.Rows[i]["PInfo_Name"]; dr["PSort_Name"] = dt.Rows[i]["PSort_Name"]; dr["CBBDeta_PInfo_Id"] = dt.Rows[i]["SBDeta_PInfo_Id"]; dr["CBBDeta_CBB_Id"] = this.Id; dr["CBBDeta_Count"] = dt.Rows[i]["SBDeta_Count"]; dr["CBBDeta_Price"] = dt.Rows[i]["SBDeta_Price"]; dr["CBBDeta_Money"] = dt.Rows[i]["SBDeta_Money"]; dr["CBBDeta_Memo"] = dt.Rows[i]["SBDeta_Memo"]; dtThis.Rows.Add(dr); } this.gv_List.DataSource = dtThis; this.gv_List.DataBind(); this.gv_List.RecordCount = dtThis.Rows.Count; this.tb_CBB_Money.Text = SaleSM.SBill_RealMoney.ToString(); this.tb_SBill_Code2.Text = SaleSM.SBill_Code2; this.tb_SBill_RealMoney.Text = SaleSM.SBill_RealMoney.ToString(); CustomerOp customerManager = new CustomerOp(); Customer cust = new Customer(); cust.Cust_Id = SaleSM.SBill_Cust_Id; customerManager.GetModel(cust); this.tb_Cust_Name.Text = cust.Cust_Name; } #endregion #region Property ClientBackBillOp Manager = new ClientBackBillOp(); new Sale_Model.ClientBackBill SModel = new Sale_Model.ClientBackBill(); public DataTable dtDetail { get { return ViewState["dtDetail"] as DataTable; } set { ViewState["dtDetail"] = value; } } /// <summary> /// 子表当前编辑的关键子 /// </summary> public int CBBDeta_Id { get { return ValueHandler.GetIntNumberValue(ViewState["CBBDeta_Id"]); } set { ViewState["CBBDeta_Id"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_ClientBackBillEdit.aspx.cs
C#
asf20
22,636
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_BuyEdit.aspx.cs" Inherits="SaleSystem.Business.frm_BuyEdit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnImport" Icon="TableEdit" Text="导入" > </ext:Button> <ext:Button runat="server" ID="bnInput" Text="入库" Icon="PackageIn" ConfirmIcon="Warning" ConfirmText="进货单入库后,则不能修改,请确认保存数据再入库,确认入库?" ConfirmTitle="入库确认" OnClick="bnInput_Click"></ext:Button> <ext:Button runat="server" ID="bn_Total" Icon="Coins" Text="结算" OnClick="bn_Total_Click"> </ext:Button> <ext:Button runat="server" ID="bnClose" Icon="SystemClose" Text="关闭"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <ext:Form runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="false" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" BodyPadding="5px" AutoWidth="true" > <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_BBill_Code" Label="进货单号" Width="200px" Required="true" ShowRedStar="true" MaxLength="100" TabIndex="1"></ext:TextBox> <ext:DropDownList runat="server" ID="ddl_BBill_Supp_Id" Label="供应商" Width="200px" CompareValue="-1" CompareOperator="NotEqual" DataValueField="Supp_Id" DataTextField="Supp_Name" Required="true" ShowRedStar="true" TabIndex="2"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DatePicker runat="server" ID="tb_BBill_Date" Label="进货日期" Width="200px" Required="true" ShowRedStar="true" TabIndex="3"></ext:DatePicker> <ext:DropDownList runat="server" ID="ddl_BBill_SUser_Id" Label="经办人" Width="200px" DataValueField="SUser_Id" DataTextField="SUser_Name" Required="true" ShowRedStar="true" CompareValue="-1" CompareOperator="NotEqual" TabIndex="4"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:Label runat="server" ID="tb_BBill_Input" Label="入库标志" Width="200px" EncodeText="false"></ext:Label> <ext:Label runat="server" ID="tb_BBill_State" Label="结算状态" Width="200px" EncodeText="false"></ext:Label> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form2" AutoHeight="true" AutoScroll="false" EnableBackgroundColor="true" EnableCollapse="true" ShowBorder="true" ShowHeader="true" BodyPadding="5px" Title="更多信息" AutoWidth="true" > <Rows> <ext:FormRow > <Items> <ext:DropDownList runat="server" ID="ddl_BBilll_PayType" Label="结算方式" Width="200px" DataValueField="Id" DataTextField="Name" OnSelectedIndexChanged="ddl_SBill_PayTypeSelectedChanged" AutoPostBack="true" TabIndex="5"></ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_BBill_AList_Id" Label="结算帐户" Width="200px" TabIndex="6" DataValueField="AList_Id" DataTextField="AccountInfo"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_BBill_Count" Label="数量" Enabled="false" Width="200px" MaxLength="100"></ext:TextBox> <ext:TextBox runat="server" ID="tb_BBill_Money" Label="总额" Enabled="false" Width="200px" MaxLength="100"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_BBill_Memo" Label="备注" MaxLength="200" Width="200px" TabIndex="7"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:SimpleForm ID="SimpleForm2" ShowBorder="true" ShowHeader="false" runat="server" BodyPadding="5px" EnableBackgroundColor="true" Title="新增产品" > <Toolbars> <ext:Toolbar ID="Toolbar2" runat="server"> <Items> <ext:Label ID="lblTitle1" runat="server" Text="新增产品" CssStyle="font-weight:bold;"> </ext:Label> <ext:ToolbarFill ID="ToolbarFill1" runat="server"> </ext:ToolbarFill> <ext:Button ID="btnAdd" Text="添加" runat="server" Icon="Add" OnClick="btnAdd_Click" ValidateForms="SimpleForm2"> </ext:Button> <ext:Button ID="btnCancle" Text="取消" runat="server" Icon="Cancel" Hidden="true" OnClick="btnCancel_Click"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:ContentPanel ID="ContentPanel2" runat="server" EnableBackgroundColor="true" ShowBorder="false" ShowHeader="false"> <table width="100%" border=0> <tr> <td width="300">产品名称</td> <td width="60">数量</td> <td width="60">单价</td> <td width="60" style="display:none">金额</td> <td width="60">零售价</td> </tr> <tr> <td> <ext:TriggerBox Width="300px" EnableEdit="false" runat="server" ID="tb_BBDeta_PInfo_Id" TriggerIcon="Search" EnablePostBack="false" Required="true" TabIndex="8"></ext:TriggerBox> <ext:HiddenField ID="hf_BBDeta_PInfo_Id" runat="server"> </ext:HiddenField> </td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_Count" Required="true" DecimalPrecision="0" TabIndex="9"></ext:NumberBox> </td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_CostPrice" Required="true" DecimalPrecision="0" TabIndex="10"></ext:NumberBox> </td> <td style="display:none"><ext:NumberBox runat="server" ID="nb_BBDeta_Money" Required="true" Enabled="false" DecimalPrecision="0" TabIndex="11"></ext:NumberBox> </td> <td><ext:NumberBox runat="server" ID="nb_BBDeta_Price" Required="true" DecimalPrecision="0" TabIndex="12"></ext:NumberBox> </td> </tr> </table> </ext:ContentPanel> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="进货单明细" DataKeyNames="BBDeta_Id,BBDeta_PInfo_Id,PInfo_Code" EnableRowNumber="true" IsDatabasePaging="true" AllowPaging="true" AutoHeight="true" OnRowCommand="gv_List_RowCommand" PageSize="10" OnPageIndexChange="gv_List_PageIndexChange" > <Columns> <ext:BoundField ColumnID="PInfo_Code" DataField="PInfo_Code" DataTooltipField="PInfo_Code" HeaderText="产品编码" Width="100px" /> <ext:BoundField ColumnID="PInfo_Name" DataField="PInfo_Name" DataTooltipField="PInfo_Name" HeaderText="产品名称" Width="100px"/> <ext:BoundField ColumnID="PSort_Name" DataField="PSort_Name" DataTooltipField="PSort_Name" HeaderText="产品类型" Width="100px"/> <ext:BoundField ColumnID="BBDeta_Count" DataField="BBDeta_Count" DataTooltipField="BBDeta_Count" HeaderText="数量" Width="50px"/> <ext:BoundField ColumnID="BBDeta_CostPrice" DataField="BBDeta_CostPrice" DataTooltipField="BBDeta_CostPrice" HeaderText="单价" Width="60px"/> <ext:BoundField ColumnID="BBDeta_Money" DataField="BBDeta_Money" DataTooltipField="BBDeta_Money" HeaderText="金额" Width="60px"/> <ext:BoundField ColumnID="BBDeta_Price" DataField="BBDeta_Price" DataTooltipField="BBDeta_Price" HeaderText="零售价" Width="60px"/> <ext:LinkButtonField ColumnID="eidt" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="选择产品" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="730px" Height="550px" EnableMaximize="true"></ext:Window> <ext:Window runat="server" ID="win_Import" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="进货单导入" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"> </ext:Window> <ext:Window runat="server" ID="win_Confirm" IsModal="true" EnableDrag="true" EnableClose="true" Height="250px" Width="400px" Hidden="true" Layout="Absolute" IFrameUrl="" EnableIFrame="true" > </ext:Window> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_BuyEdit.aspx
ASP.NET
asf20
11,256
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Business { public partial class frm_BuyList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_BuyEdit.aspx?Id=0", "新增进货单"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.BuyBill SM = new Sale_Model.BuyBill(); SM.BBill_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.BBill_Code = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); Manager.GetModel(SM); if (SM.BBill_Input == 1) { ExtAspNet.Alert.Show("该进货单已经入库,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_BuyEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { ExtAspNet.LinkButtonField lbfAction1 = gv_List.FindColumn("edit") as ExtAspNet.LinkButtonField; ExtAspNet.LinkButtonField lbfAction2 = gv_List.FindColumn("delete") as ExtAspNet.LinkButtonField; DataRowView row = e.DataItem as DataRowView; if (ValueHandler.GetIntNumberValue(row["BBill_Input"]) == 1) { // lbfAction1.Enabled = false; if (ValueHandler.GetIntNumberValue(row["BBill_State"]) == 1) { lbfAction1.Text = "查看"; } else { lbfAction1.Text = "结算"; } lbfAction2.Enabled = false; } else { lbfAction1.Text = "编辑"; lbfAction1.Enabled = true; lbfAction2.Enabled = true; } } #endregion #region Method private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (tb_BBill_Code.Text.Trim() != "") { strCondition += " BBill_Code LIKE '%"+ValueHandler.GetStringValue(tb_BBill_Code.Text , ValueHandler.CharHandlerType.IsRepChar)+"%' AND "; } if (ddl_BBill_Supp_Id.SelectedValue != "-1") { strCondition += " BBill_Supp_Id="+ddl_BBill_Supp_Id.SelectedValue+" AND "; } ///if (dp_BBill_Date1.Text.Trim() != "") ///{ /// DateTime d1 = DateTime.Now; /// if (DateTime.TryParse(dp_BBill_Date1.Text, out d1)) /// { /// strCondition += " BBill_Date >='" + dp_BBill_Date1.Text + "' AND "; /// } ///} if (dp_BBill_Date2.Text.Trim() != "") { DateTime d2 = DateTime.Now; if (DateTime.TryParse(dp_BBill_Date2.Text, out d2)) { strCondition += " BBill_Date <='" + dp_BBill_Date2.Text + "' AND "; } } if (nb_BBill_Money1.Text.Trim() != "") { strCondition += " BBill_Money >=" + nb_BBill_Money1.Text + " AND "; } if (nb_BBill_Money2.Text.Trim() != "") { strCondition += " BBill_Money <=" + nb_BBill_Money2.Text + " AND "; } if (ddl_BBill_SUser_Id.SelectedValue != "-1") { strCondition += " BBill_SUser_Id =" + ddl_BBill_SUser_Id.SelectedValue + " AND "; } if (ddl_BBill_Input.SelectedValue != "-1") { strCondition += " BBill_Input =" + ddl_BBill_Input.SelectedValue + " AND "; } if (ddl_BBill_State.SelectedValue != "-1") { strCondition += " BBill_State =" + ddl_BBill_State.SelectedValue + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } private void BindDropDownList() { SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_BBill_SUser_Id.DataSource = dtUser; this.ddl_BBill_SUser_Id.DataBind(); this.ddl_BBill_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); SupplierOp supplierManager = new SupplierOp(); DataTable dtSupplier = supplierManager.GetList(""); this.ddl_BBill_Supp_Id.DataSource = dtSupplier; this.ddl_BBill_Supp_Id.DataBind(); this.ddl_BBill_Supp_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } #endregion #region Property BuyBillOp Manager = new BuyBillOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_BuyList.aspx.cs
C#
asf20
7,430
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using System.Text; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.Business { public partial class frm_MyBackBillEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { tb_SBDeta_PInfo_Id.OnClientTriggerClick = win_Content2.GetSaveStateReference(tb_SBDeta_PInfo_Id.ClientID, this.hf_SBDeta_PInfo_Id.ClientID, this.nb_SBDeta_Count.ClientID, this.nb_SBDeta_Price.ClientID, this.nb_SBDeta_Money.ClientID, hf_SBDeta_Price.ClientID) + win_Content2.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id="); //tb_SBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_SBDeta_PInfo_Id.ClientID, this.hf_SBDeta_PInfo_Id.ClientID) // + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id=" + this.tb_SBDeta_PInfo_Id.GetValueReference()); InitControl(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == "bnTotal") { bn_Total_Click(null, null); } } protected void ddl_SBill_PayTypeSelectedChanged(object obj, EventArgs e) { SysConfig SM = new SysConfig(); if (this.ddl_MBB_PayType.SelectedValue == "1")//现金 { SM.SConf_Id = 4; } else SM.SConf_Id = 5; SysConfigOp op = new SysConfigOp(); op.GetConfig(SM); this.ddl_MBB_AList_Id.SelectedValue = SM.SConf_Value; } protected void bnSave_Click(object sender, EventArgs e) { //如果是修改,保存前先校验下该单据状态是否已经被入库了,如果入库了则不能修改 if (this.Id != 0) { SModel.MBB_Id = this.Id; Manager.GetModel(SModel); if (SModel.MBB_State == 1) { ExtAspNet.Alert.Show("该返货单已经结算,不能修改!", "操作提示!", MessageBoxIcon.Warning); return; } } bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.ShowInTop("返货单编码已经存在,请重新输入!", MessageBoxIcon.Information); } else { SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.MBB_AList_Id = ValueHandler.GetIntNumberValue(this.ddl_MBB_AList_Id.SelectedValue); SModel.MBB_Code = this.tb_MBB_Code.Text; SModel.MBB_Date = DateTime.Parse(this.dp_MBB_Date.Text); SModel.MBB_Money = ValueHandler.GetDecNumberValue(this.nb_MBB_Money.Text); SModel.MBB_PayType = ValueHandler.GetIntNumberValue(this.ddl_MBB_PayType.SelectedValue); SModel.MBB_Output = 0; SModel.MBB_State = 0; SModel.MBB_Reason = this.tb_MBB_Reason.Text; SModel.MBB_SUser_Id = ValueHandler.GetIntNumberValue(this.ddl_MBB_SUser_Id.SelectedValue); SModel.MBB_Supp_Id = ValueHandler.GetIntNumberValue(this.ddl_MBB_Supp_Id.SelectedValue); bool blRes = Manager.Save(SModel, dtDetail); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.ShowInTop("返货单信息编辑失败!", MessageBoxIcon.Error); } } /// <summary> /// 添加产品明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (hf_SBDeta_PInfo_Id.Text.Trim() == "") { ExtAspNet.Alert.Show("请先选中产品后再做此操作!", "提示!", MessageBoxIcon.Warning); return; } else { DataTable dt = dtDetail; ProductInfoOp ProductManager = new ProductInfoOp(); ProductInfo SM = new ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(hf_SBDeta_PInfo_Id.Text); //判断单据中是否存在该产品 DataView dv = new DataView(dt); dv.RowFilter = "MBBDeta_PInfo_Id=" + SM.PInfo_Id.ToString() + " AND MBBDeta_Id<>" + SBDeta_Id; if (dv.Count > 0) { ExtAspNet.Alert.Show("单据中已经存在该产品信息!", "提示!", MessageBoxIcon.Warning); return; } DataRow dr = null; if (this.btnAdd.Text == "添加") { dr = dt.NewRow(); dt.Rows.Add(dr); } else { DataView dv0 = new DataView(dt); dv0.RowFilter = "MBBDeta_Id=" + SBDeta_Id; if (dv0.Count > 0) dr = dv0[0].Row; } ProductManager.GetModel(SM); dr["PInfo_Code"] = SM.PInfo_Code; dr["PInfo_Name"] = SM.PInfo_Name; dr["MBBDeta_PInfo_Id"] = this.hf_SBDeta_PInfo_Id.Text; dr["MBBDeta_MBB_Id"] = this.Id; dr["MBBDeta_Count"] = ValueHandler.GetIntNumberValue(this.nb_SBDeta_Count.Text); dr["MBBDeta_Price"] = ValueHandler.GetDecNumberValue(this.nb_SBDeta_Price.Text); dr["MBBDeta_Money"] = ValueHandler.GetDecNumberValue(this.nb_SBDeta_Price.Text) * ValueHandler.GetDecNumberValue(this.nb_SBDeta_Count.Text); //获取产品类别 ProductSortOp sortManager = new ProductSortOp(); ProductSort sortSM = new ProductSort(); sortSM.PSort_ID = SM.PInfo_PSort_ID; sortManager.GetModelById(sortSM); dr["PSort_Name"] = sortSM.PSort_Name; gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 this.nb_MBB_Money.Text = ValueHandler.GetDecNumberValue(dtDetail.Compute("sum(MBBDeta_Money)", "")).ToString(); ClearContent(); } } /// <summary> /// 结算 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bn_Total_Click(object sender, EventArgs e) { SModel.MBB_Id = this.Id; Manager.GetModel(SModel); if (SModel.MBB_State == 1) { ExtAspNet.Alert.Show("该返货单已经结算,不能再次结算!", "操作提示!", MessageBoxIcon.Warning); } else { bool blRes = Manager.JS(SModel); if (blRes) { PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("结算完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else { ExtAspNet.Alert.Show("结算失败!", "操作提示!", MessageBoxIcon.Error); } } } protected void btnCancel_Click(object sender, EventArgs e) { ClearContent(); } private void ClearContent() { this.tb_SBDeta_PInfo_Id.Text = ""; this.hf_SBDeta_PInfo_Id.Text = ""; this.nb_SBDeta_Count.Text = "1"; this.nb_SBDeta_Money.Text = ""; this.nb_SBDeta_Price.Text = ""; SBDeta_Id = 0; this.btnAdd.Text = "添加"; this.btnAdd.Icon = Icon.Add; this.btnCancle.Hidden = true; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { DataView dv = new DataView(dtDetail); SBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "MBBDeta_Id=" + SBDeta_Id; if (dv.Count > 0) { dv[0].Delete(); } dtDetail.AcceptChanges(); gv_List.DataSource = dtDetail.DefaultView; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 this.nb_MBB_Money.Text = ValueHandler.GetDecNumberValue(dtDetail.Compute("sum(MBBDeta_Money)", "")).ToString(); ClearContent(); } else if (e.CommandName.ToLower() == "edit") { DataView dv = new DataView(dtDetail); SBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "MBBDeta_Id=" + SBDeta_Id; if (dv.Count > 0) { this.tb_SBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["PInfo_Name"]); this.hf_SBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["MBBDeta_PInfo_Id"]); this.nb_SBDeta_Count.Text = ValueHandler.GetIntNumberValue(dv[0]["MBBDeta_Count"]).ToString(); this.nb_SBDeta_Money.Text = ValueHandler.GetDecNumberValue(dv[0]["MBBDeta_Money"]).ToString(); this.nb_SBDeta_Price.Text = ValueHandler.GetDecNumberValue(dv[0]["MBBDeta_Price"]).ToString(); this.btnAdd.Icon = Icon.Accept; this.btnAdd.Text = "确定"; this.btnCancle.Hidden = false; } } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } /// <summary> /// 出库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void bnOutput_Click(object sender, EventArgs e) { SModel.MBB_Id = this.Id; DataTable dt = Manager.GetDetail(SModel); if (SModel.MBB_Output == 1) { ExtAspNet.Alert.Show("该返货单已经出库,不能再次出库!", "操作提示!", MessageBoxIcon.Warning); } //else if (SModel.MBB_PayType == -1) //{ // ExtAspNet.Alert.Show("该单据结算方式并未保存,请保存后再出库!", "操作提示!", MessageBoxIcon.Warning); // return; //} //else if (SModel.MBB_AList_Id == 0 || SModel.MBB_AList_Id == -1) //{ // ExtAspNet.Alert.Show("该单据结算账户并未保存,请保存后再出库!", "操作提示!", MessageBoxIcon.Warning); // return; //} List<String> LSCheckProduct = Manager.CheckStore(SModel, dt); if (LSCheckProduct.Count <= 0) { bool blRes = Manager.PutOut(SModel,dt); if (blRes) { ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else { ExtAspNet.Alert.Show("返货单出库失败!", MessageBoxIcon.Error); } } else //库存不满足 { StringBuilder sbSql = new StringBuilder(); for (int i = 0; i < LSCheckProduct.Count; i++) { if (i == LSCheckProduct.Count - 1) sbSql.Append(LSCheckProduct[i]); else sbSql.Append(LSCheckProduct[i] + ","); } ExtAspNet.Alert.ShowInTop("产品:" + sbSql.ToString() + "库存不足,无法出库返货单!", MessageBoxIcon.Error); } } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } bnInput.OnClientClick = win_Confirm.GetShowReference("~/Other/frm_TotalEdit.aspx?Type=3&Id=" + this.Id, "结算方式确认") + ";return false"; //经办人 SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_MBB_SUser_Id.DataSource = dtUser; this.ddl_MBB_SUser_Id.DataBind(); this.ddl_MBB_SUser_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); this.ddl_MBB_SUser_Id.SelectedValue = LinkService.GetCurrentUser().SUser_Id.ToString(); SupplierOp supplierManager = new SupplierOp(); DataTable dtSupplier = supplierManager.GetList(""); this.ddl_MBB_Supp_Id.DataSource = dtSupplier; this.ddl_MBB_Supp_Id.DataBind(); this.ddl_MBB_Supp_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算方式 this.ddl_MBB_PayType.DataSource = LinkService.GetPayType(); this.ddl_MBB_PayType.DataBind(); this.ddl_MBB_PayType.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 //this.ddl_SBill_State.DataSource = LinkService.GetSBill_State(); //this.ddl_SBill_State.DataBind(); //this.ddl_SBill_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //账户 AccountListOp AccountManager = new AccountListOp(); DataTable dtAccountList = AccountManager.GetList(""); this.ddl_MBB_AList_Id.DataSource = dtAccountList; this.ddl_MBB_AList_Id.DataBind(); this.ddl_MBB_AList_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); this.dp_MBB_Date.Text = System.DateTime.Now.ToString("yyyy-MM-dd"); } private void GetAndBind() { SModel.MBB_Id = Id; dtDetail = Manager.GetDetail(SModel); gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; if (Id != 0) { this.tb_MBB_Code.Text = SModel.MBB_Code; this.tb_MBB_Reason.Text = SModel.MBB_Reason; this.ddl_MBB_AList_Id.SelectedValue = SModel.MBB_AList_Id.ToString(); this.ddl_MBB_PayType.SelectedValue = SModel.MBB_PayType.ToString(); this.ddl_MBB_SUser_Id.SelectedValue = SModel.MBB_SUser_Id.ToString(); this.ddl_MBB_Supp_Id.SelectedValue = SModel.MBB_Supp_Id.ToString(); this.dp_MBB_Date.Text = SModel.MBB_Date.ToString("yyyy-MM-dd"); this.nb_MBB_Money.Text = SModel.MBB_Money.ToString(); //未出库 if (SModel.MBB_Output == 0) { bnSave.Enabled = true; bnInput.Enabled = false; bnOutput.Enabled = true; lb_MBB_Output.Text = "<span style='color:Red;font-weight:bold;'>未出库</span>"; } else//已出库 { bnSave.Enabled = false; bnInput.Enabled = true; bnOutput.Enabled = false; btnAdd.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[6].Hidden = true; gv_List.Columns[7].Hidden = true; lb_MBB_Output.Text = "<span style='color:Green;font-weight:bold;'>已出库</span>"; } if (SModel.MBB_State == 1) { bnSave.Enabled = false; bnInput.Enabled = false; bnOutput.Enabled = false; btnAdd.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[6].Hidden = true; gv_List.Columns[7].Hidden = true; this.lb_MBB_State.Text = "<span style='color:Green;font-weight:bold;'>已结算</span>"; } else this.lb_MBB_State.Text = "<span style='color:Red;font-weight:bold;'>未结算</span>"; } else { this.tb_MBB_Code.Text = Coder.CreateCoder(EMenuList.返货管理); this.bnInput.Enabled = false; bnOutput.Enabled = false; lb_MBB_Output.Text = "<span style='color:Red;font-weight:bold;'>未出库</span>"; this.lb_MBB_State.Text = "<span style='color:Red;font-weight:bold;'>未结算</span>"; } this.bnInput.ToolTip = "只有入库状态下才可结算!"; this.bnSave.ToolTip = "只有未入库的才可保存!"; this.bnOutput.ToolTip = "只有未出库状态下才可出库!"; } #endregion #region Property MyBackBillOp Manager = new MyBackBillOp(); new Sale_Model.MyBackBill SModel = new Sale_Model.MyBackBill(); public DataTable dtDetail { get { return ViewState["dtDetail"] as DataTable; } set { ViewState["dtDetail"] = value; } } /// <summary> /// 子表当前编辑的关键子 /// </summary> public int SBDeta_Id { get { return ValueHandler.GetIntNumberValue(ViewState["SBDeta_Id"]); } set { ViewState["SBDeta_Id"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_MyBackBillEdit.aspx.cs
C#
asf20
19,662
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using System.Text; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.Business { public partial class frm_SaleBillEdit : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { tb_SBill_Cust_Id.OnClientTrigger2Click = win_Content.GetSaveStateReference(tb_SBill_Cust_Id.ClientID, this.hf_SBill_Cust_Id.ClientID) + win_Content.GetShowReference("~/ComPage/frm_CustomerChooseList.aspx"); tb_SBDeta_PInfo_Id.OnClientTriggerClick = win_Content2.GetSaveStateReference(tb_SBDeta_PInfo_Id.ClientID, this.hf_SBDeta_PInfo_Id.ClientID, this.nb_SBDeta_Count.ClientID, this.nb_SBDeta_Price.ClientID, this.nb_SBDeta_Money.ClientID, this.nb_SBDeta_Price.ClientID) + win_Content2.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id="); //tb_SBDeta_PInfo_Id.OnClientTriggerClick = win_Content.GetSaveStateReference(tb_SBDeta_PInfo_Id.ClientID, this.hf_SBDeta_PInfo_Id.ClientID) // + win_Content.GetShowReference("~/ComPage/frm_ProductChooseList.aspx?PInfo_Id=" + this.tb_SBDeta_PInfo_Id.GetValueReference()); InitControl(); GetAndBind(); } } protected void ddl_SBill_PayTypeSelectedChanged(object obj, EventArgs e) { SysConfig SM = new SysConfig(); if (this.ddl_SBill_PayType.SelectedValue == "1")//现金 { SM.SConf_Id = 4; } else SM.SConf_Id = 5; SysConfigOp op = new SysConfigOp(); op.GetConfig(SM); this.ddl_SBill_AList_Id.SelectedValue = SM.SConf_Value; } protected void nb_SBill_TaxMoney_TextChanged(object sender, EventArgs e) { this.nb_SBill_RealMoney.Text = (ValueHandler.GetDecNumberValue(this.nb_SBill_Money.Text) + ValueHandler.GetDecNumberValue(this.nb_SBill_TaxMoney.Text)).ToString(); } protected void Trigger1_Click(object sender, EventArgs e) { tb_SBill_Cust_Id.Text = ""; hf_SBill_Cust_Id.Text = ""; } protected void bnSave_Click(object sender, EventArgs e) { //如果是修改,保存前先校验下该单据状态是否已经被入库了,如果入库了则不能修改 if (this.Id != 0) { SModel.SBill_Id = this.Id; Manager.GetModel(SModel); if (SModel.SBill_State == 1) { ExtAspNet.Alert.Show("该销售单已经结算,不能修改!", "操作提示!", MessageBoxIcon.Warning); return; } } bool blHasExists = Manager.HasExists(SModel); if (blHasExists) { ExtAspNet.Alert.ShowInTop("销售单编码已经存在,请重新输入!", MessageBoxIcon.Information); } else { List<String> LSCheckProduct = Manager.CheckStore(SModel, dtDetail); if (LSCheckProduct.Count <= 0) { SModel.CreateMan = LinkService.GetCurrentUser().SUser_Id; SModel.CreateTime = System.DateTime.Now; SModel.State = 1; SModel.SBill_AList_Id = ValueHandler.GetIntNumberValue(this.ddl_SBill_AList_Id.SelectedValue); SModel.SBill_Code = this.tb_SBill_Code.Text; SModel.SBill_Code2 = this.tb_SBill_Code2.Text; SModel.SBill_Cust_Id = ValueHandler.GetIntNumberValue(this.hf_SBill_Cust_Id.Text); SModel.SBill_Date = DateTime.Parse(this.dp_SBill_Date.Text); SModel.SBill_Money = ValueHandler.GetDecNumberValue(this.nb_SBill_Money.Text); SModel.SBill_PayType = ValueHandler.GetIntNumberValue(this.ddl_SBill_PayType.SelectedValue); SModel.SBill_RealMoney = ValueHandler.GetDecNumberValue(this.nb_SBill_Money.Text) + ValueHandler.GetDecNumberValue(this.nb_SBill_TaxMoney.Text); SModel.SBill_Remark = this.tb_SBill_Remark.Text; SModel.SBill_Type = ValueHandler.GetIntNumberValue(this.ddl_SBill_Type.SelectedValue); SModel.SBill_User = ValueHandler.GetIntNumberValue(this.ddl_SBill_User.SelectedValue); SModel.State = 1; SModel.SBill_TaxMoney = ValueHandler.GetDecNumberValue(this.nb_SBill_TaxMoney.Text); bool blRes = Manager.Save(SModel, dtDetail); if (blRes) ExtAspNet.PageContext.RegisterStartupScript(ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); else ExtAspNet.Alert.ShowInTop("销售单信息编辑失败!", MessageBoxIcon.Error); } else //库存不满足 { StringBuilder sbSql = new StringBuilder(); for (int i = 0; i < LSCheckProduct.Count; i++) { if(i==LSCheckProduct.Count-1) sbSql.Append(LSCheckProduct[i]); else sbSql.Append(LSCheckProduct[i]+","); } ExtAspNet.Alert.ShowInTop("产品:" + sbSql.ToString() + "库存不足,无法创建销售单!", MessageBoxIcon.Error); } } } /// <summary> /// 添加产品明细 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { if (hf_SBDeta_PInfo_Id.Text.Trim() == "") { ExtAspNet.Alert.Show("请先选中产品后再做此操作!", "提示!", MessageBoxIcon.Warning); return; } else { DataTable dt = dtDetail; ProductInfoOp ProductManager = new ProductInfoOp(); ProductInfo SM = new ProductInfo(); SM.PInfo_Id = ValueHandler.GetIntNumberValue(hf_SBDeta_PInfo_Id.Text); //判断单据中是否存在该产品 DataView dv = new DataView(dt); dv.RowFilter = "SBDeta_PInfo_Id=" + SM.PInfo_Id.ToString() + " AND SBDeta_Id<>" + SBDeta_Id; if (dv.Count > 0) { ExtAspNet.Alert.Show("单据中已经存在该产品信息!", "提示!", MessageBoxIcon.Warning); return; } DataRow dr = null; if (this.btnAdd.Text == "添加") { dr = dt.NewRow(); dt.Rows.Add(dr); } else { DataView dv0 = new DataView(dt); dv0.RowFilter = "SBDeta_Id=" + SBDeta_Id; if (dv0.Count > 0) dr = dv0[0].Row; } ProductManager.GetModel(SM); dr["PInfo_Code"] = SM.PInfo_Code; dr["PInfo_Name"] = SM.PInfo_Name; dr["SBDeta_PInfo_Id"] = this.hf_SBDeta_PInfo_Id.Text; dr["SBDeta_SBill_Id"] = this.Id; dr["SBDeta_Count"] = ValueHandler.GetIntNumberValue(this.nb_SBDeta_Count.Text); dr["SBDeta_Price"] = ValueHandler.GetDecNumberValue(this.nb_SBDeta_Price.Text); dr["SBDeta_Money"] = ValueHandler.GetDecNumberValue(this.nb_SBDeta_Price.Text) * ValueHandler.GetDecNumberValue(this.nb_SBDeta_Count.Text); //获取产品类别 ProductSortOp sortManager = new ProductSortOp(); ProductSort sortSM = new ProductSort(); sortSM.PSort_ID = SM.PInfo_PSort_ID; sortManager.GetModelById(sortSM); dr["PSort_Name"] = sortSM.PSort_Name; gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 this.nb_SBill_Money.Text = dtDetail.Compute("sum(SBDeta_Money)", "").ToString(); this.nb_SBill_RealMoney.Text=(ValueHandler.GetDecNumberValue(this.nb_SBill_Money.Text)+ValueHandler.GetDecNumberValue(this.nb_SBill_TaxMoney.Text)).ToString(); ClearContent(); } } protected void bnInput_Click(object sender, EventArgs e) { SModel.SBill_Id = this.Id; Manager.GetModel(SModel); if (SModel.SBill_PayType ==-1) { ExtAspNet.Alert.Show("该单据结算方式并未保存,请保存后再结算!", "操作提示!", MessageBoxIcon.Warning); return; } if (SModel.SBill_AList_Id == 0 || SModel.SBill_AList_Id == -1) { ExtAspNet.Alert.Show("该单据结算账户并未保存,请保存后再结算!", "操作提示!", MessageBoxIcon.Warning); return; } if (SModel.SBill_State == 1) { ExtAspNet.Alert.Show("该销售单已经结算,不能再次结算!", "操作提示!", MessageBoxIcon.Warning); } else { bool blRes = Manager.JS(SModel); if (blRes) { PageContext.RegisterStartupScript(ExtAspNet.Alert.GetShowInTopReference("结算完成!", "操作提示!", MessageBoxIcon.Information) + ExtAspNet.ActiveWindow.GetHidePostBackReference(LinkService.RefreshString)); } else { ExtAspNet.Alert.Show("结算失败!","操作提示!", MessageBoxIcon.Error); } } } protected void btnCancel_Click(object sender, EventArgs e) { ClearContent(); } private void ClearContent() { this.tb_SBDeta_PInfo_Id.Text = ""; this.hf_SBDeta_PInfo_Id.Text = ""; this.nb_SBDeta_Count.Text = "1"; this.nb_SBDeta_Money.Text = ""; this.nb_SBDeta_Price.Text = ""; SBDeta_Id = 0; this.btnAdd.Text = "添加"; this.btnAdd.Icon = Icon.Add; this.btnCancle.Hidden = true; } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { DataView dv = new DataView(dtDetail); SBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "SBDeta_Id=" + SBDeta_Id; if (dv.Count > 0) { dv[0].Delete(); } dtDetail.AcceptChanges(); gv_List.DataSource = dtDetail.DefaultView; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; //计算总数量及总金额 ClearContent(); } else if (e.CommandName.ToLower() == "edit") { DataView dv = new DataView(dtDetail); SBDeta_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); dv.RowFilter = "SBDeta_Id=" + SBDeta_Id; if (dv.Count > 0) { this.tb_SBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["PInfo_Name"]); this.hf_SBDeta_PInfo_Id.Text = ValueHandler.GetStringValue(dv[0]["SBDeta_PInfo_Id"]); this.nb_SBDeta_Count.Text = ValueHandler.GetIntNumberValue(dv[0]["SBDeta_Count"]).ToString(); this.nb_SBDeta_Money.Text = ValueHandler.GetDecNumberValue(dv[0]["SBDeta_Money"]).ToString(); this.nb_SBDeta_Price.Text = ValueHandler.GetDecNumberValue(dv[0]["SBDeta_Price"]).ToString(); this.btnAdd.Icon = Icon.Accept; this.btnAdd.Text = "确定"; this.btnCancle.Hidden = false; } } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } #endregion #region Method private void InitControl() { bnClose.OnClientClick = ExtAspNet.ActiveWindow.GetHideReference(); if (Request["Id"] != null) { Id = ValueHandler.GetIntNumberValue(Request["Id"]); } //经办人 SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_SBill_User.DataSource = dtUser; this.ddl_SBill_User.DataBind(); this.ddl_SBill_User.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //销售单类型 BaseDataOp BaseManager = new BaseDataOp(); DataTable dtList1 = BaseManager.GetList("BData_Type=4"); this.ddl_SBill_Type.DataSource = dtList1; this.ddl_SBill_Type.DataBind(); this.ddl_SBill_Type.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算方式 this.ddl_SBill_PayType.DataSource = LinkService.GetPayType(); this.ddl_SBill_PayType.DataBind(); this.ddl_SBill_PayType.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //结算状态 //this.ddl_SBill_State.DataSource = LinkService.GetSBill_State(); //this.ddl_SBill_State.DataBind(); //this.ddl_SBill_State.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); //账户 AccountListOp AccountManager = new AccountListOp(); DataTable dtAccountList= AccountManager.GetList(""); this.ddl_SBill_AList_Id.DataSource = dtAccountList; this.ddl_SBill_AList_Id.DataBind(); this.ddl_SBill_AList_Id.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { SModel.SBill_Id = Id; dtDetail = Manager.GetDetail(SModel); gv_List.DataSource = dtDetail; gv_List.DataBind(); gv_List.RecordCount = dtDetail.Rows.Count; if (Id != 0) { this.tb_SBill_Code.Text = SModel.SBill_Code; this.tb_SBill_Code2.Text = SModel.SBill_Code2; CustomerOp customerManager = new CustomerOp(); Customer cust = new Customer(); cust.Cust_Id = SModel.SBill_Cust_Id; customerManager.GetModel(cust); this.tb_SBill_Cust_Id.Text = cust.Cust_Name ; this.hf_SBill_Cust_Id.Text = SModel.SBill_Cust_Id.ToString(); this.tb_SBill_Remark.Text = SModel.SBill_Remark; this.ddl_SBill_AList_Id.SelectedValue = SModel.SBill_AList_Id.ToString(); this.ddl_SBill_PayType.SelectedValue = SModel.SBill_PayType.ToString(); this.ddl_SBill_Type.SelectedValue = SModel.SBill_Type.ToString(); this.ddl_SBill_User.SelectedValue = SModel.SBill_User.ToString(); this.dp_SBill_Date.Text = SModel.SBill_Date.ToString("yyyy-MM-dd"); this.nb_SBill_Money.Text = SModel.SBill_Money.ToString(); this.nb_SBill_RealMoney.Text = SModel.SBill_RealMoney.ToString(); this.nb_SBill_TaxMoney.Text = SModel.SBill_TaxMoney.ToString(); //未结算 if (SModel.SBill_State == 0) { bnSave.Enabled = true; bnInput.Enabled = true; } else//已入库 { bnSave.Enabled = false; bnInput.Enabled = false; btnAdd.Enabled = false; SimpleForm2.Hidden = true; gv_List.Columns[6].Hidden = true; gv_List.Columns[7].Hidden = true; } if (SModel.SBill_State == 1) { this.lb_SBill_State.Text = "<span style='color:Green;font-weight:bold;'>已结算</span>"; this.bnSave.Enabled = false; } else this.lb_SBill_State.Text = "<span style='color:Red;font-weight:bold;'>未结算</span>"; } else { this.tb_SBill_Code.Text = Coder.CreateCoder(EMenuList.销售管理); this.bnInput.Enabled = false; } } #endregion #region Property SaleBillOp Manager = new SaleBillOp(); new Sale_Model.SaleBill SModel = new Sale_Model.SaleBill(); public DataTable dtDetail { get { return ViewState["dtDetail"] as DataTable; } set { ViewState["dtDetail"] = value; } } /// <summary> /// 子表当前编辑的关键子 /// </summary> public int SBDeta_Id { get { return ValueHandler.GetIntNumberValue(ViewState["SBDeta_Id"]); } set { ViewState["SBDeta_Id"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_SaleBillEdit.aspx.cs
C#
asf20
18,840
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_MyBackBillList.aspx.cs" Inherits="SaleSystem.Business.frm_MyBackBillList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head id="Head1" runat="server"> <title>进货管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false" > <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_MBB_Code" Label="返货单号" Width="200px" TabIndex="1"></ext:TextBox> <ext:DropDownList runat="server" ID="ddl_MBB_Supp_Id" Label="供应商" Width="200px" DataValueField="Supp_Id" DataTextField="Supp_Name" TabIndex="2"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DatePicker runat="server" ID="dp_MBB_Date1" Label="返货日期>=" Width="200px" TabIndex="3"></ext:DatePicker> <ext:DatePicker runat="server" ID="dp_MBB_Date2" Label="返货日期<=" Width="200px" TabIndex="4"></ext:DatePicker> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:NumberBox runat="server" ID="nb_MBB_Money1" Label="总额>=" Width="200px" TabIndex="5"></ext:NumberBox> <ext:NumberBox runat="server" ID="nb_MBB_Money2" Label="总额<=" Width="200px" TabIndex="6"></ext:NumberBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_MBB_Output" Label="出库状态" Width="200px" TabIndex="8"> <ext:ListItem Text="-未选择-" Value="-1" Selected="true" /> <ext:ListItem Text="未出库" Value="0" /> <ext:ListItem Text="已出库" Value="1" /> </ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_MBB_State" Label="结算状态" Width="200px" TabIndex="8"> <ext:ListItem Text="-未选择-" Value="-1" Selected="true" /> <ext:ListItem Text="未结算" Value="0" /> <ext:ListItem Text="已结算" Value="1" /> </ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_MBB_SUser_Id" Label="经办人" Width="200px" DataValueField="SUser_Id" DataTextField="SUser_Name" TabIndex="7"></ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="返货单列表" IsDatabasePaging="true" DataKeyNames="MBB_Id,MBB_Code" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" AutoHeight="true" OnPreRowDataBound="gv_List_PreRowDataBound"> <Columns> <ext:BoundField ColumnID="MBB_Code" DataField="MBB_Code" DataTooltipField="MBB_Code" HeaderText="返货单号" Width="100px" /> <ext:BoundField ColumnID="BBill_Supp_Id" DataField="Supp_Name" DataTooltipField="Supp_Name" HeaderText="供应商" Width="150px"/> <ext:TemplateField HeaderText="返货日期"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "MBB_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:BoundField ColumnID="MBB_Money" DataField="MBB_Money" DataTooltipField="MBB_Money" HeaderText="总额" Width="80px"/> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="80px"/> <ext:CheckBoxField DataTooltipField="MBB_Output" Width="60px" RenderAsStaticField="true" DataField="MBB_Output" HeaderText="是否出库" /> <ext:CheckBoxField DataTooltipField="MBB_State" Width="60px" RenderAsStaticField="true" DataField="MBB_State" HeaderText="是否结算" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增供应商" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_MyBackBillList.aspx
ASP.NET
asf20
5,691
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ClientBackBillList.aspx.cs" Inherits="SaleSystem.Business.frm_ClientBackBillList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>退货管理</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="查询" Icon="Reload" Type="Submit" OnClick="bnSearch_Click" ></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" ></ext:Button> </Items> </ext:Toolbar> <ext:Form runat="server" ID="Form2" EnableBackgroundColor="true" ShowHeader="false" BodyPadding="10px" ShowBorder="false"> <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_CBB_Code" Label="退货单号" Width="200px" TabIndex="1"></ext:TextBox> <ext:TextBox runat="server" ID="tb_SBill_Code" Label="销售单号" Width="200px" TabIndex="2"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SBill_Code2" Label="出库单号" Width="200px" TabIndex="3"></ext:TextBox> <ext:TextBox runat="server" ID="tb_Cust_Name" Label="客户" Width="200px" TabIndex="4"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DatePicker runat="server" ID="dp_CBB_Date1" Label="退货日期>=" Width="200px" TabIndex="5"></ext:DatePicker> <ext:DatePicker runat="server" ID="dp_CBB_Date2" Label="退货日期<=" Width="200px" TabIndex="6"></ext:DatePicker> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl_CBB_Input" Label="入库状态" Width="200px" TabIndex="7"> <ext:ListItem Text="-未选择-" Value="-1" Selected="true" /> <ext:ListItem Text="未入库" Value="0" /> <ext:ListItem Text="已入库" Value="1" /> </ext:DropDownList> <ext:DropDownList runat="server" ID="ddl_CBB_State" Label="结算状态" Width="200px" TabIndex="8" DataValueField="Id" DataTextField="Name"></ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="退货单列表" IsDatabasePaging="true" DataKeyNames="CBB_Id,CBB_Code" EnableRowNumber="true" onrowcommand="gv_List_RowCommand" AllowPaging="true" onpageindexchange="gv_List_PageIndexChange" AutoHeight="true" OnPreRowDataBound="gv_List_PreRowDataBound"> <Columns> <ext:BoundField ColumnID="CBB_Code" DataField="CBB_Code" DataTooltipField="CBB_Code" HeaderText="退货单号" Width="100px" /> <ext:BoundField ColumnID="SBill_Code" DataField="SBill_Code" DataTooltipField="SBill_Code" HeaderText="销售单号" Width="100px"/> <ext:BoundField ColumnID="SBill_Code2" DataField="SBill_Code2" DataTooltipField="SBill_Code2" HeaderText="出库单号" Width="100px"/> <ext:BoundField ColumnID="Cust_Name" DataField="Cust_Name" DataTooltipField="Cust_Name" HeaderText="客户名称" Width="100px"/> <ext:BoundField ColumnID="CBB_Money" DataField="CBB_Money DataTooltipField="CBB_Money" HeaderText="退货金额" Width="80px"/> <ext:TemplateField HeaderText="退货日期" Width="80px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "CBB_Date").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:BoundField ColumnID="CBB_Reason" DataField="CBB_Reason" DataTooltipField="CBB_Reason" HeaderText="退货原因" Width="100px"/> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="80px"/> <ext:CheckBoxField DataTooltipField="CBB_Input" Width="60px" RenderAsStaticField="true" DataField="CBB_Input" HeaderText="是否入库" /> <ext:CheckBoxField DataTooltipField="CBB_State" Width="60px" RenderAsStaticField="true" DataField="CBB_State" HeaderText="是否结算" /> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="编辑" HeaderText="编辑" Width="60px" /> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" Width="60px"/> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增退货单" IFrameUrl="about:blank" Target="Top" IsModal="true" Width="800px" Height="600px" EnableMaximize="true"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Business/frm_ClientBackBillList.aspx
ASP.NET
asf20
5,496
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; namespace SaleSystem.Analysis { public partial class frm_AnalyzeList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } } }
zzyxyh
trunk/SaleSystem/SaleSystem/Analysis/frm_AnalyzeList.aspx.cs
C#
asf20
477
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using Sale_Model; using SaleSystem; using ExtAspNet; namespace SaleSystem.Analysis { public partial class frm_ProfitList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { WebChartControl1.Visible = false; WebChartControl2.Visible = false; WebChartControl3.Visible = false; this.ddl_Type.DataSource = LinkService.GetAnalyzeType(); this.ddl_Type.DataBind(); InitControl(); GetAndBind(); } } public void cb_Data_Changed(object sender, EventArgs e) { if (_iShowType == 1) PageContext.RegisterStartupScript("GetPosition();"); else PageContext.RegisterStartupScript("GetPosition2();"); } public void rbl_Type_SelectedIndexChanged(object sender, EventArgs e) { string strTip = ""; if (this.ddl_Type.SelectedValue == "1") strTip = DateTime.Parse(this.dp_StartTime.Text).ToString("yyyy年") + "至" + DateTime.Parse(this.dp_StartTime.Text).ToString("yyyy年"); else if (this.ddl_Type.SelectedValue == "2") strTip = DateTime.Parse(this.dp_StartTime.Text).ToString("yyyy年MM月") + "至" + DateTime.Parse(this.dp_EndTime.Text).ToString("yyyy年MM月"); else strTip = DateTime.Parse(this.dp_StartTime.Text).ToString("yyyy年MM月dd日") + "至" + DateTime.Parse(this.dp_EndTime.Text).ToString("yyyy年MM月dd日"); WebChartControl2.Visible = false; WebChartControl1.Visible = false; WebChartControl3.Visible = false; DataTable dt1 = dtData; if (!dt1.Columns.Contains("ShortDate")) { dt1.Columns.Add("ShortDate"); for (int i = 0; i < dt1.Rows.Count; i++) { if (this.ddl_Type.SelectedValue == "1") { dtData.Rows[i]["ShortDate"] = dtData.Rows[i]["TimeSpin"]; } else if (this.ddl_Type.SelectedValue == "2") { dtData.Rows[i]["ShortDate"] = DateTime.Parse(ValueHandler.GetStringDateValue(dtData.Rows[i]["TimeSpin"])).ToString("yyyy-MM"); } else if (this.ddl_Type.SelectedValue == "3") { dtData.Rows[i]["ShortDate"] = DateTime.Parse(ValueHandler.GetStringDateValue(dtData.Rows[i]["TimeSpin"])).ToString("dd"); } } } if (rbl_Type.SelectedValue == "1") { GetChart(WebChartControl2, "ShortDate", rbl_Item.SelectedValue, dtData, this.ddl_Type.SelectedText + "(" + strTip + ")" + rbl_Item.SelectedItem.Text + "分析", this.rbl_Item.SelectedItem.Text); WebChartControl2.Visible = true; } else if (rbl_Type.SelectedValue == "2") { GetPie(WebChartControl1, dtData, "ShortDate", rbl_Item.SelectedValue, this.ddl_Type.SelectedText + "(" + strTip + ")" + rbl_Item.SelectedItem.Text + "分析"); WebChartControl1.Visible = true; } else if (rbl_Type.SelectedValue == "3") { GetPie(WebChartControl3, dtData, "ShortDate", rbl_Item.SelectedValue, this.ddl_Type.SelectedText + "(" + strTip + ")" + rbl_Item.SelectedItem.Text + "分析"); WebChartControl3.Visible = true; } if (this._iShowType == 1) { PageContext.RegisterStartupScript("GetPosition();"); } } protected void gv_List_PageIndexChange(object sender, GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; } protected void bnAnalyze_Click(object sender, EventArgs e) { GetAndBind(); } protected void bn_Analyze1_Click(object sender, EventArgs e) { GetAndBind(); } protected void ddl_Type_SelectedIndexChanged(object sender, EventArgs e) { //if (this.ddl_Type.SelectedValue == "1") //{ // this.dp_EndTime.DateFormatString = "yyyy"; // this.dp_StartTime.DateFormatString = "yyyy"; //} //else if (this.ddl_Type.SelectedValue == "2") //{ // this.dp_EndTime.DateFormatString = "yyyy-MM"; // this.dp_EndTime.DateFormatString = "yyyy-MM"; //} //else if (this.ddl_Type.SelectedValue == "3") //{ // this.dp_EndTime.DateFormatString = "yyyy-MM-dd"; // this.dp_EndTime.DateFormatString = "yyyy-MM-dd"; //} InitControl(); } #endregion #region Method public void GetAndBind() { FormatGrid(gv_List); DataTable dt= Manager.GetList(ValueHandler.GetIntNumberValue(this.ddl_Type.SelectedValue),ValueHandler.GetStringShortDateValue( this.dp_StartTime.Text), ValueHandler.GetStringShortDateValue( this.dp_EndTime.Text)); this.gv_List.DataSource = dt; this.gv_List.DataBind(); dtData = dt; rbl_Type_SelectedIndexChanged(null, null); } private void InitControl() { if (this.ddl_Type.SelectedValue == "1") { dp_StartTime.Text = DateTime.Parse( (System.DateTime.Now.Year - 5).ToString() + "-01-01").ToString("yyyy-MM-dd"); dp_EndTime.Text = DateTime.Parse( (System.DateTime.Now.Year + 5).ToString() + "-12-31").ToString("yyyy-MM-dd"); } else if (this.ddl_Type.SelectedValue == "2") { dp_StartTime.Text = DateTime.Parse((System.DateTime.Now.Year).ToString() + "-01-01").ToString("yyyy-MM-dd"); dp_EndTime.Text = DateTime.Parse((System.DateTime.Now.Year).ToString() + "-12-31").ToString("yyyy-MM-dd"); } else if (this.ddl_Type.SelectedValue == "3") { dp_StartTime.Text = System.DateTime.Now.ToString("yyyy-MM-01"); dp_EndTime.Text = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-") + DateTime.DaysInMonth(System.DateTime.Now.Year, System.DateTime.Now.Month).ToString()).ToString("yyyy-MM-dd"); } } #endregion #region Property AnalysisOp Manager = new AnalysisOp(); private int _iShowType { get { if (cb_Data.Checked) return 1; else return 0; } } public DataTable dtData { get { return (DataTable)ViewState["dtData"]; } set { ViewState["dtData"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Analysis/frm_ProfitList.aspx.cs
C#
asf20
7,836
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_AnalyzeList.aspx.cs" Inherits="SaleSystem.Analysis.frm_AnalyzeList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="pagemanager1" /> <ext:SimpleForm runat="server" ID="simpleform1" BodyPadding="5px" EnableBackgroundColor="true" ShowHeader="false" > <Toolbars> <ext:Toolbar> <Items> <ext:Button runat="server" ID="Button1" Icon="ChartBar" Text="柱状图" OnClick="bnAnalyze_Click" ValidateForms="simpleform1"></ext:Button> <ext:Button runat="server" ID="Button2" Icon="ChartBar" Text="饼图" OnClick="bnAnalyze_Click" ValidateForms="simpleform1"></ext:Button> <ext:Button runat="server" ID="bnAnalyze" Icon="ChartBar" Text="折线图" OnClick="bnAnalyze_Click" ValidateForms="simpleform1"></ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:DropDownList runat="server" ID="ddl_Type" Label="分析类型" Width="200px" DataTextField="Name" DataValueField="Id" Required="true" OnSelectedIndexChanged="ddl_Type_SelectedIndexChanged"> </ext:DropDownList> <ext:DatePicker runat="server" ID="dp_StartTime" Required="true" ShowRedStar="true" Label="开始时间" DateFormatString="yyyy-MM-dd" Width="200px"></ext:DatePicker> <ext:DatePicker runat="server" ID="dp_EndTime" Required="true" ShowRedStar="true" Label="结束时间" DateFormatString="yyyy-MM-dd" Width="200px" CompareControl="dp_StartTime" CompareOperator="GreaterThanEqual" CompareType="String" CompareMessage="结束日期必须大于等于开始日期!"></ext:DatePicker> </Items> </ext:SimpleForm> <ext:Grid runat="server" ID="gv_List" AutoHeight="true" AutoWidth="true" IsDatabasePaging="false" AllowPaging="true" ShowHeader="false" OnPageIndexChange="gv_List_PageIndexChange" > <Columns> <ext:BoundField ColumnID="TimeSpin" DataField="TimeSpin" HeaderText="统计项" /> <ext:BoundField ColumnID="Sales" DataField="Sales" HeaderText="销售额" /> <ext:BoundField ColumnID="ProductCost" DataField="ProductCost" HeaderText="产品成本" /> <ext:BoundField ColumnID="MainProfit" DataField="MainProfit" HeaderText="毛利润" /> <ext:BoundField ColumnID="Profit" DataField="Profit" HeaderText="纯利润" /> </Columns> </ext:Grid> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Analysis/frm_AnalyzeList.aspx
ASP.NET
asf20
2,924
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_ProfitList.aspx.cs" Inherits="SaleSystem.Analysis.frm_ProfitList" %> <%@ Register assembly="DevExpress.XtraCharts.v8.2.Web, Version=8.2.2.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5" namespace="DevExpress.XtraCharts.Web" tagprefix="dxchartsui" %> <%@ Register assembly="DevExpress.XtraCharts.v8.2, Version=8.2.2.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5" namespace="DevExpress.XtraCharts" tagprefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="pagemanager1" /> <ext:SimpleForm runat="server" ID="simpleform1" BodyPadding="5px" EnableBackgroundColor="true" ShowHeader="false" > <Toolbars> <ext:Toolbar> <Items> <ext:Button runat="server" ID="bnAnalyze" Icon="ChartBar" Text="统计" OnClick="bnAnalyze_Click" ValidateForms="simpleform1" EnableAjax="false"></ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:DropDownList runat="server" ID="ddl_Type" Label="分析类型" Width="200px" DataTextField="Name" DataValueField="Id" Required="true" AutoPostBack="true" OnSelectedIndexChanged="ddl_Type_SelectedIndexChanged" > </ext:DropDownList> <ext:DatePicker runat="server" ID="dp_StartTime" Required="true" ShowRedStar="true" Label="开始时间" DateFormatString="yyyy-MM-dd" Width="200px"></ext:DatePicker> <ext:DatePicker runat="server" ID="dp_EndTime" Required="true" ShowRedStar="true" Label="结束时间" DateFormatString="yyyy-MM-dd" Width="200px" CompareControl="dp_StartTime" CompareOperator="GreaterThanEqual" CompareType="String" CompareMessage="结束日期必须大于等于开始日期!"></ext:DatePicker> <ext:CheckBox runat="server" ID="cb_Data" Text="显示数据" AutoPostBack="true" OnCheckedChanged="cb_Data_Changed"></ext:CheckBox> </Items> </ext:SimpleForm> <ext:Form runat="server" ID="form3" EnableBackgroundColor="true" ShowHeader="true" ShowBorder="true" BodyPadding="5px" Title="图形选项" Icon="ChartBar" > <Rows> <ext:FormRow> <Items> <ext:RadioButtonList runat="server" ID="rbl_Type" Label="图形类型" Width="300px" OnSelectedIndexChanged="rbl_Type_SelectedIndexChanged" AutoPostBack="true" EnableAjax="false" > <ext:RadioItem Text="3D柱状图" Selected="true" Value="1" /> <ext:RadioItem Text="饼图" Value="2" /> <ext:RadioItem Text="折线图" Value="3" /> </ext:RadioButtonList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:RadioButtonList runat="server" ID="rbl_Item" Label="分析项" Width="300px" OnSelectedIndexChanged="rbl_Type_SelectedIndexChanged" AutoPostBack="true" EnableAjax="false"> <ext:RadioItem Text="销售额" Selected="true" Value="Sales" /> <ext:RadioItem Text="毛利润" Value="MainProfit" /> <ext:RadioItem Text="纯利润" Value="Profit" /> </ext:RadioButtonList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:ContentPanel ID="ContentPanel1" EnableAjax="false" runat="server" ShowHeader="false"> <dxchartsui:WebChartControl ID="WebChartControl1" runat="server" Height="400px" Width="700px" DiagramTypeName="SimpleDiagram3D" ClientInstanceName="chart" > <Titles> <cc1:ChartTitle Text="Area of Countries"> </cc1:ChartTitle> <cc1:ChartTitle Alignment="Far" Dock="Bottom" Font="Tahoma, 8pt" Text="From www.nationmaster.com" TextColor="Gray"> </cc1:ChartTitle> </Titles> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> <BorderOptions Visible="False" /> <Diagram RotationAngleX="-35" RotationAngleZ="15" RotationOrder="ZXY" RotationType="UseAngles" ZoomPercent="110"> </Diagram> <SeriesTemplate LabelTypeName="SideBySideBarSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBarSeriesView"> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <Label HiddenSerializableString="to be serialized" OverlappingOptionsTypeName="OverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <View HiddenSerializableString="to be serialized"> </View> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <SeriesSerializable> <cc1:Series LabelTypeName="Pie3DSeriesLabel" Name="Series 1" PointOptionsTypeName="PiePointOptions" SeriesViewTypeName="Pie3DSeriesView"> <points> </points> <view hiddenserializablestring="to be serialized"></view> <label columnindent="20" font="Tahoma, 8pt, style=Bold" hiddenserializablestring="to be serialized" antialiasing="True" overlappingoptionstypename="OverlappingOptions" position="Radial"> <fillstyle filloptionstypename="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </fillstyle> <overlappingoptions indent="3" resolveoverlapping="True"></overlappingoptions> </label> <pointoptions hiddenserializablestring="to be serialized" pointview="ArgumentAndValues"> <ValueNumericOptions Format="Percent" Precision="0"></ValueNumericOptions> </pointoptions> <legendpointoptions hiddenserializablestring="to be serialized" pointview="ArgumentAndValues"> <ValueNumericOptions Format="Percent" Precision="0"></ValueNumericOptions> </legendpointoptions> </cc1:Series> </SeriesSerializable> </dxchartsui:WebChartControl> <dxchartsui:WebChartControl ID="WebChartControl2" runat="server" DiagramTypeName="XYDiagram3D" Height="200px" Width="300px"> <Legend> <Border Visible="False"></Border> </Legend> <SeriesTemplate LabelTypeName="Bar3DSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBar3DSeriesView"> <View HiddenSerializableString="to be serialized"> </View> <Label HiddenSerializableString="to be serialized" OverlappingOptionsTypeName="OverlappingOptions" Visible="True"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <SeriesSerializable> <cc1:Series Name="Series 1" LabelTypeName="Bar3DSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBar3DSeriesView"> <View HiddenSerializableString="to be serialized"></View> <Label HiddenSerializableString="to be serialized" Visible="False" OverlappingOptionsTypeName="OverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"></PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"></LegendPointOptions> </cc1:Series> <cc1:Series Name="Series 2" LabelTypeName="Bar3DSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBar3DSeriesView"> <View HiddenSerializableString="to be serialized"></View> <Label HiddenSerializableString="to be serialized" Visible="False" OverlappingOptionsTypeName="OverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"></PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"></LegendPointOptions> </cc1:Series> </SeriesSerializable> <Diagram RotationMatrixSerializable="0.766044443118978;-0.219846310392954;0.604022773555054;0;0;0.939692620785908;0.342020143325669;0;-0.642787609686539;-0.262002630229385;0.719846310392954;0;0;0;0;1"> <AxisX> <GridLines Visible="True"></GridLines> <Range SideMarginsEnabled="True"></Range> </AxisX> <AxisY> <Range SideMarginsEnabled="True"></Range> </AxisY> </Diagram> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </FillStyle> <Titles> <cc1:ChartTitle></cc1:ChartTitle> </Titles> </dxchartsui:WebChartControl> <dxchartsui:WebChartControl ID="WebChartControl3" runat="server" DiagramTypeName="XYDiagram" Height="200px" Width="300px"> <SeriesSerializable> <cc1:Series labeltypename="PointSeriesLabel" name="Series 1" pointoptionstypename="PointOptions" seriesviewtypename="SplineSeriesView"> <view coloreach="True" hiddenserializablestring="to be serialized"></view> <label antialiasing="True" hiddenserializablestring="to be serialized" overlappingoptionstypename="PointOverlappingOptions"> <fillstyle filloptionstypename="SolidFillOptions"> <options hiddenserializablestring="to be serialized"></options> </fillstyle> </label> <pointoptions hiddenserializablestring="to be serialized"></pointoptions> <legendpointoptions hiddenserializablestring="to be serialized"></legendpointoptions> </cc1:Series> </SeriesSerializable> <SeriesTemplate LabelTypeName="PointSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SplineSeriesView"> <View HiddenSerializableString="to be serialized"> </View> <Label HiddenSerializableString="to be serialized" OverlappingOptionsTypeName="PointOverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <Diagram> <axisx visibleinpanesserializable="-1" interlaced="True" interlacedcolor="PapayaWhip"> <Label Staggered="True"></Label> <range sidemarginsenabled="True"></range> </axisx> <axisy visibleinpanesserializable="-1"> <range sidemarginsenabled="True"></range> </axisy> </Diagram> <BorderOptions Visible="False"></BorderOptions> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </FillStyle> <Legend Antialiasing="True"> <Border Visible="False" /> </Legend> </dxchartsui:WebChartControl> </ext:ContentPanel> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Window runat="server" ID="form2" IsModal="false" Hidden="true" EnableBackgroundColor="true" Width="500px" Height="400px" Title="数据视图"> <Items> <ext:Grid runat="server" ID="gv_List" AutoHeight="true" AutoWidth="true" IsDatabasePaging="false" AllowPaging="true" ShowHeader="false" OnPageIndexChange="gv_List_PageIndexChange" > <Columns> <ext:BoundField ColumnID="TimeSpin" DataField="TimeSpin" HeaderText="统计项" /> <ext:BoundField ColumnID="Sales" DataField="Sales" HeaderText="销售额" /> <ext:BoundField ColumnID="ProductCost" DataField="ProductCost" HeaderText="产品成本" /> <ext:BoundField ColumnID="MainProfit" DataField="MainProfit" HeaderText="毛利润" /> <ext:BoundField ColumnID="Profit" DataField="Profit" HeaderText="纯利润" /> </Columns> </ext:Grid> </Items> </ext:Window> </div> <script type="text/javascript"> function GetPosition() { var wform = Ext.getCmp('<%= form2.ClientID %>'); wform.x = Ext.getBody().getWidth() - 505; wform.y = 235; wform.show(); } function GetPosition2() { var wform = Ext.getCmp('<%= form2.ClientID %>'); wform.hide(); } </script> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Analysis/frm_ProfitList.aspx
ASP.NET
asf20
16,331
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Model; using Sale_Operation; using Sale_Common; namespace SaleSystem { public partial class _Default : PageBase { protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Session.Abandon(); if (Request.Cookies["SaleSystemLogin"] != null) { this.tb_SUser_Name.Text = Request.Cookies[strRememberParaName].Value; this.tb_Remember.Checked = true; } else this.tb_Remember.Checked = false; } } protected void bn_OK_Click(object sender, EventArgs e) { SysUser user = new SysUser(); user.SUser_Name = this.tb_SUser_Name.Text; user.SUser_Pwd = this.tb_SUser_Pwd.Text; SysUsersOp UserOp = new SysUsersOp(); bool bl = UserOp.Login(user); if (bl) { HttpSession session = new HttpSession(); session["CurrentUser"] = user; LinkService.InsertLog(ESysLogType.Operation, "用户[" + user.SUser_Name + "]登陆系统,登陆时间:[" + System.DateTime.Now.ToString("yyyy-MM-dd hh:mmss") + "]!", 0); if (tb_Remember.Checked) { HttpCookie cook = new HttpCookie(strRememberParaName); cook.Expires = System.DateTime.MaxValue; cook.Value = this.tb_SUser_Name.Text; Response.Cookies.Add(cook); } else { Response.Cookies.Remove(strRememberParaName); } Response.Redirect("main.aspx"); } else ExtAspNet.Alert.Show("用户名或密码错误!", ExtAspNet.MessageBoxIcon.Error); } public string strRememberParaName = "SaleSystemLogin"; } }
zzyxyh
trunk/SaleSystem/SaleSystem/index.aspx.cs
C#
asf20
2,321
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // 有关程序集的常规信息通过下列属性集 // 控制。更改这些属性值可修改 // 与程序集关联的信息。 [assembly: AssemblyTitle("SaleSystem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CCIT")] [assembly: AssemblyProduct("SaleSystem")] [assembly: AssemblyCopyright("Copyright © CCIT 2011")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // 将 ComVisible 设置为 false 使此程序集中的类型 // 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型, // 则将该类型上的 ComVisible 属性设置为 true。 [assembly: ComVisible(false)] // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")] // 程序集的版本信息由下面四个值组成: // // 主版本 // 次版本 // 内部版本号 // 修订号 // // 可以指定所有这些值,也可以使用“修订号”和“内部版本号”的默认值, // 方法是按如下所示使用“*”: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
zzyxyh
trunk/SaleSystem/SaleSystem/Properties/AssemblyInfo.cs
C#
asf20
1,318
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Other { public partial class frm_SystemLogList :PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void bnDelete_Click(object sender, EventArgs e) { Manager.Delete(); GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } #endregion #region Method private void BindDropDownList() { } private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } #endregion #region Property SystemLogOp Manager = new SystemLogOp(); #endregion protected void gv_List_PageIndexChange1(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } } }
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_SystemLogList.aspx.cs
C#
asf20
2,665
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Common; using Sale_Model; using Sale_Operation; using ExtAspNet; namespace SaleSystem.Other { public partial class frm_SysConfig : PageBase { #region Page Event protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) GetAndBind(); } protected void bnSave_Click(object sender, EventArgs e) { //保存 bool blRes = false; SysConfig SM = new SysConfig(); SM.SConf_Id = 4; SM.SConf_Value = this.ddl4.SelectedValue; blRes = Manager.Save(SM); if (blRes) { SM.SConf_Id = 5; SM.SConf_Value = this.ddl5.SelectedValue; blRes = Manager.Save(SM); } else { ExtAspNet.Alert.ShowInParent("配置结算方式与帐户绑定关系出错!"); return; } if (blRes) { SM.SConf_Id = 1; SM.SConf_Value = this.tb_SystemName.Text; blRes = Manager.Save(SM); } else { ExtAspNet.Alert.ShowInParent("系统名称保存出错!"); return; } if (blRes) { SM.SConf_Id = 2; SM.SConf_Value = this.tb_Version.Text; blRes=Manager.Save(SM); } else { ExtAspNet.Alert.ShowInParent("系统名称保存出错!"); return; } if (blRes) { SM.SConf_Id = 3; SM.SConf_Value = this.tb_PageSize.Text; blRes=Manager.Save(SM); LinkService.PageSize = ValueHandler.GetIntNumberValue( SM.SConf_Value); } else { ExtAspNet.Alert.ShowInParent("系统名称保存出错!"); return; } if (blRes) { SM.SConf_Id = 6; SM.SConf_Value = this.tb_url.Text; blRes = Manager.Save(SM); } else { ExtAspNet.Alert.ShowInParent("首页地址保存出错!"); return; } if (blRes) { ExtAspNet.Alert.ShowInParent("配置信息保存完成!", "操作提示!", MessageBoxIcon.Information); } } protected void bnReload_Click(object sender, EventArgs e) { GetAndBind(); } protected void GetAndBind() { //加载帐户 AccountListOp AccountManager = new AccountListOp(); DataTable dt1= AccountManager.GetList(""); this.ddl4.DataSource = dt1; this.ddl4.DataBind(); this.ddl4.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); this.ddl5.DataSource = dt1; this.ddl5.DataBind(); this.ddl5.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); SysConfig SM = new SysConfig(); SM.SConf_Id = 4;//现金结算 Manager.GetConfig(SM); this.ddl4.SelectedValue = SM.SConf_Value.ToString(); SM.SConf_Id = 5;//刷卡结算 Manager.GetConfig(SM); this.ddl5.SelectedValue = SM.SConf_Value.ToString(); //系统名称 SM.SConf_Id = 1; Manager.GetConfig(SM); this.tb_SystemName.Text = SM.SConf_Value; //版本号 SM.SConf_Id = 2; Manager.GetConfig(SM); this.tb_Version.Text = SM.SConf_Value; //页面大小 SM.SConf_Id = 3; Manager.GetConfig(SM); this.tb_PageSize.Text = SM.SConf_Value; SM.SConf_Id = 6; Manager.GetConfig(SM); this.tb_url.Text = SM.SConf_Value; } #endregion #region Property SysConfigOp Manager = new SysConfigOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_SysConfigEdit.aspx.cs
C#
asf20
4,620
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_StyleList.aspx.cs" Inherits="SaleSystem.Other.frm_StyleList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" id="PageManager1" /> <ext:SimpleForm runat="server" ID="simpleForm1" EnableBackgroundColor="true" BodyPadding="5px" ShowHeader="false" Height="115px"> <Items> <ext:DropDownList ID="ddlTheme" Width="100px" AutoPostBack="true" OnSelectedIndexChanged="ddlTheme_SelectedIndexChanged" runat="server" Label="主题选择"> <ext:ListItem Text="Blue" Selected="true" Value="blue" /> <ext:ListItem Text="Gray" Value="gray" /> <ext:ListItem Text="Access" Value="access" /> </ext:DropDownList> </Items> </ext:SimpleForm> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_StyleList.aspx
ASP.NET
asf20
1,175
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_WorkPlanDetailList.aspx.cs" Inherits="SaleSystem.Other.frm_WorkPlanDetailList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="pm1" /> <ext:SimpleForm runat="server" ID="SimpleForm2" EnableBackgroundColor="true" BodyPadding="5px" ShowHeader="false" AutoHeight="true" Height="140px" ShowBorder="false" > <Items> <ext:LinkButton runat="server" ID="lb_WPlan_Title" Label="主题" OnClick="lb_WPlan_Content_Click"></ext:LinkButton> <ext:LinkButton runat="server" ID="lb_WPlan_Content" Label="内容" OnClick="lb_WPlan_Content_Click" ></ext:LinkButton> <ext:Label runat="server" ID="lb_Time" Label="时间"></ext:Label> <ext:Panel Layout="Column" ShowBorder="false" ShowHeader="false" EnableBackgroundColor="true" > <Items > <ext:LinkButton runat="server" ID="lb_Previor" Text="上一条" OnClick="lb_PreviorClick" ></ext:LinkButton> <ext:LinkButton runat="server" ID="lb_Next" Text="下一条" OnClick="lb_NextClick"></ext:LinkButton> </Items> </ext:Panel> </Items> </ext:SimpleForm> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增账户" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="390px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_WorkPlanDetailList.aspx
ASP.NET
asf20
1,836
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using Sale_Operation; using Sale_Common; using SaleSystem; using Sale_Model; namespace SaleSystem.Other { public partial class frm_WorkPlanList : PageBase { #region PageEvent protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { bnNew.OnClientClick = win_Content.GetShowReference("frm_WorkPlanEdit.aspx?Id=0", "新增日程安排"); BindDropDownList(); GetAndBind(); } else if (Request[LinkService.RefreshTag] == LinkService.RefreshString) { GetAndBind(); } } protected void bnSearch_Click(object sender, EventArgs e) { GetAndBind(); } protected void gv_List_RowDataBound(object sender, ExtAspNet.GridRowEventArgs e) { } protected void gv_List_PreRowDataBound(object sender, ExtAspNet.GridPreRowEventArgs e) { } protected void gv_List_RowCommand(object sender, ExtAspNet.GridCommandEventArgs e) { if (e.CommandName.ToLower() == "delete") { Sale_Model.WorkPlan SM = new Sale_Model.WorkPlan(); SM.WPlan_Id = ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); SM.WPlan_Title = ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); bool blIsUsing = false;//不需要校验 LinkService.CheckIsUsing("AccountList", Id.ToString()); if (!blIsUsing) { bool blDelete = Manager.Delete(SM); if (blDelete) { GetAndBind(); ExtAspNet.Alert.Show("删除完成!", ExtAspNet.MessageBoxIcon.Information); } else ExtAspNet.Alert.Show("删除失败!", ExtAspNet.MessageBoxIcon.Error); } else ExtAspNet.Alert.Show("该数据项正在使用,不能删除!", ExtAspNet.MessageBoxIcon.Warning); } else if (e.CommandName.ToLower() == "edit") { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_WorkPlanEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(gv_List.DataKeys[e.RowIndex][0]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(gv_List.DataKeys[e.RowIndex][1]); } } protected void gv_List_PageIndexChange(object sender, ExtAspNet.GridPageEventArgs e) { gv_List.PageIndex = e.NewPageIndex; GetAndBind(); } #endregion #region Method private void BindDropDownList() { SysUsersOp userManager = new SysUsersOp(); DataTable dtUser = userManager.GetList(""); this.ddl_WPlan_Man.DataSource = dtUser; this.ddl_WPlan_Man.DataBind(); this.ddl_WPlan_Man.Items.Insert(0, new ExtAspNet.ListItem("-未选择-", "-1")); } private void GetAndBind() { FormatGrid(gv_List); InitCondition(); dtList = Manager.GetList(strCondition, gv_List.PageIndex + 1, ref iRecordCount); gv_List.DataSource = dtList; gv_List.DataBind(); gv_List.RecordCount = iRecordCount; } /// <summary> /// 获取查询条件 /// </summary> public override void InitCondition() { strCondition = ""; if (this.tb_WPlan_Title.Text.Trim() != "") { strCondition = " WPlan_Title LIKE '%" + ValueHandler.GetStringValue( tb_WPlan_Title.Text, ValueHandler.CharHandlerType.IsRepChar)+"%' AND "; } if (this.ddl_WPlan_Man.SelectedValue != "-1") { strCondition = "WPlan_Man="+this.ddl_WPlan_Man.SelectedValue+" AND "; } if (this.dp_WPlan_StartTime1.Text.Trim() != "") { strCondition = "WPlan_StartTime>='"+this.dp_WPlan_StartTime1.Text+"' AND "; } if (this.dp_WPlan_StartTime2.Text.Trim() != "") { strCondition = "WPlan_StartTime<='" + this.dp_WPlan_StartTime2.Text + "' AND "; } if (this.ddl_WPlan_Enable.SelectedValue != "-1") { strCondition = "WPlan_Enable=" + ddl_WPlan_Enable.SelectedValue+" AND "; } if (this.ddl_WPlan_State.SelectedValue != "-1") { strCondition = "WPlan_State=" + ddl_WPlan_State.SelectedValue + " AND "; } if (!string.IsNullOrEmpty(strCondition)) strCondition = strCondition.Substring(0, strCondition.Length - 4); } #endregion #region Property WorkPlanOp Manager = new WorkPlanOp(); #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_WorkPlanList.aspx.cs
C#
asf20
5,504
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_HomeList.aspx.cs" Inherits="SaleSystem.Other.HomeList" %> <%@ Register assembly="DevExpress.XtraCharts.v8.2.Web, Version=8.2.2.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5" namespace="DevExpress.XtraCharts.Web" tagprefix="dxchartsui" %> <%@ Register assembly="DevExpress.XtraCharts.v8.2, Version=8.2.2.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5" namespace="DevExpress.XtraCharts" tagprefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="pageManager1" EnableAjax="false" /> <ext:Panel ID="Panel1" runat="server" AutoHeight="true" AutoWidth="true" ShowBorder="false" EnableCollapse="true" Layout="Column" ShowHeader="true" EnableBackgroundColor="true" Title="最近工作安排" Icon="Date" Height="290px"> <Items> <ext:Form ID="Form3" runat="server" ShowHeader="false" ShowBorder="false" EnableBackgroundColor="true" EnableAjax="true" BodyPadding="5px" AutoHeight="true" Width="600px"> <Rows> <ext:FormRow> <Items> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" ShowHeader="false" IsDatabasePaging="false" AutoWidth="true" Height="253px" DataKeyNames="WPlan_Id,WPlan_Title" EnableRowNumber="true" AllowPaging="false" OnRowCommand="gv_List_RowCommand"> <Columns> <ext:BoundField ColumnID="WPlan_Title" DataField="WPlan_Title" DataTooltipField="WPlan_Title" HeaderText="标题" ExpandUnusedSpace="true" /> <ext:BoundField ColumnID="SUser_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="经办人" Width="100px" /> <ext:TemplateField HeaderText="开始时间" Width="100px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "WPlan_StartTime").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:TemplateField HeaderText="结束时间" Width="100px"> <ItemTemplate> <%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "WPlan_EndTime").ToString()).ToString("yyyy-MM-dd")%> </ItemTemplate> </ext:TemplateField> <ext:LinkButtonField ColumnID="edit" CommandName="edit" Text="查看" HeaderText="查看" Width="60px" /> </Columns> </ext:Grid> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="form2" ShowHeader="false" EnableBackgroundColor="true" BodyPadding="5px" Width="370px" ShowBorder="false" Height="300px"> <Rows> <ext:FormRow> <Items> <ext:ContentPanel ID="ContentPanel2" runat="server" ShowHeader="false" EnableBackgroundColor="true" AutoHeight="true" AutoWidth="true" EnableAjax="false"> <asp:Calendar runat="server" Height="250px" Width="350px" ID="cl_date" BackColor="White" BorderColor="White" BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" NextPrevFormat="FullMonth"> <SelectedDayStyle BackColor="#333399" ForeColor="White" /> <TodayDayStyle BackColor="#CCCCCC" /> <OtherMonthDayStyle ForeColor="#999999" /> <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" /> <DayHeaderStyle Font-Bold="True" Font-Size="8pt" /> <TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True" Font-Size="12pt" ForeColor="#333399" /> </asp:Calendar> </ext:ContentPanel> </Items> </ext:FormRow> </Rows> </ext:Form> </Items> </ext:Panel> <ext:Panel ID="Panel2" runat="server" AutoHeight="true" AutoWidth="true" ShowBorder="false" Layout="Column" ShowHeader="true" EnableBackgroundColor="true" Title="销售趋势图" Icon="ChartLine" EnableCollapse="true" > <Items> <ext:Form ID="Form4" runat="server" ShowHeader="false" ShowBorder="false" EnableBackgroundColor="true" EnableAjax="true" BodyPadding="5px" AutoHeight="true" Width="600px"> <Rows> <ext:FormRow> <Items> <ext:ContentPanel ShowHeader="false"> <dxchartsui:WebChartControl ID="WebChartControl3" runat="server" DiagramTypeName="XYDiagram" Height="200px" Width="300px" AppearanceName="The Trees"> <SeriesSerializable> <cc1:Series labeltypename="PointSeriesLabel" name="Series 1" pointoptionstypename="PointOptions" seriesviewtypename="SplineSeriesView"> <view hiddenserializablestring="to be serialized"></view> <label antialiasing="True" hiddenserializablestring="to be serialized" overlappingoptionstypename="PointOverlappingOptions"> <fillstyle filloptionstypename="SolidFillOptions"> <options hiddenserializablestring="to be serialized"></options> </fillstyle> </label> <pointoptions hiddenserializablestring="to be serialized"></pointoptions> <legendpointoptions hiddenserializablestring="to be serialized"></legendpointoptions> </cc1:Series> </SeriesSerializable> <SeriesTemplate LabelTypeName="PointSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SplineSeriesView"> <View HiddenSerializableString="to be serialized"> </View> <Label HiddenSerializableString="to be serialized" OverlappingOptionsTypeName="PointOverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <Diagram> <axisx visibleinpanesserializable="-1"> <range sidemarginsenabled="True"></range> </axisx> <axisy visibleinpanesserializable="-1"> <range sidemarginsenabled="True"></range> </axisy> </Diagram> <BorderOptions Visible="False"></BorderOptions> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </FillStyle> <Legend Antialiasing="True" Visible="False"> <Border Visible="False" /> </Legend> </dxchartsui:WebChartControl> </ext:ContentPanel> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="form5" ShowHeader="false" EnableBackgroundColor="true" BodyPadding="5px" Width="370px" ShowBorder="false" AutoHeight="true" > <Rows> <ext:FormRow> <Items> <ext:ContentPanel ID="ContentPanel1" runat="server" ShowHeader="false" EnableBackgroundColor="true" AutoHeight="true" AutoWidth="true" EnableAjax="false"> <dxchartsui:WebChartControl ID="WebChartControl1" runat="server" Height="400px" Width="400px" DiagramTypeName="SimpleDiagram3D" ClientInstanceName="chart" > <Titles> <cc1:ChartTitle Text="Area of Countries"> </cc1:ChartTitle> <cc1:ChartTitle Alignment="Far" Dock="Bottom" Font="Tahoma, 8pt" Text="From www.nationmaster.com" TextColor="Gray"> </cc1:ChartTitle> </Titles> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> <BorderOptions Visible="False" /> <Legend Visible="False"></Legend> <Diagram RotationAngleX="-35" RotationAngleZ="15" RotationOrder="ZXY" RotationType="UseAngles" HorizontalScrollPercent="-7" ZoomPercent="90"> </Diagram> <SeriesTemplate LabelTypeName="SideBySideBarSeriesLabel" PointOptionsTypeName="PointOptions" SeriesViewTypeName="SideBySideBarSeriesView"> <PointOptions HiddenSerializableString="to be serialized"> </PointOptions> <Label HiddenSerializableString="to be serialized" OverlappingOptionsTypeName="OverlappingOptions"> <FillStyle FillOptionsTypeName="SolidFillOptions"> <Options HiddenSerializableString="to be serialized" /> </FillStyle> </Label> <View HiddenSerializableString="to be serialized"> </View> <LegendPointOptions HiddenSerializableString="to be serialized"> </LegendPointOptions> </SeriesTemplate> <SeriesSerializable> <cc1:Series LabelTypeName="Pie3DSeriesLabel" Name="Series 1" PointOptionsTypeName="PiePointOptions" SeriesViewTypeName="Pie3DSeriesView"> <points> </points> <view hiddenserializablestring="to be serialized"></view> <label columnindent="20" font="Tahoma, 8pt, style=Bold" hiddenserializablestring="to be serialized" antialiasing="True" overlappingoptionstypename="OverlappingOptions" position="Radial"> <fillstyle filloptionstypename="SolidFillOptions"> <Options HiddenSerializableString="to be serialized"></Options> </fillstyle> <overlappingoptions indent="3" resolveoverlapping="True"></overlappingoptions> </label> <pointoptions hiddenserializablestring="to be serialized" pointview="ArgumentAndValues"> <ValueNumericOptions Format="Percent" Precision="0"></ValueNumericOptions> </pointoptions> <legendpointoptions hiddenserializablestring="to be serialized" pointview="ArgumentAndValues"> <ValueNumericOptions Format="Percent" Precision="0"></ValueNumericOptions> </legendpointoptions> </cc1:Series> </SeriesSerializable> </dxchartsui:WebChartControl> </ext:ContentPanel> </Items> </ext:FormRow> </Rows> </ext:Form> </Items> </ext:Panel> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增账户" IFrameUrl="about:blank" Target="Parent" IsModal="true" Width="500px" Height="390px"> </ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_HomeList.aspx
ASP.NET
asf20
14,954
using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Collections.Generic; using ExtAspNet; using Sale_Operation; using Sale_Model; using Sale_Common; namespace SaleSystem.Other { public partial class frm_WorkPlanDetailList : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!Page.IsPostBack) GetWorkPlan(); } /// <summary> /// 获取需要提醒的日程信息 /// </summary> private void GetWorkPlan() { dtWrokList = null; GetWorkPlanTitle(0); } private void GetWorkPlanTitle(int index) { DataTable dt = dtWrokList; if (dt.Rows.Count <= 0) { return; } if (index >= dt.Rows.Count) { index = 0; iCurrentIndex = 0; } if (index <= 0) { iCurrentIndex = 0; index = 0; } DataRow dr = dt.Rows[index]; lb_WPlan_Title.Text = ValueHandler.GetStringValue(dr["WPlan_Title"]); lb_WPlan_Content.Text = ValueHandler.GetStringValue(dr["WPlan_Content"]); lb_Time.Text = DateTime.Parse(dr["WPlan_StartTime"].ToString()).ToString("yyyy-MM-dd") + " 至 " + DateTime.Parse(dr["WPlan_EndTime"].ToString()).ToString("yyyy-MM-dd"); // WorkForm.Hidden = false; } protected void lb_WPlan_Content_Click(object sender, EventArgs e) { win_Content.Hidden = false; win_Content.IFrameUrl = "frm_WorkPlanEdit.aspx?Id=" + ValueHandler.GetIntNumberValue(dtWrokList.Rows[iCurrentIndex]["WPlan_Id"]); win_Content.Title = "编辑-" + ValueHandler.GetStringValue(dtWrokList.Rows[iCurrentIndex]["WPlan_Title"]); } protected void lb_PreviorClick(object sender, EventArgs e) { iCurrentIndex--; GetWorkPlanTitle(iCurrentIndex); } protected void lb_NextClick(object sender, EventArgs e) { iCurrentIndex++; GetWorkPlanTitle(iCurrentIndex); } #region Property public DataTable dtWrokList { get { if (ViewState["dtWrokList"] != null) return (DataTable)ViewState["dtWrokList"]; else { WorkPlanOp workManager = new WorkPlanOp(); DataTable dt = workManager.GetList("WPlan_WarningTime<='" + System.DateTime.Now.ToString("yyyy-MM-dd") + "' AND WPlan_Enable=1 AND WPlan_State=0 AND A.State=1 "); ViewState["dtWrokList"] = dt; return dt; } } set { ViewState["dtWrokList"] = value; } } public int iCurrentIndex { get { if (ViewState["iCurrentIndex"] != null) return ValueHandler.GetIntNumberValue(ViewState["iCurrentIndex"]); else return 0; } set { ViewState["iCurrentIndex"] = value; } } #endregion } }
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_WorkPlanDetailList.aspx.cs
C#
asf20
3,718
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SysUserList.aspx.cs" Inherits="SaleSystem.Other.SysUserList" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <ext:Toolbar runat="server" ID="toolbar1"> <Items> <ext:Button runat="server" ID="bnSearch" Text="刷新" Icon="Reload" OnClick="bnSearch_Click"></ext:Button> <ext:Button runat="server" ID="bnNew" Text="新增" Icon="Add" Type="Submit" ></ext:Button> </Items> </ext:Toolbar> <ext:Grid runat="server" ID="gv_List" EnableBackgroundColor="true" Title="用户列表" DataKeyNames="SUser_Id,SUser_Name" EnableRowNumber="true" onrowcommand="gv_List_RowCommand"> <Columns> <ext:BoundField ColumnID="BData_Name" DataField="SUser_Name" DataTooltipField="SUser_Name" HeaderText="用户名" Width="200px" /> <ext:BoundField ColumnID="BData_TypeName" DataField="SUser_Pwd" DataTooltipField="SUser_Pwd" HeaderText="密码" Width="150px"/> <ext:WindowField ColumnID="eidt" Text="编辑" HeaderText="编辑" DataWindowTitleField="SUser_Name" WindowID="win_Content" DataIFrameUrlFields="SUser_Id" DataWindowTitleFormatString="编辑 - {0}" DataIFrameUrlFormatString="SysUserEdit.aspx?Id={0}"/> <ext:LinkButtonField ColumnID="delete" CommandName="Delete" ConfirmIcon="Question" ConfirmText="确认删除此信息?" Text="删除" HeaderText="删除" /> </Columns> </ext:Grid> </div> <ext:Window runat="server" ID="win_Content" Popup="false" EnableIFrame="true" EnableConfirmOnClose="true" Title="新增用户" IFrameUrl="SysUserEdit.aspx" Target="Parent" IsModal="true" Width="500px" Height="250px"></ext:Window> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Other/SysUserList.aspx
ASP.NET
asf20
2,096
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="frm_SysConfigEdit.aspx.cs" Inherits="SaleSystem.Other.frm_SysConfig" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>无标题页</title> </head> <body> <form id="form1" runat="server"> <div> <ext:PageManager runat="server" ID="PageManager1" /> <Toolbars> <ext:Toolbar ID="Toolbar1" runat="server"> <Items> <ext:Button runat="server" ID="bnSave" Icon="SystemSave" Text="保存" ValidateForms="SimpleForm1" OnClick="bnSave_Click"> </ext:Button> <ext:Button runat="server" ID="bnReload" Icon="Reload" Text="刷新" OnClick="bnReload_Click"> </ext:Button> </Items> </ext:Toolbar> </Toolbars> <Items> <ext:Form runat="server" ID="SimpleForm1" AutoHeight="true" AutoScroll="true" ShowBorder="true" ShowHeader="true" Title="结算方式关联帐户配置" BodyPadding="5px" EnableCollapse="true" EnableBackgroundColor="true"> <Rows> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl4" Label="现金结算" DataValueField="AList_Id" DataTextField="AList_Name" Width="200px"></ext:DropDownList> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:DropDownList runat="server" ID="ddl5" Label="刷卡" DataValueField="AList_Id" DataTextField="AList_Name" Width="200px"></ext:DropDownList> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form2" AutoHeight="true" AutoScroll="true" ShowBorder="true" ShowHeader="true" Title="系统信息(刷新后生效)" BodyPadding="5px" EnableCollapse="true" EnableBackgroundColor="true" > <Rows> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_SystemName" Label="系统名称"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_Version" Label="版本号"></ext:TextBox> </Items> </ext:FormRow> <ext:FormRow> <Items> <ext:TextBox runat="server" ID="tb_url" Label="首页地址"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> <ext:Form runat="server" ID="Form3" AutoHeight="true" AutoScroll="true" ShowBorder="true" ShowHeader="true" Title="表格信息(重新打开窗体后生效)" BodyPadding="5px" EnableCollapse="true" EnableBackgroundColor="true"> <Rows> <ext:FormRow > <Items> <ext:TextBox runat="server" ID="tb_PageSize" Label="表格每页数据数"></ext:TextBox> </Items> </ext:FormRow> </Rows> </ext:Form> </Items> </div> </form> </body> </html>
zzyxyh
trunk/SaleSystem/SaleSystem/Other/frm_SysConfigEdit.aspx
ASP.NET
asf20
3,942