public string lastName      = "";//修改前的名称
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-3"))
                {
                    Act             = HTTPRequest.GetString("Act");
                    sClassName      = HTTPRequest.GetString("tName").Trim();
                    SupplierClassID = HTTPRequest.GetInt("classID", 0);
                    lastName        = HTTPRequest.GetString("lastName").Trim();
                    if (SupplierClassID > 0)
                    {
                        //2.获得实体
                        pi = DataClass.GetSupplierClassInfoModel(SupplierClassID);
                    }

                    if (ispost)
                    {
                        //添加
                        if (Act.IndexOf("add") > -1)
                        {
                            //3.实体
                            SupplierClassInfo li = new SupplierClassInfo();
                            if (sClassName != "")
                            {
                                li.sParentID   = SupplierClassID;
                                li.sClassName  = sClassName;
                                li.sOrder      = HTTPRequest.GetInt("tOrder", 0);
                                li.sAppendTime = DateTime.Now;

                                //4.是否存在
                                bool hValue = DataClass.ExistsSupplierClassInfo(HTTPRequest.GetString("tName"), SupplierClassID);
                                if (hValue)
                                {
                                    AddErrLine("操作失败,该条分类已经存在,请核对后重新添加!");
                                }
                                else
                                {
                                    //5.添加一条数据
                                    int addCount = DataClass.AddSupplierClassInfo(li);
                                    if (addCount > 0)
                                    {
                                        //记录成功操作
                                        Logs.AddEventLog(this.userid, "添加" + sClassName + "供货商分类");
                                        AddMsgLine("操作成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    else
                                    {
                                        AddErrLine("操作失败,请重新添加!");
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("操作失败,请重新添加!");
                            }
                        }
                        //修改
                        if (Act.IndexOf("update") > -1)
                        {
                            if (sClassName != "")
                            {
                                pi.SupplierClassID = SupplierClassID;
                                pi.sClassName      = sClassName;
                                pi.sAppendTime     = DateTime.Now;

                                //6.更新一条数据
                                int count = DataClass.UpdateSupplierClassInfo(pi);
                                if (count > 0)
                                {
                                    //记录修改操作
                                    Logs.AddEventLog(this.userid, "将" + lastName + "供货商修改为" + sClassName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("修改失败!");
                                }
                            }
                            else
                            {
                                AddErrLine("修改失败!");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        public string lastName                 = ""; //修改前的名称
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1-1"))
                {
                    reformat           = HTTPRequest.GetString("reformat");
                    Act                = HTTPRequest.GetString("Act");
                    FeesSubjectClassID = HTTPRequest.GetInt("FeesSubjectClassID", 0);

                    string cClassName = HTTPRequest.GetString("cClassName").Trim();
                    int    cParentID  = HTTPRequest.GetInt("cParentID", 0);
                    int    cOrder     = HTTPRequest.GetInt("cOrder", 0);
                    int    cDirection = HTTPRequest.GetInt("cDirection", 0);
                    string cCode      = HTTPRequest.GetString("cCode").Trim();
                    int    cType      = HTTPRequest.GetInt("cType", 0);
                    lastName = HTTPRequest.GetString("lastName").Trim();


                    if (Act == "Edit")
                    {
                        if (FeesSubjectClassID > 0)
                        {
                            FeesSubjectClass = DataClass.GetFeesSubjectClassInfoModel(FeesSubjectClassID);
                            if (FeesSubjectClass != null)
                            {
                            }
                            else
                            {
                                AddErrLine("参数错误,系统没有该科目!");
                            }
                        }
                        else
                        {
                            AddErrLine("参数错误!");
                        }
                    }

                    if (ispost)
                    {
                        FeesSubjectClass.cOrder     = cOrder;
                        FeesSubjectClass.cDirection = cDirection;

                        FeesSubjectClass.cType = cType;

                        if (Act == "Edit")
                        {
                            // FeesSubjectClass.cParentID = HTTPRequest.GetFormInt("cParentID",0);
                            // reVal = ",\"ReValue\":{\"ParentID\":\"" + FeesSubjectClass.cParentID + "\"}";

                            if (cCode != FeesSubjectClass.cCode ? !DataClass.ExistsFeesSubjectClassInfoByCode(cCode):true)
                            {
                                if ((cClassName != FeesSubjectClass.cClassName) ? !DataClass.ExistsFeesSubjectClassInfo(cClassName, cParentID):true)
                                {
                                    FeesSubjectClass.cCode      = cCode;
                                    FeesSubjectClass.cClassName = cClassName;

                                    DataClass.UpdateFeesSubjectClassInfo(FeesSubjectClass);

                                    //记录修改操作
                                    Logs.AddEventLog(this.userid, "将" + lastName + "科目修改为" + cClassName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("科目名称:" + cClassName + ",系统已经存在,无法修改!");
                                }
                            }
                            else
                            {
                                AddErrLine("科目编号:" + cCode + ",系统已经存在,无法修改!");
                            }
                        }
                        if (Act == "Add")
                        {
                            FeesSubjectClass.cParentID   = HTTPRequest.GetFormInt("cParentID", 0);
                            FeesSubjectClass.cAppendTime = DateTime.Now;
                            reVal = ",\"ReValue\":{\"ParentID\":\"" + FeesSubjectClass.cParentID + "\"}";

                            if (!DataClass.ExistsFeesSubjectClassInfo(cClassName, cParentID))
                            {
                                if (!DataClass.ExistsFeesSubjectClassInfoByCode(cCode))
                                {
                                    FeesSubjectClass.cCode      = cCode;
                                    FeesSubjectClass.cClassName = cClassName;

                                    DataClass.AddFeesSubjectClassInfo(FeesSubjectClass);
                                    //记录成功操作
                                    Logs.AddEventLog(this.userid, "添加" + cClassName + "科目分类");
                                    AddMsgLine("添加成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("科目编号:" + cCode + ",系统已经存在,无法添加!");
                                }
                            }
                            else
                            {
                                AddErrLine("科目名称:" + cClassName + ",系统已经存在,无法添加!");
                            }
                        }
                    }
                    else
                    {
                        dList = DataClass.GetFeesSubjectClassType();
                        if (Act == "Add")
                        {
                            if (cParentID > 0)
                            {
                                FeesSubjectClassPaterStr = DataClass.GetFeesSubjectClassPaterStr(cParentID);
                            }
                        }
                        if (Act == "Edit")
                        {
                            if (FeesSubjectClassID > 0)
                            {
                                FeesSubjectClassPaterStr = DataClass.GetFeesSubjectClassPaterStr(FeesSubjectClassID);
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
            if (reformat == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + reVal + "}}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
Esempio n. 3
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X"))
                {
                    Act = HTTPRequest.GetString("Act");
                    if (!ispost)
                    {
                        if (Act == "recache")
                        {
                            BaseConfigs.ResetConfig();
                            GeneralConfigs.Serialiaze(GeneralConfigs.GetConfig(), Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config"));
                            Caches.ReSet();
                            AddMsgLine("已重建缓存.");
                            AddScript("window.setTimeout('history.back(1);',2000);");
                        }
                        else
                        {
                            ManageConfig = GeneralConfigs.GetConfig();
                            if (ManageConfig == null)
                            {
                                AddErrLine("获取配置信息发生错误.<br>");
                            }
                        }
                    }
                    else
                    {
                        try
                        {
                            ManageConfig = GeneralConfigs.GetConfig();

                            ManageConfig.OrderID              = HTTPRequest.GetString("OrderID");
                            ManageConfig.MoneyDecimal         = HTTPRequest.GetInt("MoneyDecimal", 0);
                            ManageConfig.QuantityDecimal      = HTTPRequest.GetInt("QuantityDecimal", 0);
                            ManageConfig.CompanyName          = HTTPRequest.GetString("CompanyName");
                            ManageConfig.RegistrationNo       = HTTPRequest.GetString("RegistrationNo");
                            ManageConfig.Address              = HTTPRequest.GetString("Address");
                            ManageConfig.Phone                = HTTPRequest.GetString("Phone");
                            ManageConfig.MonthlyStatementCode = HTTPRequest.GetString("MonthlyStatementCode");
                            ManageConfig.SupplierCode         = HTTPRequest.GetString("SupplierCode");
                            ManageConfig.ReWorkedOrderNum     = HTTPRequest.GetString("ReWorkedOrderNum");
                            //ManageConfig.CertificateCode = HTTPRequest.GetString("CertificateCode");

                            ManageConfig.PrinterName               = HTTPRequest.GetString("PrinterName");
                            ManageConfig.PrintPageWidth            = HTTPRequest.GetString("PrintPageWidth");
                            ManageConfig.PrintCertificatePageWidth = HTTPRequest.GetString("PrintCertificatePageWidth");
                            ManageConfig.CertificateRow            = HTTPRequest.GetInt("CertificateRow", 0);
                            ManageConfig.CertificateCodeLen        = HTTPRequest.GetInt("CertificateCodeLen", 0);

                            ManageConfig.PrintAddPageWidth = HTTPRequest.GetString("PrintAddPageWidth");
                            ManageConfig.PrintAddRow       = HTTPRequest.GetInt("PrintAddRow", 0);

                            ManageConfig.Taobao_Open      = HTTPRequest.GetInt("Taobao_Open", 0);
                            ManageConfig.Order_lock       = HTTPRequest.GetInt("Order_lock", 0);
                            ManageConfig.Certificate_lock = HTTPRequest.GetInt("Certificate_lock", 0);
                            //ManageConfig.Taobao_AppKey = HTTPRequest.GetString("Taobao_AppKey");
                            //ManageConfig.Taobao_AppSecret = HTTPRequest.GetString("Taobao_AppSecret");

                            GeneralConfigs.Serialiaze(ManageConfig, Utils.GetMapPath(BaseConfigs.GetSysPath + "config/general.config"));

                            Logs.AddEventLog(this.userid, "修改系统配置.");

                            BaseConfigs.ResetConfig();
                            Caches.ReSet();
                            AddMsgLine("提交成功!");
                            SetBackLink("config.aspx?r=" + Utils.GetRanDomCode());
                            SetMetaRefresh(1, "config.aspx?r=" + Utils.GetRanDomCode());
                        }
                        catch (Exception ex)
                        {
                            AddErrLine("提交时发生错误:<br>" + ex.Message.ToString());
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 4
0
        public string Act            = "";                      //获得操作步骤

        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-8"))
                {
                    className      = Utils.ChkSQL(HTTPRequest.GetString("className"));
                    classID        = HTTPRequest.GetInt("classID", 0);
                    ProductFieldID = HTTPRequest.GetString("ProductFieldID");
                    Act            = HTTPRequest.GetString("Act");
                    Caches.ReSet();

                    ProductFieldList = tbProductFieldInfo.GetProductFieldList(" ProductClassID = " + classID);

                    if (ispost)
                    {
                        if (Act.IndexOf("getNode") > -1)
                        {
                            string _json = "";
                            for (int i = 0; i < ProductFieldList.Rows.Count; i++)
                            {
                                _json += "{'Field':{'ProductFieldID':" + ProductFieldList.Rows [i] ["ProductFieldID"].ToString() + "," +
                                         "'ProductClassID':" + ProductFieldList.Rows [i] ["ProductClassID"].ToString() + "," +
                                         "'ProductClassName':'" + ProductFieldList.Rows [i] ["ProductClassName"].ToString() + "'," +
                                         "'pfName':'" + ProductFieldList.Rows [i] ["pfName"].ToString() + "'," +
                                         "'pfType':" + ProductFieldList.Rows [i] ["pfType"].ToString() + "," +
                                         "'TypeName':'" + ProductFieldList.Rows [i] ["TypeName"].ToString() + "'," +
                                         "'pfOrder':" + ProductFieldList.Rows [i] ["pfOrder"].ToString() + "," +
                                         "'pfState':" + ProductFieldList.Rows [i] ["pfState"].ToString() + "," +
                                         "'pfAppendTime':'" + ProductFieldList.Rows [i] ["pfAppendTime"].ToString() + "'" +
                                         "}},";
                            }
                            _json = _json.Trim() != "" ? _json.Trim().Substring(0, _json.Trim().Length - 1) : "";
                            Response.Write("{'FieldList':[" + _json + "]}");
                            Response.End();
                        }
                        if (Act.IndexOf("del") > -1)
                        {
                            if (ProductFieldID != "")
                            {
                                try {
                                    tbProductFieldInfo.DeleteProductField(ProductFieldID);


                                    //记录删除商品
                                    Logs.AddEventLog(this.userid, "删除" + ProductFieldID + "商品分类");
                                    Response.Write("1");
                                    Response.End();
                                } catch {
                                    Response.Write("0");
                                    Response.End();
                                }
                            }
                            else
                            {
                                Response.Write("-1");
                                Response.End();
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 5
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            getAct       = HTTPRequest.GetString("Act");
            getAdminName = HTTPRequest.GetString("adminName");
            getAdminPwd  = HTTPRequest.GetString("adminPwd");

            comName     = HTTPRequest.GetString("comName");
            comID       = HTTPRequest.GetString("comID");
            comAddress  = HTTPRequest.GetString("comAddress");
            comTel      = HTTPRequest.GetString("comTel");
            orderNum    = HTTPRequest.GetString("orderNum");
            cumNum      = HTTPRequest.GetString("cumNum");
            ordNum      = HTTPRequest.GetString("ordNum");
            pzLen       = HTTPRequest.GetInt("pzLen", 0);
            MonNum      = HTTPRequest.GetInt("MonNum", 0);
            CounNum     = HTTPRequest.GetInt("CounNum", 0);
            oListWidth  = HTTPRequest.GetString("oListWidth");
            pzWidth     = HTTPRequest.GetString("pzWidth");
            pzRow       = HTTPRequest.GetInt("pzRow", 0);
            sOListWidth = HTTPRequest.GetString("sOListWidth");
            sOrderRow   = HTTPRequest.GetInt("sOrderRow", 0);

            if (!ispost)
            {
                if (getAct.IndexOf("install_four") > -1)
                {
                    //设置基本配置
                    ManageConfig                           = GeneralConfigs.GetConfig();
                    ManageConfig.CompanyName               = comName;
                    ManageConfig.RegistrationNo            = comID;
                    ManageConfig.Address                   = comAddress;
                    ManageConfig.Phone                     = comTel;
                    ManageConfig.OrderID                   = orderNum;
                    ManageConfig.SupplierCode              = cumNum;
                    ManageConfig.MonthlyStatementCode      = ordNum;
                    ManageConfig.CertificateCodeLen        = pzLen;
                    ManageConfig.MoneyDecimal              = MonNum;
                    ManageConfig.QuantityDecimal           = CounNum;
                    ManageConfig.PrintPageWidth            = oListWidth;
                    ManageConfig.PrintCertificatePageWidth = pzWidth;
                    ManageConfig.CertificateRow            = pzRow;
                    ManageConfig.PrintAddPageWidth         = sOListWidth;
                    ManageConfig.PrintAddRow               = sOrderRow;

                    GeneralConfigs.Serialiaze(ManageConfig, Yannyo.Common.Utils.GetMapPath(BaseConfigs.GetSysPath + "/config/general.config"));
                    Logs.AddEventLog(this.userid, "修改系统配置.");
                    BaseConfigs.ResetConfig();
                    Caches.ReSet();
                    try
                    {
                        Yannyo.Install.Utils.toSystemReg(ManageConfig);
                    }
                    catch
                    {
                    }

                    if (getAdminName != "" && getAdminPwd != "")
                    {
                        if (!tbUserInfo.ExistsUserInfo(getAdminName))
                        {
                            //创建新用户
                            UserInfo ui = new UserInfo();
                            ui.uName = getAdminName;
                            ui.uPWD  = Yannyo.Common.Utils.MD5(getAdminPwd);
                            ui.uCode = Yannyo.Common.Utils.CutString(Yannyo.Common.Utils.GetRanDomCode(), 16);

                            ui.uLastIP       = HTTPRequest.GetIP();
                            ui.uAppendTime   = DateTime.Now;
                            ui.uUpAppendTime = DateTime.Now;
                            ui.uEstate       = 0;
                            ui.StaffID       = 0;
                            ui.uType         = 0;
                            ui.uPermissions  = "X";
                            if (tbUserInfo.AddUserInfo(ui) > 0)
                            {
                                Logs.AddEventLog(this.userid, "新增用户:" + ui.uName);
                            }
                        }
                        else
                        {
                            this.AddErrLine("系统已经初始化,请不要刷新页面或重新初始化!");
                        }
                    }
                }
            }
        }
Esempio n. 6
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("7-2-1-5-5-3"))
                {
                    Act = HTTPRequest.GetString("Act");
                    if (Act == "Edit")
                    {
                        ProductsID = Utils.StrToInt(HTTPRequest.GetString("pid"), 0);

                        dList = DataUtils.GetStock_analysis(0, DateTime.Now, ProductsID);

                        //spi = tbStockProductInfo.GetStockProductInfoModelByProductsID(ProductsID);
                    }
                    if (dList != null)
                    {
                        if (ispost)
                        {
                            try
                            {
                                int     loop      = HTTPRequest.GetInt("loop", 0);
                                int     StorageID = 0;
                                decimal pBad      = 0;
                                if (loop > 0)
                                {
                                    for (int i = 0; i <= loop; i++)
                                    {
                                        StorageID = HTTPRequest.GetInt("StorageID_" + i, 0);
                                        if (StorageID > 0)
                                        {
                                            pBad = (HTTPRequest.GetString("Bad_" + i).Trim() != "") ? decimal.Parse(Utils.ChkSQL(HTTPRequest.GetString("Bad_" + i))) : 0;

                                            spi             = new StockProductInfo();
                                            spi.ProductsID  = ProductsID;
                                            spi.StorageID   = StorageID;
                                            spi.isBad       = pBad;
                                            spi.sAppendTime = DateTime.Now;

                                            tbStockProductInfo.AddStockProductInfo(spi);

                                            ProductsInfo _pi = new ProductsInfo();
                                            StorageInfo  _si = new StorageInfo();

                                            _pi = tbProductsInfo.GetProductsInfoModel(ProductsID);
                                            _si = tbStorageInfo.GetStorageInfoModel(StorageID);

                                            if (_pi != null && _si != null)
                                            {
                                                Logs.AddEventLog(this.userid, "修改实时库存." + _si.sName + "," + _pi.pName + ".Bad:" + pBad);
                                            }
                                            _pi = null;
                                            _si = null;
                                        }
                                    }
                                    AddMsgLine("更新成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                            }
                            catch
                            {
                                AddErrLine("系统忙,请稍候!");
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                        }
                        else
                        {
                            StorageList = tbStorageInfo.GetStorageInfoList("").Tables[0];
                            if (StorageList != null)
                            {
                                StorageList.Columns.Add("Bad", Type.GetType("System.Decimal"));
                                DataTable dt = new DataTable();
                                dt = tbStockProductInfo.GetStockProductInfoListByNow(" sp.ProductsID=" + ProductsID).Tables[0];
                                if (dt != null)
                                {
                                    foreach (DataRow dr in dt.Rows)
                                    {
                                        foreach (DataRow drr in StorageList.Rows)
                                        {
                                            if (dr["StorageID"].ToString() == drr["StorageID"].ToString())
                                            {
                                                drr["Bad"] = dr["isBad"];
                                            }
                                        }
                                    }
                                }
                                StorageList.AcceptChanges();
                            }
                        }
                    }
                    else
                    {
                        AddErrLine("参数错误,请重试!");
                        AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("4-1"))
                {
                    ucode   = DES.Encode(this.userinfo.uName + "|" + UsersUtils.GetCookiePassword(config.Passwordkey), config.Passwordkey);
                    Act     = HTTPRequest.GetString("Act");
                    StaffID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);
                    format  = HTTPRequest.GetString("format");
                    if (Act == "Edit")
                    {
                        si = tbStaffInfo.GetStaffInfoModel(StaffID);

                        sd = tbStaffInfo.GetStaffDataInfoModelByStaffID(StaffID);

                        if (sd != null)
                        {
                            sd.sBirthDay     = sd.sBirthDay != null?sd.sBirthDay:"";
                            sd.sPolitical    = sd.sPolitical != null ? sd.sPolitical : "";
                            sd.sBirthplace   = sd.sBirthplace != null ? sd.sBirthplace : "";
                            sd.sHometown     = sd.sHometown != null ? sd.sHometown : "";
                            sd.sEducation    = sd.sEducation != null ? sd.sEducation : "";
                            sd.sProfessional = sd.sProfessional != null ? sd.sProfessional : "";
                            sd.sHealth       = sd.sHealth != null ? sd.sHealth : "";

                            sd.sSpecialty      = sd.sSpecialty != null ? sd.sSpecialty : "";
                            sd.sHobbies        = sd.sHobbies != null ? sd.sHobbies : "";
                            sd.sContactAddress = sd.sContactAddress != null ? sd.sContactAddress : "";
                            sd.sPhotos         = sd.sPhotos != null ? sd.sPhotos : "";

                            sd.sCanBeDate = sd.sCanBeDate != null ? sd.sCanBeDate : "";
                        }

                        sad = tbStaffInfo.GetStaffAnalysisDataInfoModelByStaffID(StaffID);
                        if (sad != null)
                        {
                            sad.aEvaluationMSG = sad.aEvaluationMSG != null ? sad.aEvaluationMSG : "";
                        }
                    }
                    //修改状体
                    if (Act == "State")
                    {
                        si    = tbStaffInfo.GetStaffInfoModel(StaffID);
                        tJson = ",\"StaffID\":" + StaffID + "";
                        if (si != null)
                        {
                            si.sState = (si.sState == 0 ? 1 : 0);
                            tbStaffInfo.UpdateStaffInfo(si);
                            Logs.AddEventLog(this.userid, "修改人员状态." + si.sName);
                            tJson += ",\"StaffState\":" + si.sState;
                            AddMsgLine("修改成功!");
                        }
                        else
                        {
                            AddErrLine("修改失败,对象不存在!");
                        }
                    }
                    if (ispost)
                    {
                        sName              = Utils.ChkSQL(HTTPRequest.GetString("sName"));
                        sSex               = Utils.ChkSQL(HTTPRequest.GetString("sSex"));
                        sTel               = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                        sCarID             = Utils.ChkSQL(HTTPRequest.GetString("sCarID"));
                        sType              = Utils.StrToInt(HTTPRequest.GetString("sType"), 0);
                        sEmail             = Utils.ChkSQL(HTTPRequest.GetString("sEmail"));
                        DepartmentsClassID = Utils.StrToInt(HTTPRequest.GetString("DepartmentsClassID"), 0);
                        sState             = HTTPRequest.GetString("sState").Trim() != "" ? Utils.StrToInt(HTTPRequest.GetString("sState"), 0) : 1;

                        si.sSex               = sSex;
                        si.sTel               = sTel;
                        si.sCarID             = sCarID;
                        si.sType              = sType;
                        si.sState             = sState;
                        si.sEmail             = sEmail;
                        si.DepartmentsClassID = DepartmentsClassID;

                        sd = sd != null ? sd : new StaffDataInfo();

                        sd.sBirthDay       = Utils.ChkSQL(HTTPRequest.GetString("sBirthDay"));
                        sd.sPolitical      = Utils.ChkSQL(HTTPRequest.GetString("sPolitical"));
                        sd.sBirthplace     = Utils.ChkSQL(HTTPRequest.GetString("sBirthplace"));
                        sd.sHometown       = Utils.ChkSQL(HTTPRequest.GetString("sHometown"));
                        sd.sEducation      = Utils.ChkSQL(HTTPRequest.GetString("sEducation"));
                        sd.sProfessional   = Utils.ChkSQL(HTTPRequest.GetString("sProfessional"));
                        sd.sHealth         = Utils.ChkSQL(HTTPRequest.GetString("sHealth"));
                        sd.sHeight         = HTTPRequest.GetInt("sHeight", 0);
                        sd.sWeight         = HTTPRequest.GetInt("sWeight", 0);
                        sd.sSpecialty      = Utils.ChkSQL(HTTPRequest.GetString("sSpecialty"));
                        sd.sHobbies        = Utils.ChkSQL(HTTPRequest.GetString("sHobbies"));
                        sd.sContactAddress = Utils.ChkSQL(HTTPRequest.GetString("sContactAddress"));
                        sd.sPhotos         = Utils.ChkSQL(HTTPRequest.GetString("sPhotos"));
                        sd.sEmployment     = HTTPRequest.GetInt("sEmployment", 0);
                        sd.sCanBeDate      = Utils.ChkSQL(HTTPRequest.GetString("sCanBeDate"));
                        sd.sTreatment      = HTTPRequest.GetInt("sTreatment", 0);

                        sad = sad != null ? sad : new StaffAnalysisDataInfo();

                        sad.aWearing       = HTTPRequest.GetInt("aWearing", 0);
                        sad.aEducation     = HTTPRequest.GetInt("aEducation", 0);
                        sad.aWork          = HTTPRequest.GetInt("aWork", 0);
                        sad.aCommunication = HTTPRequest.GetInt("aCommunication", 0);
                        sad.aConfidence    = HTTPRequest.GetInt("aConfidence", 0);
                        sad.aLeadership    = HTTPRequest.GetInt("aLeadership", 0);
                        sad.aJobstability  = HTTPRequest.GetInt("aJobstability", 0);
                        sad.aComputer      = HTTPRequest.GetInt("aComputer", 0);
                        sad.aEnglish       = HTTPRequest.GetInt("aEnglish", 0);
                        sad.aWritten       = HTTPRequest.GetInt("aWritten", 0);
                        sad.aEvaluation    = HTTPRequest.GetInt("aEvaluation", 0);
                        sad.aEvaluationMSG = Utils.ChkSQL(HTTPRequest.GetString("aEvaluationMSG"));
                        try
                        {
                            sad.aDateTime = Utils.IsDateString(HTTPRequest.GetString("aDateTime")) ? DateTime.Parse(HTTPRequest.GetString("aDateTime").Trim()) : DateTime.Now;
                        }
                        catch {
                            sad.aDateTime = DateTime.Now;
                        }

                        EduDataListJson    = HTTPRequest.GetString("EduDataListJson");
                        WorkDataListJson   = HTTPRequest.GetString("WorkDataListJson");
                        FamilyDataListJson = HTTPRequest.GetString("FamilyDataListJson");

                        if (Act == "Add")
                        {
                            if (!tbStaffInfo.ExistsStaffInfo(sName))
                            {
                                si.sName       = sName;
                                si.sAppendTime = sAppendTime;
                                StaffID        = tbStaffInfo.AddStaffInfo(si);
                                if (StaffID > 0)
                                {
                                    sd.StaffID = StaffID;

                                    tbStaffInfo.AddStaffDataInfo(sd);

                                    sad.StaffID     = StaffID;
                                    sad.aAppendTime = DateTime.Now;

                                    tbStaffInfo.AddStaffAnalysisDataInfo(sad);

                                    if (EduDataListJson.Trim() != "")
                                    {
                                        StaffEduDataJson EduDataJson = (StaffEduDataJson)JavaScriptConvert.DeserializeObject(EduDataListJson, typeof(StaffEduDataJson));

                                        tbStaffInfo.AddStaffEduDataInfoByJson(EduDataJson);
                                    }
                                    if (WorkDataListJson.Trim() != "")
                                    {
                                        StaffWorkDataJson WorkDataJson = (StaffWorkDataJson)JavaScriptConvert.DeserializeObject(WorkDataListJson, typeof(StaffWorkDataJson));

                                        tbStaffInfo.AddStaffWorkDataInfoByJson(WorkDataJson);
                                    }
                                    if (FamilyDataListJson.Trim() != "")
                                    {
                                        StaffFamilyDataJson FamilyDataJson = (StaffFamilyDataJson)JavaScriptConvert.DeserializeObject(FamilyDataListJson, typeof(StaffFamilyDataJson));

                                        tbStaffInfo.AddStaffFamilyDataInfoByJson(FamilyDataJson);
                                    }
                                    Logs.AddEventLog(this.userid, "新增人员." + si.sName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("window.setTimeout('history.back(1);',1000);");
                                }
                            }
                            else
                            {
                                AddErrLine("人员:" + sName + ",已存在,请更换!");
                                AddScript("window.setTimeout('history.back(1);',3000);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            bool nOK = false;
                            if (si.sName.Trim() != sName.Trim())
                            {
                                if (!tbStaffInfo.ExistsStaffInfo(sName.Trim()))
                                {
                                    nOK = true;
                                }
                                else
                                {
                                    nOK = false;
                                    AddErrLine("人员:" + sName + ",已存在,请更换!");
                                    AddScript("window.setTimeout('history.back(1);',3000);");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }
                            if (nOK)
                            {
                                try
                                {
                                    si.sName = sName;

                                    tbStaffInfo.UpdateStaffInfo(si);

                                    if (sd.StaffID > 0)
                                    {
                                        tbStaffInfo.UpdateStaffDataInfo(sd);
                                    }
                                    else
                                    {
                                        sd.StaffID = StaffID;

                                        tbStaffInfo.AddStaffDataInfo(sd);
                                    }

                                    if (sad.StaffID > 0)
                                    {
                                        tbStaffInfo.UpdateStaffAnalysisDataInfo(sad);
                                    }
                                    else
                                    {
                                        sad.StaffID     = StaffID;
                                        sad.aAppendTime = DateTime.Now;

                                        tbStaffInfo.AddStaffAnalysisDataInfo(sad);
                                    }

                                    if (EduDataListJson.Trim() != "")
                                    {
                                        StaffEduDataJson EduDataJson = (StaffEduDataJson)JavaScriptConvert.DeserializeObject(EduDataListJson, typeof(StaffEduDataJson));

                                        tbStaffInfo.UpdateStaffEduDataInfoByJson(EduDataJson, StaffID);
                                    }
                                    if (WorkDataListJson.Trim() != "")
                                    {
                                        StaffWorkDataJson WorkDataJson = (StaffWorkDataJson)JavaScriptConvert.DeserializeObject(WorkDataListJson, typeof(StaffWorkDataJson));

                                        tbStaffInfo.UpdateStaffWorkDataInfoByJson(WorkDataJson, StaffID);
                                    }
                                    if (FamilyDataListJson.Trim() != "")
                                    {
                                        StaffFamilyDataJson FamilyDataJson = (StaffFamilyDataJson)JavaScriptConvert.DeserializeObject(FamilyDataListJson, typeof(StaffFamilyDataJson));

                                        tbStaffInfo.UpdateStaffFamilyDataInfoByJson(FamilyDataJson, StaffID);
                                    }

                                    Logs.AddEventLog(this.userid, "修改人员." + si.sName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    //AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                            }
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        DepartmentsClass = Caches.GetDepartmentsClassInfoToHTML();
                        if (Act == "Add")
                        {
                            si.sName  = "";
                            si.sSex   = "男";
                            si.sState = 0;
                            si.sType  = 0;
                        }
                        if (Act == "Edit")
                        {
                            EduDataListJson    = "";
                            WorkDataListJson   = "";
                            FamilyDataListJson = "";

                            EduDataList         = tbStaffInfo.GetStaffEduDataInfoList(" StaffID=" + StaffID + " order by StaffEduDataID desc").Tables[0];
                            StaffWorkDataList   = tbStaffInfo.GetStaffWorkDataInfoList(" StaffID=" + StaffID + " order by StaffWorkDataID desc").Tables[0];
                            StaffFamilyDataList = tbStaffInfo.GetStaffFamilyDataInfoList(" StaffID=" + StaffID + " order by StaffFamilyDataID desc").Tables[0];
                            try {
                                foreach (DataRow dr in EduDataList.Rows)
                                {
                                    EduDataListJson += "{\"StaffEduDataID\":\"" + dr["StaffEduDataID"].ToString() + "\",\"StaffID\":\"" + dr["StaffID"].ToString() + "\",\"eDate\":\"" + dr["eDate"].ToString() + "\",\"eSchools\":\"" + dr["eSchools"].ToString().Replace("\"", "\\\"") + "\",\"eContent\":\"" + dr["eContent"].ToString().Replace("\"", "\\\"") + "\"},";
                                }
                                if (EduDataListJson.Trim() != "")
                                {
                                    EduDataListJson = EduDataListJson.Substring(0, EduDataListJson.Length - 1);
                                }
                                EduDataListJson = "{\"EduDataList\":[" + EduDataListJson + "]}";

                                foreach (DataRow dr in StaffWorkDataList.Rows)
                                {
                                    WorkDataListJson += "{\"StaffWorkDataID\":\"" + dr["StaffWorkDataID"].ToString() + "\",\"StaffID\":\"" + dr["StaffID"].ToString() + "\",\"wDate\":\"" + dr["wDate"].ToString() + "\",\"wEnterprise\":\"" + dr["wEnterprise"].ToString().Replace("\"", "\\\"") + "\",\"wTel\":\"" + dr["wTel"].ToString().Replace("\"", "\\\"") + "\",\"wJobs\":\"" + dr["wJobs"].ToString().Replace("\"", "\\\"") + "\",\"wIncome\":\"" + dr["wIncome"].ToString().Replace("\"", "\\\"") + "\"},";
                                }
                                if (WorkDataListJson.Trim() != "")
                                {
                                    WorkDataListJson = WorkDataListJson.Substring(0, WorkDataListJson.Length - 1);
                                }
                                WorkDataListJson = "{\"WorkDataList\":[" + WorkDataListJson + "]}";

                                foreach (DataRow dr in StaffFamilyDataList.Rows)
                                {
                                    FamilyDataListJson += "{\"StaffFamilyDataID\":\"" + dr["StaffFamilyDataID"].ToString() + "\",\"StaffID\":\"" + dr["StaffID"].ToString() + "\",\"fTitle\":\"" + dr["fTitle"].ToString() + "\",\"fName\":\"" + dr["fName"].ToString().Replace("\"", "\\\"") + "\",\"fAge\":\"" + dr["fAge"].ToString().Replace("\"", "\\\"") + "\",\"fEnterprise\":\"" + dr["fEnterprise"].ToString().Replace("\"", "\\\"") + "\",\"fWork\":\"" + dr["fWork"].ToString().Replace("\"", "\\\"") + "\",\"fAddress\":\"" + dr["fAddress"].ToString().Replace("\"", "\\\"") + "\",\"fTel\":\"" + dr["fTel"].ToString().Replace("\"", "\\\"") + "\"},";
                                }
                                if (FamilyDataListJson.Trim() != "")
                                {
                                    FamilyDataListJson = FamilyDataListJson.Substring(0, FamilyDataListJson.Length - 1);
                                }
                                FamilyDataListJson = "{\"FamilyDataList\":[" + FamilyDataListJson + "]}";
                            }
                            finally {
                                EduDataList         = null;
                                StaffWorkDataList   = null;
                                StaffFamilyDataList = null;
                            }
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbStaffInfo.DeleteStaffInfo(HTTPRequest.GetString("sid"));
                                Logs.AddEventLog(this.userid, "删除人员." + HTTPRequest.GetString("sid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
            if (format == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + tJson + "}}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-8"))
                {
                    Act            = HTTPRequest.GetString("Act");
                    ProductFieldID = HTTPRequest.GetInt("ProductFieldID", 0);
                    ProductClassID = HTTPRequest.GetInt("ProductClassID", 0);
                    pfName         = Utils.ChkSQL(HTTPRequest.GetString("pfName").Trim());
                    pfType         = HTTPRequest.GetInt("pfType", 0);
                    pfOrder        = HTTPRequest.GetInt("pfOrder", 0);
                    pfState        = HTTPRequest.GetInt("pfState", 0);
                    if (ProductFieldID > 0)
                    {
                        pf = tbProductFieldInfo.GetProductFieldModel(ProductFieldID);
                    }
                    if (ispost)
                    {
                        //添加
                        if (Act.IndexOf("add") > -1)
                        {
                            if (pfName.Trim() != "")
                            {
                                if (!tbProductFieldInfo.ExistsProductField(ProductClassID, pfName))
                                {
                                    pf.pfName         = pfName.Trim();
                                    pf.pfOrder        = pfOrder;
                                    pf.pfState        = pfState;
                                    pf.pfType         = pfType;
                                    pf.ProductClassID = ProductClassID;
                                    pf.pfAppendTime   = pfAppendTime;

                                    int pfID = tbProductFieldInfo.AddProductField(pf);
                                    if (pfID > 0)
                                    {
                                        Logs.AddEventLog(this.userid, "添加" + pfName + "(" + pfID + ")商品字段");
                                        AddMsgLine("操作成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                }
                                else
                                {
                                    AddErrLine("操作失败,该商品字段当前分类下已经存在,请核对后重新添加!");
                                }
                            }
                            else
                            {
                                AddErrLine("操作失败,商品字段不能为空,请核对后重新添加!");
                            }
                        }
                        //修改
                        if (Act.IndexOf("update") > -1)
                        {
                            bool   isOK      = true;
                            string error_str = "";
                            if (pf.pfName.Trim() != pfName.Trim())
                            {
                                if (!tbProductFieldInfo.ExistsProductField(ProductClassID, pfName))
                                {
                                    isOK = true;
                                }
                                else
                                {
                                    isOK = false;
                                    AddErrLine("操作失败,该商品字段当前分类下已经存在,请核对后重新添加!");
                                }
                            }
                            if (isOK)
                            {
                                if (pfName.Trim() != "")
                                {
                                    string lastName = pf.pfName;
                                    pf.pfName         = pfName.Trim();
                                    pf.pfOrder        = pfOrder;
                                    pf.pfState        = pfState;
                                    pf.pfType         = pfType;
                                    pf.ProductClassID = ProductClassID;

                                    int count = tbProductFieldInfo.UpdateProductField(pf);

                                    if (count > 0)
                                    {
                                        //记录修改操作
                                        Logs.AddEventLog(this.userid, "将" + lastName + "商品字段修改为" + pfName);
                                        AddMsgLine("修改成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    else
                                    {
                                        AddErrLine("修改失败!");
                                    }
                                }
                                else
                                {
                                    AddErrLine("商品字段不能为空!");
                                }
                            }
                        }
                    }
                    else
                    {
                        ProductFieldTypeList = tbProductFieldInfo.GetProductFieldTypes();

                        ProductClassStr = DataClass.GetProductClassInfoToHTML();
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-5"))
                {
                    Act = HTTPRequest.GetString("Act");

                    yName = Utils.ChkSQL(HTTPRequest.GetString("yName"));
                    if (Act == "Edit")
                    {
                        YHsysID = Utils.StrToInt(HTTPRequest.GetString("yid"), 0);

                        YHsys = tbYHsysInfo.GetYHsysInfoModel(YHsysID);
                    }
                    if (ispost)
                    {
                        if (Act == "Add")
                        {
                            if (!tbYHsysInfo.ExistsYHsysInfo(yName))
                            {
                                YHsys.yName       = yName;
                                YHsys.yAppendTime = yAppendTime;

                                if (tbYHsysInfo.AddYHsysInfo(YHsys) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增系统." + YHsys.yName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("history.back(1);");
                                }
                            }
                            else
                            {
                                AddErrLine("厂标:" + yName + ",已存在,请更换!");
                                AddScript("history.back(1);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            if (YHsysID > 0)
                            {
                                if (!tbYHsysInfo.ExistsYHsysInfo(yName))
                                {
                                    YHsys.yName = yName;
                                    try
                                    {
                                        tbYHsysInfo.UpdateYHsysInfo(YHsys);
                                        Logs.AddEventLog(this.userid, "修改系统." + YHsys.yName);
                                        AddMsgLine("修改成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    catch (Exception ex)
                                    {
                                        AddErrLine("修改失败!<br/>" + ex);
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                }
                                else
                                {
                                    AddErrLine("厂标:" + yName + ",已存在,请更换!");
                                    AddScript("history.back(1);");
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误,修改失败!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                    else
                    {
                        if (Act == "Add")
                        {
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbYHsysInfo.DeleteYHsysInfo(HTTPRequest.GetString("yid"));
                                Logs.AddEventLog(this.userid, "删除系统." + HTTPRequest.GetString("yid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("创建失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            Act    = HTTPRequest.GetString("Act");
            format = HTTPRequest.GetString("format");
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-1"))
                {
                    if (Act == "Edit")
                    {
                        StorageID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);

                        si = tbStorageInfo.GetStorageInfoModel(StorageID);
                    }
                    if (ispost)
                    {
                        if (HTTPRequest.GetInt("sManager", 0) > 0)
                        {
                            if (Utils.ChkSQL(HTTPRequest.GetString("sName")).Trim() != "")
                            {
                                si.sManager       = HTTPRequest.GetInt("sManager", 0);
                                si.sTel           = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                                si.sAddress       = Utils.ChkSQL(HTTPRequest.GetString("sAddress"));
                                si.sRemake        = Utils.ChkSQL(HTTPRequest.GetString("sRemake"));
                                si.StorageClassID = HTTPRequest.GetInt("StorageClassID", 0);
                                si.sState         = HTTPRequest.GetInt("sState", 1);

                                if (Act == "Add")
                                {
                                    si.sCode = Utils.ChkSQL(HTTPRequest.GetString("sCode"));
                                    si.sName = Utils.ChkSQL(HTTPRequest.GetString("sName"));

                                    if (!tbStorageInfo.ExistsStorageInfo(si.sName))
                                    {
                                        if (!tbStorageInfo.ExistsStorageInfoByCode(si.sCode))
                                        {
                                            si.sAppendTime = DateTime.Now;
                                            if (tbStorageInfo.AddStorageInfo(si) > 0)
                                            {
                                                Logs.AddEventLog(this.userid, "新增仓库." + si.sName);
                                                AddMsgLine("创建成功!");
                                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                            }
                                            else
                                            {
                                                AddErrLine("创建失败!");
                                                AddScript("window.setTimeout('history.back(1);',2000);");
                                            }
                                        }
                                        else
                                        {
                                            AddErrLine("仓库编码重复!");
                                            AddScript("window.setTimeout('history.back(1);',2000);");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("仓库名称重复!");
                                        AddScript("window.setTimeout('history.back(1);',2000);");
                                    }
                                }
                                if (Act == "Edit")
                                {
                                    try
                                    {
                                        if (si.sCode.Trim() != Utils.ChkSQL(HTTPRequest.GetString("sCode")).Trim() && tbStorageInfo.ExistsStorageInfoByCode(Utils.ChkSQL(HTTPRequest.GetString("sCode")).Trim()))
                                        {
                                            AddErrLine("仓库编码重复!");
                                            AddScript("window.setTimeout('history.back(1);',2000);");
                                        }
                                        else if (si.sName.Trim() != Utils.ChkSQL(HTTPRequest.GetString("sName")).Trim() && tbStorageInfo.ExistsStorageInfo(Utils.ChkSQL(HTTPRequest.GetString("sName")).Trim()))
                                        {
                                            AddErrLine("仓库名称重复!");
                                            AddScript("window.setTimeout('history.back(1);',2000);");
                                        }
                                        else
                                        {
                                            si.sCode = Utils.ChkSQL(HTTPRequest.GetString("sCode")).Trim();
                                            si.sName = Utils.ChkSQL(HTTPRequest.GetString("sName")).Trim();

                                            tbStorageInfo.UpdateStorageInfo(si);
                                            Logs.AddEventLog(this.userid, "修改仓库." + si.sName);
                                            AddMsgLine("修改成功!");
                                            AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        AddErrLine("修改失败!<br/>" + ex);
                                        AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("仓库名称不能为空!");
                                AddScript("window.setTimeout('history.back(1);',2000);");
                            }
                        }
                        else
                        {
                            AddErrLine("管理员不能为空!");
                            AddScript("window.setTimeout('history.back(1);',2000);");
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        //获得分类
                        strStorage = DataClass.GetStorageClassInfoToHTML();

                        if (Act == "Del")
                        {
                            try
                            {
                                tbStorageInfo.DeleteStorageInfo(HTTPRequest.GetString("sid"));
                                Logs.AddEventLog(this.userid, "删除仓库." + HTTPRequest.GetString("sid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                        }
                        if (Act == "State")
                        {
                            try
                            {
                                StorageID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);
                                tJson     = ",\"StorageID\":" + StorageID + "";

                                si = tbStorageInfo.GetStorageInfoModel(StorageID);

                                si.sState = si.sState == 0 ? 1 : 0;
                                tJson    += ",\"StorageState\":" + si.sState;
                                tbStorageInfo.UpdateStorageInfo(si);
                                AddMsgLine("成功!");

                                Logs.AddEventLog(this.userid, "修改仓库状态." + si.sName + ",为:" + (si.sState == 0?"正常":"屏蔽"));
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("失败!<br/>" + ex);
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }

            if (format == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + tJson + "}}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
Esempio n. 11
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-6"))
                {
                    Act = HTTPRequest.GetString("Act");
                    if (Act == "Edit")
                    {
                        PaymentSystemID = Utils.StrToInt(HTTPRequest.GetString("pid"), 0);

                        pi = tbPaymentSystemInfo.GetPaymentSystemModel(PaymentSystemID);
                    }
                    if (ispost)
                    {
                        pName = Utils.ChkSQL(HTTPRequest.GetString("pName"));

                        if (pName.Trim() != "")
                        {
                            pi.PaymentSystemID = PaymentSystemID;
                            pi.pName           = pName;

                            if (Act == "Add")
                            {
                                pi.pAppendTime = DateTime.Now;
                                if (tbPaymentSystemInfo.AddPaymentSystem(pi) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增结算系统." + pi.pName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("history.back(1);");
                                }
                            }
                            if (Act == "Edit")
                            {
                                try
                                {
                                    tbPaymentSystemInfo.UpdatePaymentSystem(pi);
                                    Logs.AddEventLog(this.userid, "修改结算系统." + pi.pName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                            }
                        }
                        else
                        {
                            AddErrLine("参数错误!<br/>");
                            AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                        }
                    }
                    else
                    {
                        if (Act == "Add")
                        {
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbPaymentSystemInfo.DeletePaymentSystem(HTTPRequest.GetString("pid"));
                                Logs.AddEventLog(this.userid, "删除结算系统." + HTTPRequest.GetString("pid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("创建失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X"))
                {
                    UserTypeList = Caches.GetUserTypeList();
                    Act          = HTTPRequest.GetString("Act");

                    uName        = Utils.ChkSQL(HTTPRequest.GetString("uName"));
                    uPWD         = Utils.ChkSQL(HTTPRequest.GetString("uPWD"));
                    uPWD_Old     = Utils.ChkSQL(HTTPRequest.GetString("uPWD_Old"));
                    uPermissions = Utils.ChkSQL(HTTPRequest.GetString("uPermissions"));
                    uEstate      = Utils.ChkSQL(HTTPRequest.GetString("uEstate"));

                    Erp_Name = Utils.ChkSQL(HTTPRequest.GetString("Erp_Name"));
                    Erp_Pwd  = Utils.ChkSQL(HTTPRequest.GetString("Erp_Pwd"));
                    g_Name   = Utils.ChkSQL(HTTPRequest.GetString("g_Name"));
                    g_PWD    = Utils.ChkSQL(HTTPRequest.GetString("g_PWD"));
                    uType    = HTTPRequest.GetInt("uType", 0);
                    StaffID  = HTTPRequest.GetInt("StaffID", 0);

                    StorageIDStr = Utils.ChkSQL(HTTPRequest.GetString("StorageIDStr"));

                    StorageIDStr = StorageIDStr.IndexOf("x") > -1 ? "x" : "," + StorageIDStr + ",";

                    pi.Erp_Name = "";
                    pi.Erp_Pwd  = "";
                    pi.g_Name   = "";
                    pi.g_PWD    = "";



                    if (Act == "Edit")
                    {
                        UserID = Utils.StrToInt(HTTPRequest.GetString("uid"), 0);

                        ui = tbUserInfo.GetUserInfoModel(UserID);
                        pi = tbUserInfo.GetUserPassportInfoModel(UserID);
                        if (pi == null)
                        {
                            pi          = new UserPassportInfo();
                            pi.Erp_Name = "";
                            pi.Erp_Pwd  = "";
                            pi.g_Name   = "";
                            pi.g_PWD    = "";
                        }

                        UserPopedomJson = UsersUtils.GetUserPopedomToJsonStr();// UsersUtils.GetUserPopedomToJsonStr(ui.uPermissions);
                    }

                    if (ispost)
                    {
                        if (ui.uPermissions != "X")
                        {
                            ui.uPermissions = uPermissions;
                        }
                        ui.uEstate      = uEstate == "0" ? 0 : 1;
                        ui.uType        = uType;
                        ui.StaffID      = StaffID;
                        ui.StorageIDStr = StorageIDStr;

                        if (Act == "Add")
                        {
                            if (!tbUserInfo.ExistsUserInfo(uName))
                            {
                                ui.uName = uName;
                                ui.uPWD  = Utils.MD5(uPWD);
                                ui.uCode = Utils.CutString(Utils.GetRanDomCode(), 16);

                                ui.uLastIP       = HTTPRequest.GetIP();
                                ui.uAppendTime   = DateTime.Now;
                                ui.uUpAppendTime = DateTime.Now;



                                pi.UserID = tbUserInfo.AddUserInfo(ui);
                                Logs.AddEventLog(this.userid, "新增用户:" + ui.uName);
                                if (pi.UserID > 0)
                                {
                                    pi.Erp_Name = Erp_Name;
                                    pi.Erp_Pwd  = Erp_Pwd;
                                    pi.g_Name   = g_Name;
                                    pi.g_PWD    = g_PWD;

                                    if (tbUserInfo.AddUserPassportInfo(pi) > 0)
                                    {
                                        AddMsgLine("创建成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    else
                                    {
                                        AddErrLine("账户创建成功,但通行证绑定失败!");
                                        AddScript("history.back(1);");
                                    }
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("history.back(1);");
                                }
                            }
                            else
                            {
                                AddErrLine("用户名:" + uName + ",已存在,请更换!");
                                AddScript("history.back(1);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            if (UserID > 0)
                            {
                                ui.UserID = UserID;
                                if (uPWD.Trim() != "")
                                {
                                    ui.uPWD = Utils.MD5(uPWD);
                                }
                                else
                                {
                                    ui.uPWD = uPWD_Old;
                                }

                                //超级管理员无需修改权限与状态
                                if (ui.uPermissions == "X")
                                {
                                    ui.uPermissions = "X";
                                    ui.uEstate      = 0;
                                }
                                try
                                {
                                    pi.UserID   = UserID;
                                    pi.Erp_Name = Erp_Name;
                                    pi.Erp_Pwd  = Erp_Pwd;
                                    pi.g_Name   = g_Name;
                                    pi.g_PWD    = g_PWD;

                                    if (tbUserInfo.UserPassportInfoExists(UserID))
                                    {
                                        tbUserInfo.UpdateUserPassportInfo(pi);
                                    }
                                    else
                                    {
                                        tbUserInfo.AddUserPassportInfo(pi);
                                    }

                                    tbUserInfo.UpdateUserInfo(ui);
                                    Logs.AddEventLog(this.userid, "修改用户:" + ui.uName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误,修改失败!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                    else
                    {
                        StorageList = tbStorageInfo.GetStorageInfoList(" sState = 0").Tables [0];

                        if (Act == "Add")
                        {
                            ui.UserID       = 0;
                            ui.uName        = "";
                            ui.uPWD         = "";
                            ui.uCode        = "";
                            ui.uEstate      = 0;
                            ui.uPermissions = "";
                            ui.StorageIDStr = "x";
                            UserPopedomJson = UsersUtils.GetUserPopedomToJsonStr();
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbUserInfo.DeleteUserInfo(HTTPRequest.GetString("uid"));
                                Logs.AddEventLog(this.userid, "删除用户:uid=>" + HTTPRequest.GetString("uid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X"))
                {
                    Classid  = HTTPRequest.GetInt("Classid", 0);
                    name     = HTTPRequest.GetString("cName");
                    Popedoms = HTTPRequest.GetString("Popedoms");

                    Act = HTTPRequest.GetString("Act");


                    if (!ispost)
                    {
                        UserPopedomJson = UsersUtils.GetUserPopedomToJsonStr();

                        if (Act == "Edit")
                        {
                            if (Classid > 0)
                            {
                                DataTable UserTypeList = UsersUtils.GetUserType();
                                foreach (DataRow dr in UserTypeList.Rows)
                                {
                                    if (Classid == int.Parse(dr["id"].ToString()))
                                    {
                                        name     = dr["name"].ToString().Trim();
                                        Popedoms = dr["Popedoms"].ToString().Trim();
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误!");
                            }
                        }
                        if (Act == "Del")
                        {
                            if (Classid > 0)
                            {
                                DataTable UserTypeList = UsersUtils.GetUserType();
                                foreach (DataRow dr in UserTypeList.Rows)
                                {
                                    if (Classid == Convert.ToInt32(dr["id"].ToString()))
                                    {
                                        dr.Delete();
                                        break;
                                    }
                                }
                                UserTypeList.AcceptChanges();
                                if (SaveDataToConfig(UserTypeList))
                                {
                                    Logs.AddEventLog(this.userid, "删除用户组");
                                    AddMsgLine("删除成功");
                                    AddScript("window.setTimeout('window.parent.HidBox();',3000);");
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误!");
                            }
                        }
                    }
                    else
                    {
                        if (Act == "Add")
                        {
                            DataTable UserTypeList = UsersUtils.GetUserType();
                            foreach (DataRow dr in UserTypeList.Rows)
                            {
                                if (name == dr["name"].ToString())
                                {
                                    AddErrLine("用户组:" + name + ",已经存在!无法添加!");
                                    break;
                                }
                            }
                            if (!IsErr())
                            {
                                DataRow[] dr = UserTypeList.Select("", "id desc");
                                if (dr.Length > 0)
                                {
                                    Classid = Convert.ToInt32(dr[0]["id"]) + 1;
                                }
                                DataRow _dr = UserTypeList.NewRow();
                                _dr["Name"]     = name;
                                _dr["ID"]       = Classid;
                                _dr["Popedoms"] = Popedoms;
                                UserTypeList.Rows.Add(_dr);
                                UserTypeList.AcceptChanges();

                                if (SaveDataToConfig(UserTypeList))
                                {
                                    Logs.AddEventLog(this.userid, "添加用户组");
                                    AddMsgLine("添加成功");
                                    AddScript("window.setTimeout('window.parent.HidBox();',3000);");
                                }
                            }
                        }
                        if (Act == "Edit")
                        {
                            if (Classid > 0)
                            {
                                DataTable UserTypeList = UsersUtils.GetUserType();
                                foreach (DataRow dr in UserTypeList.Rows)
                                {
                                    if (Classid != Convert.ToInt32(dr["id"].ToString()))
                                    {
                                        if (name == dr["name"].ToString())
                                        {
                                            AddErrLine("用户组:" + name + ",已经存在!无法修改!");
                                            break;
                                        }
                                    }
                                }
                                if (!IsErr())
                                {
                                    foreach (DataRow dr in UserTypeList.Rows)
                                    {
                                        if (Classid == Convert.ToInt32(dr["id"].ToString()))
                                        {
                                            dr["name"]     = name;
                                            dr["Popedoms"] = Popedoms;
                                        }
                                    }
                                    UserTypeList.AcceptChanges();
                                    if (SaveDataToConfig(UserTypeList))
                                    {
                                        Logs.AddEventLog(this.userid, "修改用户组");
                                        AddMsgLine("修改成功");
                                        AddScript("window.setTimeout('window.parent.HidBox();',3000);");
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("参数错误!");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                }
            }
        }
Esempio n. 14
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-2"))
                {
                    Act    = HTTPRequest.GetString("Act");
                    format = HTTPRequest.GetString("format");
                    ProductFieldValue_json = HTTPRequest.GetString("ProductFieldValue");
                    if (Act == "Edit")
                    {
                        ProductsID = Utils.StrToInt(HTTPRequest.GetString("pid"), 0);

                        pi = tbProductsInfo.GetProductsInfoModel(ProductsID);

                        ProductFieldValueList = tbProductsFieldValueInfo.GetProductsFieldValueList(" ProductsID = " + ProductsID).Tables[0];
                    }
                    if (ispost)
                    {
                        //pCode = Utils.ChkSQL(HTTPRequest.GetString("pCode"));
                        pBarcode       = Utils.ChkSQL(HTTPRequest.GetString("pBarcode").Trim());
                        pName          = Utils.ChkSQL(HTTPRequest.GetString("pName").Trim());
                        pEnName        = Utils.ChkSQL(HTTPRequest.GetString("pEnName").Trim());
                        pBrand         = Utils.ChkSQL(HTTPRequest.GetString("pBrand").Trim());
                        pStandard      = Utils.ChkSQL(HTTPRequest.GetString("pStandard").Trim());
                        pUnits         = Utils.ChkSQL(HTTPRequest.GetString("pUnits").Trim());
                        pMaxUnits      = Utils.ChkSQL(HTTPRequest.GetString("pMaxUnits").Trim());
                        pToBoxNo       = Utils.StrToInt(Utils.ChkSQL(HTTPRequest.GetString("pToBoxNo")), 0);
                        ProductClassID = Utils.StrToInt(Utils.ChkSQL(HTTPRequest.GetString("ProductClassID")), 0);
                        pState         = HTTPRequest.GetInt("pState", 1); // HTTPRequest.GetString("pState").Trim() != "" ? Utils.StrToInt(HTTPRequest.GetString("pState"), 0) : 1;
                        pDoDayQuantity = 0;                               //暂不使用,期初在各商品库存 (HTTPRequest.GetString("pDoDayQuantity").Trim() != "") ? decimal.Parse(Utils.ChkSQL(HTTPRequest.GetString("pDoDayQuantity"))) : 0;

                        pProducer  = Utils.ChkSQL(HTTPRequest.GetString("pProducer").Trim());
                        pExpireDay = Utils.ChkSQL(HTTPRequest.GetString("pExpireDay").Trim());
                        pAddress   = Utils.ChkSQL(HTTPRequest.GetString("pAddress").Trim());

                        pPrice        = (HTTPRequest.GetString("pPrice").Trim() != "") ? decimal.Parse(HTTPRequest.GetString("pPrice")) : 0;
                        pSellingPrice = (HTTPRequest.GetString("pSellingPrice").Trim() != "") ? decimal.Parse(HTTPRequest.GetString("pSellingPrice")) : 0;

                        ProductFieldValue = HTTPRequest.GetString("ProductFieldValue");

                        pi.pStandard      = pStandard;
                        pi.pUnits         = pUnits;
                        pi.pMaxUnits      = pMaxUnits;
                        pi.pToBoxNo       = pToBoxNo;
                        pi.pState         = pState;
                        pi.pBrand         = pBrand;
                        pi.pPrice         = pPrice;
                        pi.pSellingPrice  = pSellingPrice;
                        pi.pDoDayQuantity = pDoDayQuantity;
                        pi.ProductClassID = ProductClassID;
                        pi.pProducer      = pProducer;
                        pi.pExpireDay     = pExpireDay;
                        pi.pAddress       = pAddress;
                        pi.pEnName        = pEnName;


                        pi.ProductFieldValueJson = (ProductFieldValueJson)JavaScriptConvert.DeserializeObject(ProductFieldValue_json, typeof(ProductFieldValueJson));

                        if (Act == "Add")
                        {
                            pi.pCode       = Utils.GetRanDomCode();
                            pi.pBarcode    = pBarcode;
                            pi.pName       = pName;
                            pi.pAppendTime = DateTime.Now;

                            if (!tbProductsInfo.ExistsProductsInfo(pName))
                            {
                                //if (!tbProductsInfo.ExistsProductsInfo_pCode(pCode))
                                {
                                    if (!tbProductsInfo.ExistsProductsInfo_pBarcode(pBarcode))
                                    {
                                        int _ProductsID = tbProductsInfo.AddProductsInfo(pi);
                                        if (_ProductsID > 0)
                                        {
                                            //Add ProductFieldValue
                                            tbProductsFieldValueInfo.AddProductsFieldValue(_ProductsID, pi.ProductFieldValueJson);

                                            Logs.AddEventLog(this.userid, "新增产品." + pi.pName);
                                            AddMsgLine("创建成功!");
                                            AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                        }
                                        else
                                        {
                                            AddErrLine("创建失败!");
                                            AddScript("window.setTimeout('history.back(1);',1000);");
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("产品条码:" + pBarcode + ",已存在,请更换!");
                                        AddScript("window.setTimeout('history.back(1);',1000);");
                                    }
                                }
                                //else
                                {
                                    // AddErrLine("产品编码:" + pCode + ",已存在,请更换!");
                                    //AddScript("history.back(1);");
                                }
                            }
                            else
                            {
                                AddErrLine("产品:" + pName + ",已存在,请更换!");
                                AddScript("window.setTimeout('history.back(1);',1000);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            if (!tbProductsInfo.CheckProductsByOrder(pi.ProductsID) || CheckUserPopedoms("X"))
                            {
                                if (pi.pName.Trim() != pName.Trim())
                                {
                                    if (!tbProductsInfo.ExistsProductsInfo(pName))
                                    {
                                        //if (pi.pCode != pCode)
                                        {
                                            //if (!tbProductsInfo.ExistsProductsInfo_pCode(pCode))
                                            {
                                                if (pi.pBarcode.Trim() != pBarcode.Trim())
                                                {
                                                    if (!tbProductsInfo.ExistsProductsInfo_pBarcode(pBarcode))
                                                    {
                                                    }
                                                    else
                                                    {
                                                        AddErrLine("产品条码:" + pBarcode + ",已存在,请更换!");
                                                        AddScript("window.setTimeout('history.back(1);',1500);");
                                                    }
                                                }
                                            }
                                            //else
                                            {
                                                // AddErrLine("产品编码:" + pCode + ",已存在,请更换!");
                                                //AddScript("history.back(1);");
                                            }
                                        }
                                    }
                                    else
                                    {
                                        AddErrLine("产品:" + pName + ",已存在,请更换!");
                                        AddScript("window.setTimeout('history.back(1);',1500);");
                                    }
                                }
                            }
                            else
                            {
                                Logs.AddEventLog(this.userid, "修改失败,已有单据存在,系统锁定,无法删除." + pi.pName);
                                AddMsgLine("修改失败,已有单据存在,系统锁定,无法修改!");
                                AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                            }
                            if (!IsErr())
                            {
                                try
                                {
                                    //pi.pCode = pCode;
                                    pi.pBarcode = pBarcode;
                                    pi.pName    = pName;

                                    tbProductsInfo.UpdateProductsInfo(pi);

                                    tbProductsFieldValueInfo.UpdateProductsFieldValue(pi.ProductsID, pi.ProductFieldValueJson);

                                    Logs.AddEventLog(this.userid, "修改产品." + pi.pName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                                }
                            }
                        }
                        if (Act == "UpFile")
                        {
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        ProductFieldTypeList = tbProductFieldInfo.GetProductFieldTypes();
                        ProductClassStr      = DataClass.GetProductClassInfoToHTML();


                        //GetProductFieldList by ProductClassID
                        if (Act == "GetProductFieldList")
                        {
                            ProductClassID = HTTPRequest.GetInt("ProductClassID", 0);

                            MS_Json = tbProductFieldInfo.GetProductFieldListJsonByProductClassID(ProductClassID);
                        }

                        if (Act == "Edit")
                        {
                            if (ProductFieldValueList != null)
                            {
                                string __Json = "";
                                for (int k = 0; k < ProductFieldValueList.Rows.Count; k++)
                                {
                                    __Json += "{\"ProductsFieldValueID\":" + ProductFieldValueList.Rows [k] ["ProductsFieldValueID"].ToString() + "," +
                                              "\"ProductsID\":" + ProductFieldValueList.Rows [k] ["ProductsID"].ToString() + "," +
                                              "\"ProductFieldID\":" + ProductFieldValueList.Rows [k] ["ProductFieldID"].ToString() + "," +
                                              "\"pfvType\":" + ProductFieldValueList.Rows [k] ["pfvType"].ToString() + "," +
                                              "\"pfvData\":\"" + ProductFieldValueList.Rows [k] ["pfvData"].ToString().Replace("\r\n", "$r$") + "\"," +
                                              "\"pfvAppendTime\":\"" + ProductFieldValueList.Rows [k] ["pfvAppendTime"].ToString() + "\"" +
                                              "},";
                                }
                                __Json = __Json.Trim() != "" ? __Json.Trim().Substring(0, __Json.Trim().Length - 1) : "";
                                ProductFieldValueList_Json = "{\"ProductFieldValue\":[" + __Json + "]}";
                            }
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                string   _pName      = "";
                                string   _eName      = "";
                                int      _productsID = 0;
                                bool     isOK        = true;
                                string[] _pid        = Utils.SplitString("," + HTTPRequest.GetString("pid") + ",", ",");
                                foreach (string _id in _pid)
                                {
                                    _productsID = Utils.StrToInt(_id, 0);
                                    if (_productsID > 0)
                                    {
                                        if (tbProductsInfo.CheckProductsByOrder(_productsID) && !CheckUserPopedoms("X"))
                                        {
                                            isOK   = false;
                                            _eName = tbProductsInfo.GetProductsInfoModel(_productsID).pName + "ID:" + _productsID;
                                            break;
                                        }
                                        else
                                        {
                                            _pName += tbProductsInfo.GetProductsInfoModel(_productsID).pName + "ID:" + _productsID + " ";
                                        }
                                    }
                                }

                                if (isOK)
                                {
                                    tbProductsInfo.DeleteProductsInfo(HTTPRequest.GetString("pid"));
                                    Logs.AddEventLog(this.userid, "删除产品." + _pName);
                                    AddMsgLine("删除成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                                else
                                {
                                    Logs.AddEventLog(this.userid, "删除失败,已有单据存在,系统锁定,无法删除." + _eName);
                                    AddMsgLine("删除失败,已有单据存在,系统锁定,无法删除!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                            }
                        }
                        else if (Act == "Syn")
                        {
                            try
                            {
                                AddMsgLine("新增" + tbProductsInfo.SynErpProduct() + "条产品信息!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("同步失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }

            if (format == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"},\"data\":" + MS_Json + "}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
Esempio n. 15
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-4"))
                {
                    Act = HTTPRequest.GetString("Act");

                    if (Act == "Edit")
                    {
                        StoresID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);

                        si = tbStoresInfo.GetStoresInfoModel(StoresID);
                    }
                    if (ispost)
                    {
                        sName            = Utils.ChkSQL(HTTPRequest.GetString("sName"));
                        sCode            = Utils.ChkSQL(HTTPRequest.GetString("sCode"));
                        sType            = Utils.ChkSQL(HTTPRequest.GetString("sType"));
                        RegionID         = Utils.StrToInt(HTTPRequest.GetString("RegionID"), 0);
                        YHsysID          = Utils.StrToInt(HTTPRequest.GetString("YHsysID"), 0);
                        sIsFZYH          = HTTPRequest.GetString("sIsFZYH").Trim() != "" ? 1 : 0;
                        sState           = HTTPRequest.GetString("sState").Trim() != "" ? 0 : 1;
                        PaymentSystemID  = Utils.StrToInt(HTTPRequest.GetString("PaymentSystemID"), 0);
                        sDoDay           = Utils.StrToInt(HTTPRequest.GetString("sDoDay"), 0);
                        CustomersClassID = Utils.StrToInt(HTTPRequest.GetString("CustomersClassID"), 0);
                        PriceClassID     = Utils.StrToInt(HTTPRequest.GetString("PriceClassID"), 0);
                        sDoDayMoney      = decimal.Parse(HTTPRequest.GetString("sDoDayMoney").Trim() != "" ? HTTPRequest.GetString("sDoDayMoney") : "0.0");

                        sContact = Utils.ChkSQL(HTTPRequest.GetString("sContact"));
                        sTel     = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                        sAddress = Utils.ChkSQL(HTTPRequest.GetString("sAddress"));
                        sEmail   = Utils.ChkSQL(HTTPRequest.GetString("sEmail"));
                        sLicense = Utils.ChkSQL(HTTPRequest.GetString("sLicense"));

                        si.sState           = sState;
                        si.sType            = sType;
                        si.RegionID         = RegionID;
                        si.YHsysID          = YHsysID;
                        si.sIsFZYH          = sIsFZYH;
                        si.sDoDay           = sDoDay;
                        si.PaymentSystemID  = PaymentSystemID;
                        si.sDoDayMoney      = sDoDayMoney;
                        si.CustomersClassID = CustomersClassID;
                        si.PriceClassID     = PriceClassID;
                        si.sContact         = sContact;
                        si.sTel             = sTel;
                        si.sAddress         = sAddress;
                        si.sEmail           = sEmail;
                        si.sLicense         = sLicense;

                        if (Act == "Add")
                        {
                            if (!tbStoresInfo.ExistsStoresInfo(sName))
                            {
                                si.sName = sName;
                                si.sCode = sCode;

                                si.sAppendTime = sAppendTime;

                                if (tbStoresInfo.AddStoresInfo(si) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增客户." + si.sName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                AddErrLine("客户:" + sName + ",已存在,请更换!");
                                AddScript("window.setTimeout('history.back(1);',2000);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            bool nOK = false;

                            if (si.sName != sName)
                            {
                                if (!tbStoresInfo.CheckStoresByOrder(si.StoresID) || CheckUserPopedoms("X"))
                                {
                                    if (!tbStoresInfo.ExistsStoresInfo(sName))
                                    {
                                        nOK = true;
                                    }
                                    else
                                    {
                                        nOK = false;
                                        AddErrLine("客户:" + sName + ",已存在,请更换!");
                                        AddScript("window.setTimeout('history.back(1);',2000);");
                                    }
                                }
                                else
                                {
                                    nOK = false;
                                    Logs.AddEventLog(this.userid, "修改客户失败,已有单据存在,系统锁定,无法修改." + si.sName);
                                    AddErrLine("修改失败,已有单据存在,系统锁定,无法修改!");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }


                            if (si.sCode != sCode)
                            {
                                if (!tbStoresInfo.CheckStoresByOrder(si.StoresID) || CheckUserPopedoms("X"))
                                {
                                    if (!tbStoresInfo.ExistsStoresInfoCode(sCode))
                                    {
                                        nOK = true;
                                    }
                                    else
                                    {
                                        nOK = false;
                                        AddErrLine("客户 编码:" + sCode + ",已存在,请更换!");
                                        AddScript("window.setTimeout('history.back(1);',2000);");
                                    }
                                }
                                else
                                {
                                    nOK = false;
                                    Logs.AddEventLog(this.userid, "修改客户失败,已有单据存在,系统锁定,无法修改." + si.sName);
                                    AddErrLine("修改失败,已有单据存在,系统锁定,无法修改!");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }

                            if (!this.IsErr())
                            {
                                try {
                                    si.sName = sName;
                                    si.sCode = sCode;

                                    tbStoresInfo.UpdateStoresInfo(si);
                                    Logs.AddEventLog(this.userid, "修改客户." + si.sName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                } catch (Exception ex) {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                                }
                            }
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        CustomersClass = Caches.GetCustomersClassInfoToHTML();
                        Region         = Caches.GetRegionInfoToHTML();
                        PriceClass     = Caches.GetPriceClassInfoToHTML();

                        YHsysList         = Caches.GetYHsysInfoList();
                        PaymentSystemList = Caches.GetPaymentSystemList();

                        if (Act == "Add")
                        {
                            si.sName    = "";
                            si.sCode    = "";
                            si.sState   = 0;
                            si.sType    = "";
                            si.RegionID = 0;
                        }

                        if (Act == "Edit")
                        {
                            if (si != null)
                            {
                                sti   = tbStaffStoresInfo.GetStaffByStores(si.StoresID, 1);
                                sti_b = tbStaffStoresInfo.GetStaffByStores(si.StoresID, 2);

                                StaffList = tbStaffStoresInfo.GetStaff_StoresList(0, StoresID, DateTime.Now.AddYears(-100), DateTime.Now, 1);

                                StaffList_b = tbStaffStoresInfo.GetStaff_StoresList(0, StoresID, DateTime.Now.AddYears(-100), DateTime.Now, 2);

                                DataView view = new DataView();
                                view.Table = StaffList;

                                view.Sort = "bdate DESC";
                                StaffList = view.ToTable();

                                DataView view_b = new DataView();
                                view_b.Table = StaffList_b;

                                view_b.Sort = "bdate DESC";
                                StaffList_b = view_b.ToTable();
                            }
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                string   _sName    = "";
                                string   _eName    = "";
                                int      _StoresID = 0;
                                bool     isOK      = true;
                                string[] _sid      = Utils.SplitString("," + HTTPRequest.GetString("sid") + ",", ",");
                                foreach (string _id in _sid)
                                {
                                    _StoresID = Utils.StrToInt(_id, 0);
                                    if (tbStoresInfo.CheckStoresByOrder(_StoresID) && !CheckUserPopedoms("X"))
                                    {
                                        isOK   = false;
                                        _eName = tbStoresInfo.GetStoresInfoModel(_StoresID).sName + "ID:" + _StoresID;
                                        break;
                                    }
                                    else
                                    {
                                        _sName += tbStoresInfo.GetStoresInfoModel(_StoresID).sName + " ID:" + _StoresID + " ";
                                    }
                                }

                                if (isOK)
                                {
                                    tbStoresInfo.DeleteStoresInfo(HTTPRequest.GetString("sid"));
                                    Logs.AddEventLog(this.userid, "删除客户成功." + _sName);
                                    AddMsgLine("删除成功!");
                                }
                                else
                                {
                                    Logs.AddEventLog(this.userid, "删除客户失败,已有单据存在,系统锁定,无法删除." + _eName);
                                    AddMsgLine("删除失败,已有单据存在,系统锁定,无法删除!");
                                }
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("创建失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }

                        if (Act == "Import")
                        {
                            try {
                                int re = tbStoresInfo.ImportErpStores();

                                if (re > 0)
                                {
                                    AddMsgLine("成功导入 " + re + " 条客户信息!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1500);");
                                }
                                else
                                {
                                    AddErrLine("没有任何客户信息被导入!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1500);");
                                }
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("导入失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        public string FeesSubjectName = ""; //移动至某个科目下
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1-3"))
                {
                    FeesSubjectJson = Caches.GetFeesSubjectClassInfoToJson(-1, false, true);
                    sName           = HTTPRequest.GetString("sName").Trim();
                    sID             = HTTPRequest.GetInt("FeesSubjectClassID", 0);


                    if (ispost)
                    {
                        certificateID   = HTTPRequest.GetString("Content");
                        classID         = HTTPRequest.GetInt("treeNode", -1);
                        lastName        = HTTPRequest.GetString("lastName").Trim();
                        FeesSubjectName = HTTPRequest.GetString("getTreeName").Trim();

                        if (certificateID != "")
                        {
                            if (classID > -1)
                            {
                                int uState = DataClass.updateCertificateToFeessubjects(certificateID, classID, HTTPRequest.GetInt("sFeeID", 0));
                                if (uState > 0)
                                {
                                    //记录修改操作
                                    Logs.AddEventLog(this.userid, "将" + lastName + "科目下凭证移动至" + FeesSubjectName);
                                    Response.Write(uState);
                                    Response.End();
                                }
                                else
                                {
                                    Response.Write("0");
                                    Response.End();
                                }
                            }
                            else
                            {
                                AddErrLine("请核对选中的科目信息!");
                            }
                        }
                        else
                        {
                            AddErrLine("请核对选中的凭证信息!");
                        }
                    }
                    else
                    {
                        cList = DataClass.getCertificateDate(sID);
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 17
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("6-1-2"))
                {
                    Act             = HTTPRequest.GetString("Act");
                    FeesSubjectJson = Caches.GetFeesSubjectClassInfoToJson(-1, false, true);
                    if (Act == "Edit")
                    {
                        BankID = Utils.StrToInt(HTTPRequest.GetString("bid"), 0);

                        ba = tbBankInfo.GetBankModel(BankID);
                    }
                    if (ispost)
                    {
                        bName       = HTTPRequest.GetString("FeesSubject").Trim();    //账户名称
                        beginMoney  = HTTPRequest.GetString("beginMoney");            //期初金额
                        FeesSubject = HTTPRequest.GetInt("FeesSubjectID", 0);         //获取科目
                        //bAppendTime = Utils.IsDateString(Utils.ChkSQL(HTTPRequest.GetString("bAppendTime"))) ? DateTime.Parse(Utils.ChkSQL(HTTPRequest.GetString("bAppendTime"))) : DateTime.Now;  //操作日期

                        //获得科目方向
                        cDirecion = tbBankInfo.ClassDiretion(FeesSubject);
                        //检查账户名称是否存在
                        bool checkName = tbBankInfo.ExistsBank(FeesSubject);

                        //添加
                        if (Act == "Add")
                        {
                            ba.CAccountName       = bName;
                            ba.FeesSubjectClassID = FeesSubject;
                            ba.PAppendTime        = bAppendTime;
                            ba.CAccountMoney      = Convert.ToDecimal(beginMoney);
                            ba.CDirection         = Convert.ToInt32(cDirecion);

                            if (checkName)
                            {
                                AddErrLine("该资金账户[" + bName + "]已经存在!");
                            }

                            else
                            {
                                if (tbBankInfo.AddBank(ba) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增资金帐户." + ba.FeesSubjectClassID);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("history.back(1);");
                                }
                            }
                        }

                        if (Act == "Edit")
                        {
                            ba.CAccountMoney = Convert.ToDecimal(beginMoney);

                            try
                            {
                                tbBankInfo.UpdateBank(ba);
                                Logs.AddEventLog(this.userid, "修改资金帐户." + ba.FeesSubjectClassID);
                                AddMsgLine("修改成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("修改失败!<br/>" + ex);
                            }
                        }
                    }
                    else
                    {
                        if (Act == "Del")
                        {
                            try
                            {
                                string sCheckbox = HTTPRequest.GetString("bid");

                                tbBankInfo.DeleteBank(sCheckbox);
                                Logs.AddEventLog(this.userid, "删除资金帐户." + HTTPRequest.GetString("bid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 18
0
        public string Act = "";                         //获得操作步骤
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-4"))
                {
                    className = HTTPRequest.GetString("className");
                    classID   = HTTPRequest.GetInt("classID", -1);
                    Act       = HTTPRequest.GetString("Act");
                    Caches.ReSet();
                    //1.获得客户分类详情
                    pclass = DataClass.GetCustomersDetails(classID);

                    if (ispost)
                    {
                        if (Act.IndexOf("getNode") > -1)
                        {
                            string pid         = "";
                            string pName       = "";
                            string pOrder      = "";
                            string pTime       = "";
                            string pRarentID   = "";
                            string pRarentName = "";
                            //当选择到节点是统计到该节点及子节点
                            if (classID > -1)
                            {
                                if (pclass.Rows.Count > 0)
                                {
                                    for (int i = 0; i < pclass.Rows.Count; i++)
                                    {
                                        //2.获得表字段组成字符串
                                        pid      += pclass.Rows[i]["CustomersClassID"].ToString() + ",";
                                        pName    += pclass.Rows[i]["cClassName"].ToString() + ",";
                                        pOrder   += pclass.Rows[i]["cOrder"].ToString() + ",";
                                        pTime    += pclass.Rows[i]["cAppendTime"].ToString() + ",";
                                        pRarentID = pclass.Rows[i]["cParentID"].ToString();
                                    }
                                    pid    = pid.Substring(0, pid.Length - 1);
                                    pName  = pName.Substring(0, pName.Length - 1);
                                    pOrder = pOrder.Substring(0, pOrder.Length - 1);
                                    pTime  = pTime.Substring(0, pTime.Length - 1);
                                }
                                sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "'}";
                                Response.Write("{" + sTjson + "}");
                                Response.End();
                            }
                            else
                            {
                                if (pclass.Rows.Count > 0)
                                {
                                    //3.将重复的ID去掉
                                    DataView dwv = new DataView(pclass);
                                    dwv.Sort = "cParentID";
                                    pclass   = dwv.ToTable(true, "cParentID");
                                    DataTable dt = new DataTable();
                                    DataSet   ds = new DataSet();

                                    for (int j = 0; j < pclass.Rows.Count; j++)
                                    {
                                        //4.获得客户上级分类信息
                                        DataTable dtParent = DataClass.getCustomersClassList(Convert.ToInt32(pclass.Rows[j]["cParentID"].ToString()));
                                        dt           = dtParent.Copy();
                                        dt.TableName = "td_" + j;
                                        ds.Tables.Add(dt);
                                    }
                                    pParent = ds.Tables[0].Clone();                        //创建新表 克隆以有表的架构
                                    object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值
                                    for (int m = 0; m < ds.Tables.Count; m++)
                                    {
                                        if (ds.Tables[m].Rows.Count > 0)
                                        {
                                            for (int n = 0; n < ds.Tables[m].Rows.Count; n++)
                                            {
                                                ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中
                                                pParent.Rows.Add(objArray);                         //将数组的值添加到新表中
                                            }
                                        }
                                    }
                                    //5.整合表以后的字段拼接
                                    for (int i = 0; i < pParent.Rows.Count; i++)
                                    {
                                        pid         += pParent.Rows[i]["CustomersClassID"].ToString() + ",";
                                        pName       += pParent.Rows[i]["cClassName"].ToString() + ",";
                                        pOrder      += pParent.Rows[i]["cOrder"].ToString() + ",";
                                        pTime       += pParent.Rows[i]["cAppendTime"].ToString() + ",";
                                        pRarentID    = pParent.Rows[i]["cParentID"].ToString();
                                        pRarentName += pParent.Rows[i]["parentName"].ToString() + ",";
                                    }
                                    pid         = pid.Substring(0, pid.Length - 1);
                                    pName       = pName.Substring(0, pName.Length - 1);
                                    pOrder      = pOrder.Substring(0, pOrder.Length - 1);
                                    pTime       = pTime.Substring(0, pTime.Length - 1);
                                    pRarentName = pRarentName.Substring(0, pRarentName.Length - 1);
                                }

                                sTjson = "cDetails:{'pid':'" + pid + "','pname':'" + pName + "','porder':'" + pOrder + "','ptime':'" + pTime + "','parentID':'" + pRarentID + "','parentName':'" + pRarentName + "'}";
                                Response.Write("{" + sTjson + "}");
                                Response.End();
                            }
                        }
                        if (Act.IndexOf("del") > -1)
                        {
                            string trNode = HTTPRequest.GetString("trNode");
                            int    count  = 0;

                            if (trNode != "")
                            {
                                if (trNode.IndexOf(",") > -1)
                                {
                                    string[] trNodeBits = trNode.Split(',');
                                    for (int i = 0; i < trNodeBits.Length - 1; i++)
                                    {
                                        //6.删除操作(多个删除)
                                        count = DataClass.DeleteCustomersClassInfo(Convert.ToInt32(trNodeBits[i].ToString()));
                                    }
                                }
                                else
                                {
                                    //7.删除操作(单个删除)
                                    count = DataClass.DeleteCustomersClassInfo(Convert.ToInt32(trNode));
                                }
                                if (count > 0)
                                {
                                    //记录成功操作
                                    Logs.AddEventLog(this.userid, "删除" + trNode + "客户分类");
                                    Response.Write("1");
                                    Response.End();
                                }
                                else
                                {
                                    Response.Write("0");
                                    Response.End();
                                }
                            }
                            else
                            {
                                Response.Write("-1");
                                Response.End();
                            }
                        }
                    }
                    else
                    {
                        if (pclass.Rows.Count > 0)
                        {
                            //8.页面加载时候
                            DataView dwv = new DataView(pclass);
                            dwv.Sort = "cParentID";
                            pclass   = dwv.ToTable(true, "cParentID");
                            DataTable dt = new DataTable();
                            DataSet   ds = new DataSet();

                            for (int j = 0; j < pclass.Rows.Count; j++)
                            {
                                //9.获得上级分类
                                DataTable dtParent = DataClass.getCustomersClassList(Convert.ToInt32(pclass.Rows[j]["cParentID"].ToString()));
                                dt           = dtParent.Copy();
                                dt.TableName = "td_" + j;
                                ds.Tables.Add(dt);
                            }
                            pParent = ds.Tables[0].Clone();                        //创建新表 克隆以有表的架构
                            object[] objArray = new object[pParent.Columns.Count]; //定义与表列数相同的对象数组 存放表的一行的值
                            for (int m = 0; m < ds.Tables.Count; m++)
                            {
                                if (ds.Tables[m].Rows.Count > 0)
                                {
                                    for (int n = 0; n < ds.Tables[m].Rows.Count; n++)
                                    {
                                        ds.Tables[m].Rows[n].ItemArray.CopyTo(objArray, 0); //将表的一行的值存放数组中
                                        pParent.Rows.Add(objArray);                         //将数组的值添加到新表中
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
Esempio n. 19
0
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X"))
                {
                    Act    = HTTPRequest.GetString("Act");
                    format = HTTPRequest.GetString("format");

                    if (Act == "Edit" || Act == "State")
                    {
                        m_ConfigInfoID = Utils.StrToInt(HTTPRequest.GetString("mid"), 0);

                        mc = M_Utils.GetM_ConfigInfoModel(m_ConfigInfoID);
                    }
                    if (ispost)
                    {
                        int    StoresID    = Utils.StrToInt(HTTPRequest.GetString("StoresID"), 0);
                        string m_Name      = Utils.ChkSQL(HTTPRequest.GetString("m_Name"));
                        string m_AppKey    = Utils.ChkSQL(HTTPRequest.GetString("m_AppKey"));
                        string m_AppSecret = Utils.ChkSQL(HTTPRequest.GetString("m_AppSecret"));
                        int    m_State     = Utils.StrToInt(HTTPRequest.GetString("m_State"), 0);

                        if (StoresID > 0)
                        {
                            mc.m_AppKey    = m_AppKey;
                            mc.m_AppSecret = m_AppSecret;
                            mc.StoresID    = StoresID;
                            mc.m_State     = m_State;

                            if (Act == "Add")
                            {
                                if (!M_Utils.ExistsM_ConfigInfo(m_Name))
                                {
                                    mc.m_Name       = m_Name;
                                    mc.m_AppendTime = DateTime.Now;
                                    mc.m_UpdateTime = DateTime.Now;
                                    try
                                    {
                                        if (M_Utils.AddM_ConfigInfo(mc) > 0)
                                        {
                                            Logs.AddEventLog(this.userid, "新增网店配置." + mc.m_Name);
                                            AddMsgLine("添加成功!");
                                            AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                        }
                                        else
                                        {
                                            AddErrLine("添加失败,请重试!");
                                            AddScript("window.setTimeout('history.back(1);',2000);");
                                        }
                                    }
                                    catch (Exception ex) {
                                        AddErrLine("系统错误:" + ex.Message);
                                    }
                                }
                                else
                                {
                                    AddErrLine("名称重复!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            if (Act == "Edit")
                            {
                                if (mc.m_Name != m_Name && M_Utils.ExistsM_ConfigInfo(m_Name))
                                {
                                    AddErrLine("名称重复!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                                else
                                {
                                    try
                                    {
                                        mc.m_Name = m_Name;
                                        M_Utils.UpdateM_ConfigInfo(mc);
                                        Logs.AddEventLog(this.userid, "修改网店配置." + mc.m_Name);
                                        AddMsgLine("修改成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    catch (Exception ex)
                                    {
                                        AddErrLine("系统错误:" + ex.Message);
                                    }
                                }
                            }
                        }
                        else
                        {
                            AddErrLine("请选择客户!");
                            AddScript("window.setTimeout('history.back(1);',2000);");
                        }
                        Caches.ReSet();//重置缓存
                    }
                    else
                    {
                        if (Act == "State")
                        {
                            mc.m_State = mc.m_State == 0 ? 1 : 0;
                            try
                            {
                                M_Utils.UpdateM_ConfigInfo(mc);
                                Logs.AddEventLog(this.userid, "修改网店状态." + mc.m_Name);
                                tJson = ",\"idStr\":\"" + m_ConfigInfoID + "\",\"state\":\"" + mc.m_State + "\"";
                                AddMsgLine("修改成功!");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("系统错误:" + ex.Message);
                            }
                        }
                        Caches.ReSet();//重置缓存
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
            if (format == "json")
            {
                Response.ClearContent();
                Response.Buffer          = true;
                Response.ExpiresAbsolute = System.DateTime.Now.AddYears(-1);
                Response.Expires         = 0;

                Response.Charset         = "utf-8";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
                Response.ContentType     = "application/json";
                string Json_Str = "{\"results\": {\"msg\":\"" + this.msgbox_text + "\",\"state\":\"" + (!IsErr()).ToString() + "\"" + tJson + "}}";
                Response.Write(Json_Str);
                Response.End();
            }
        }
Esempio n. 20
0
        public string lastName      = "";//修改前的名称
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-1-1"))
                {
                    Act            = HTTPRequest.GetString("Act");
                    pClassName     = Utils.ChkSQL(HTTPRequest.GetString("tName").Trim());
                    productClassID = HTTPRequest.GetInt("classID", 0);
                    lastName       = HTTPRequest.GetString("lastName").Trim();

                    if (productClassID > 0)
                    {
                        pi = DataClass.GetProductClassInfoModel(productClassID);
                    }

                    if (ispost)
                    {
                        //添加
                        if (Act.IndexOf("add") > -1)
                        {
                            ProductClassInfo li = new ProductClassInfo();
                            if (pClassName != "")
                            {
                                li.pParentID   = productClassID;
                                li.pClassName  = pClassName;
                                li.pOrder      = HTTPRequest.GetInt("tOrder", 0);
                                li.pAppendTime = DateTime.Now;

                                bool hValue = DataClass.ExistsProductClassInfo(HTTPRequest.GetString("tName"), productClassID);
                                if (hValue)
                                {
                                    AddErrLine("操作失败,该条分类已经存在,请核对后重新添加!");
                                }
                                else
                                {
                                    int addCount = DataClass.AddProductClassInfo(li);
                                    if (addCount > 0)
                                    {
                                        //记录成功操作
                                        Logs.AddEventLog(this.userid, "添加" + pClassName + "商品分类");
                                        AddMsgLine("操作成功!");
                                        AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                    }
                                    else
                                    {
                                        AddErrLine("操作失败,请重新添加!");
                                    }
                                }
                            }
                            else
                            {
                                AddErrLine("操作失败,请重新添加!");
                            }
                        }
                        //修改
                        if (Act.IndexOf("update") > -1)
                        {
                            if (pClassName != "")
                            {
                                pi.ProductClassID = productClassID;
                                pi.pClassName     = pClassName;
                                pi.pAppendTime    = DateTime.Now;

                                int count = DataClass.UpdateProductClassInfo(pi);
                                if (count > 0)
                                {
                                    //记录修改操作
                                    Logs.AddEventLog(this.userid, "将" + lastName + "商品修改为" + pClassName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("修改失败!");
                                }
                            }
                            else
                            {
                                AddErrLine("修改失败!");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }
        protected virtual void Page_Load(object sender, EventArgs e)
        {
            if (this.userid > 0)
            {
                if (CheckUserPopedoms("X") || CheckUserPopedoms("2-2-3"))
                {
                    Act = HTTPRequest.GetString("Act");

                    if (Act == "Edit")
                    {
                        StoresID = Utils.StrToInt(HTTPRequest.GetString("sid"), 0);

                        si = tbSupplierInfo.GetSupplierInfoModel(StoresID);
                    }
                    if (ispost)
                    {
                        sName    = Utils.ChkSQL(HTTPRequest.GetString("sName"));
                        sCode    = Utils.ChkSQL(HTTPRequest.GetString("sCode"));
                        sAddress = Utils.ChkSQL(HTTPRequest.GetString("sAddress"));
                        sTel     = Utils.ChkSQL(HTTPRequest.GetString("sTel"));
                        sLinkMan = Utils.ChkSQL(HTTPRequest.GetString("sLinkMan"));
                        sLicense = Utils.ChkSQL(HTTPRequest.GetString("sLicense"));

                        sDoDay          = Utils.StrToInt(HTTPRequest.GetString("sDoDay"), 0);
                        SupplierClassID = Utils.StrToInt(HTTPRequest.GetString("SupplierClassID"), 0);
                        sDoDayMoney     = decimal.Parse(HTTPRequest.GetString("sDoDayMoney").Trim() != "" ? HTTPRequest.GetString("sDoDayMoney") : "0");

                        si.sName = sName;

                        si.sAddress        = sAddress;
                        si.sTel            = sTel;
                        si.sLinkMan        = sLinkMan;
                        si.sDoDay          = sDoDay;
                        si.sDoDayMoney     = sDoDayMoney;
                        si.SupplierClassID = SupplierClassID;
                        si.sLicense        = sLicense;

                        if (Act == "Add")
                        {
                            if (!tbSupplierInfo.ExistsSupplierInfo(sName))
                            {
                                si.sCode = (sCode.Trim() != "") ? sCode : tbSupplierInfo.GetNewSupplierNum();
                                si.sName = sName;
                                //si.sCode = sCode;

                                si.sAppendTime = sAppendTime;

                                if (tbSupplierInfo.AddSupplierInfo(si) > 0)
                                {
                                    Logs.AddEventLog(this.userid, "新增供应商." + si.sName);
                                    AddMsgLine("创建成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                                }
                                else
                                {
                                    AddErrLine("创建失败!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                AddErrLine("供货商:" + sName + ",已存在,请更换!");
                                AddScript("window.setTimeout('history.back(1);',2000);");
                            }
                        }
                        if (Act == "Edit")
                        {
                            bool nOK = false;
                            if (si.sName != sName)
                            {
                                if (!tbSupplierInfo.ExistsSupplierInfo(sName))
                                {
                                    nOK = true;
                                }
                                else
                                {
                                    nOK = false;
                                    AddErrLine("供货商:" + sName + ",已存在,请更换!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }
                            sCode = (sCode.Trim() != "") ? sCode : tbSupplierInfo.GetNewSupplierNum();
                            if (si.sCode != sCode)
                            {
                                if (!tbSupplierInfo.ExistsSupplierInfoCode(sCode))
                                {
                                    nOK = true;
                                }
                                else
                                {
                                    nOK = false;
                                    AddErrLine("供货商 编码:" + sCode + ",已存在,请更换!");
                                    AddScript("window.setTimeout('history.back(1);',2000);");
                                }
                            }
                            else
                            {
                                nOK = true;
                            }
                            if (nOK)
                            {
                                try
                                {
                                    si.sName = sName;
                                    si.sCode = sCode;

                                    tbSupplierInfo.UpdateSupplierInfo(si);
                                    Logs.AddEventLog(this.userid, "修改供应商." + si.sName);
                                    AddMsgLine("修改成功!");
                                    AddScript("window.setTimeout('window.parent.HidBox();',2000);");
                                }
                                catch (Exception ex)
                                {
                                    AddErrLine("修改失败!<br/>" + ex);
                                    AddScript("window.setTimeout('window.parent.HidBox();',5000);");
                                }
                            }
                        }
                        Caches.ReSet();
                    }
                    else
                    {
                        SupplierClass = DataClass.GetSupplierClassInfoToHTML();
                        if (Act == "Add")
                        {
                        }

                        if (Act == "Del")
                        {
                            try
                            {
                                tbSupplierInfo.DeleteSupplierInfo(HTTPRequest.GetString("sid"));
                                Logs.AddEventLog(this.userid, "删除供应商." + HTTPRequest.GetString("sid"));
                                AddMsgLine("删除成功!");
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                            catch (Exception ex)
                            {
                                AddErrLine("删除失败!<br/>" + ex);
                                AddScript("window.setTimeout('window.parent.HidBox();',1000);");
                            }
                        }
                    }
                }
                else
                {
                    AddErrLine("权限不足!");
                    AddScript("window.parent.HidBox();");
                }
            }
            else
            {
                AddErrLine("请先登录!");
                SetBackLink("login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
                SetMetaRefresh(1, "login.aspx?referer=" + Utils.UrlEncode(Utils.GetUrlReferrer()));
            }
        }