Esempio n. 1
0
    //获取新建或更新后的终端数据
    private CustomerTerminalInfo GetNewTerminalInfo()
    {
        var customerTerminalInfo = new CustomerTerminalInfo();

        customerTerminalInfo.Type          = this.tbType.SelectedValue;
        customerTerminalInfo.Brand         = this.tbBrand.Text ?? "";
        customerTerminalInfo.Model         = this.tbModel.Text ?? "";
        customerTerminalInfo.Code          = this.tbCode.Text ?? "";
        customerTerminalInfo.SN            = this.tbSN.Text ?? "";
        customerTerminalInfo.PurchaseDate  = this.tbPurchaseDate.Value;
        customerTerminalInfo.InsuranceDate = this.tbInsuranceDate.Value;
        customerTerminalInfo.Remark        = this.tbRemark.Text ?? "";
        if (Convert.ToInt32(ViewState["action"]) == 2)
        {
            customerTerminalInfo.HoldType = "1";
            var customerInfo = new CustomerInfo();
            customerInfo.ID = this.Request.QueryString["customer_id"];
            customerTerminalInfo.Customer        = customerInfo;
            customerTerminalInfo.SoftwareVersion = tbSoftwareVersion.Text ?? "";
            customerTerminalInfo.DBVersion       = tbDBVersion.Text ?? "";
            customerTerminalInfo.WS  = tbWS.Text ?? "";
            customerTerminalInfo.WS2 = tbWS2.Text ?? "";
            var creater = new UserOperateInfo();
            creater.Name = tbCreater.Text;
            customerTerminalInfo.Creater    = creater;
            customerTerminalInfo.CreateTime = DateTime.Now;
        }
        customerTerminalInfo.HaveCashbox       = Convert.ToInt32(this.chkCashBox.Checked);
        customerTerminalInfo.CashboxNo         = this.tbCashNo.Text ?? "";
        customerTerminalInfo.HavePrinter       = Convert.ToInt32(this.chkPrinter.Checked);
        customerTerminalInfo.PrinterNo         = this.tbPrinterNo.Text ?? "";
        customerTerminalInfo.HaveClientDisplay = Convert.ToInt32(this.chkClientDisplay.Checked);
        customerTerminalInfo.ClientDisplayNo   = this.tbClientDisplayNo.Text ?? "";
        customerTerminalInfo.HaveScanner       = Convert.ToInt32(this.chkScanner.Checked);
        customerTerminalInfo.ScannerNo         = this.tbScannerNo.Text ?? "";
        customerTerminalInfo.HaveEcard         = Convert.ToInt32(this.chkEcard.Checked);
        customerTerminalInfo.EcardNo           = tbEcardNo.Text ?? "";
        customerTerminalInfo.HaveHolder        = Convert.ToInt32(chkHolder.Checked);
        customerTerminalInfo.HolderNo          = tbHolderNo.Text ?? "";
        customerTerminalInfo.HaveOtherDevice   = Convert.ToInt32(chkOtherDevice.Checked);
        customerTerminalInfo.OtherDeviceNo     = tbOtherDeviceNo.Text;
        var editor = new UserOperateInfo();

        editor.Name = LoggingSession.UserName;
        customerTerminalInfo.LastEditor   = editor;
        customerTerminalInfo.LastEditTime = DateTime.Now;
        //todo:检查
        //customerTerminalInfo.LastSystemModifyStamp = DateTime.Now;
        customerTerminalInfo.SoftwareVersion = this.tbSoftwareVersion.Text;
        customerTerminalInfo.DBVersion       = this.tbDBVersion.Text;
        customerTerminalInfo.WS  = this.tbWS.Text;
        customerTerminalInfo.WS2 = this.tbWS2.Text;
        return(customerTerminalInfo);
    }
Esempio n. 2
0
    //加载客户数据
    private CustomerInfo getCustomerInfo()
    {
        try
        {
            var customerService = this.GetCustomerService();
            var customerInfo    = new CustomerInfo();
            customerInfo.Code              = tbCode.Text;
            customerInfo.Name              = tbname.Text;
            customerInfo.EnglishName       = tbEnglishName.Text;
            customerInfo.StartDate         = tbStartDate.Value;
            customerInfo.Address           = tbAddress.Text;
            customerInfo.PostCode          = tbPostcode.Text;
            customerInfo.Contacter         = tbContacter.Text;
            customerInfo.Fax               = tbFax.Text;
            customerInfo.Tel               = tbTel.Text;
            customerInfo.Cell              = tbCell.Text;
            customerInfo.Email             = tbEmail.Text;
            customerInfo.Memo              = tbRemark.Text;
            customerInfo.StatusDescription = tbStatus.Text;
            customerInfo.IsALD             = Convert.ToInt32(cbIsALD.SelectedValue);
            //customerInfo.DataDeployId = cbCustomer.SelectedValue;
            var depIds    = GetSelectedIds();
            var depIdList = depIds.Split(',');
            if (depIdList != null && depIdList.Length > 1)
            {
                this.InfoBox.ShowPopError("只能选择一个连接信息!");
                return(null);
            }
            if (depIdList != null && depIdList.Length == 1)
            {
                customerInfo.DataDeployId = depIdList[0];
            }

            var tmpDepQuery = new Hashtable();
            tmpDepQuery["DataDeployId"] = customerInfo.DataDeployId;
            var depItemList = customerService.GetTDataDeployList(tmpDepQuery, 1, 0);
            if (depItemList == null || depItemList.Count == 0)
            {
                this.InfoBox.ShowPopError("请选择连接信息!");
                return(null);
            }
            var depItemObj = depItemList[0];


            var connection = new CustomerConnectInfo();
            connection.Customer.ID      = customerInfo.ID;
            connection.AccessURL        = depItemObj.access_url;
            connection.DBName           = depItemObj.db_name;
            connection.DBPassword       = depItemObj.db_pwd;
            connection.DBServer         = depItemObj.db_server;
            connection.DBUser           = depItemObj.db_user;
            connection.KeyFile          = depItemObj.key_file;
            connection.MaxShopCount     = depItemObj.max_shop_count;
            connection.MaxTerminalCount = depItemObj.max_terminal_count;
            connection.MaxUserCount     = depItemObj.max_user_count;
            customerInfo.Connect        = connection;
            List <CustomerMenuInfo> menus = new List <CustomerMenuInfo>();
            foreach (TreeNode item in tvMenu.CheckedNodes)
            {
                menus.Add(new CustomerMenuInfo {
                    Menu = new MenuInfo {
                        ID = item.Value
                    }
                });
            }
            customerInfo.Menus = menus.Count == 0 ? null : menus;
            if (Convert.ToInt32(ViewState["action"]) == 2)
            {
                var creater = new UserOperateInfo();
                creater.Name            = tbCreater.Text;
                customerInfo.Creater    = creater;
                customerInfo.CreateTime = Convert.ToDateTime(tbCreateTime.Text);
                customerInfo.Status     = 1;//状态正常
            }
            else
            {
                customerInfo.ID = this.Request.QueryString["customer_id"];
                var editor = new UserOperateInfo();
                editor.Name               = SessionManager.CurrentLoggingSession.CustomerName;
                customerInfo.LastEditor   = editor;
                customerInfo.LastEditTime = DateTime.Now;
            }
            return(customerInfo);
        }
        catch (Exception ex)
        {
            PageLog.Current.Write(ex);
            this.InfoBox.ShowPopError("加载数据出错!");
            return(null);
        }
    }
Esempio n. 3
0
    //加载客户数据
    private CustomerInfo getCustomerInfo()
    {
        try
        {
            var customerService = this.GetCustomerService();
            var customerInfo    = new CustomerInfo();
            customerInfo.Code              = tbCode.Text;
            customerInfo.Name              = tbname.Text;
            customerInfo.EnglishName       = tbEnglishName.Text;
            customerInfo.StartDate         = tbStartDate.Value;
            customerInfo.Address           = tbAddress.Text;
            customerInfo.PostCode          = tbPostcode.Text;
            customerInfo.Contacter         = tbContacter.Text;
            customerInfo.Fax               = tbFax.Text;
            customerInfo.Tel               = tbTel.Text;
            customerInfo.Cell              = tbCell.Text;
            customerInfo.Email             = tbEmail.Text;
            customerInfo.Memo              = tbRemark.Text;
            customerInfo.StatusDescription = tbStatus.Text;
            if (tbUnits.Text.Trim().Length > 0 && isNumberic(tbUnits.Text.Trim()))
            {
                customerInfo.Units = Convert.ToInt32(tbUnits.Text.Trim());
            }
            else
            {
                customerInfo.Units = -1;
            }
            //customerInfo.IsALD = Convert.ToInt32(cbIsALD.SelectedValue);
            //customerInfo.DataDeployId = cbCustomer.SelectedValue;
            var depIds    = GetSelectedIds();
            var depIdList = depIds.Split(',');
            if (depIdList != null && depIdList.Length > 1)
            {
                this.InfoBox.ShowPopError("只能选择一个连接信息!");
                return(null);
            }
            if (depIdList != null && depIdList.Length == 1)
            {
                customerInfo.DataDeployId = depIdList[0];
            }

            var tmpDepQuery = new Hashtable();
            tmpDepQuery["DataDeployId"] = customerInfo.DataDeployId;
            var depItemList = customerService.GetTDataDeployList(tmpDepQuery, 1, 0);//为什么还要这一步,前面取的已经是数据库配置信息了。
            //再次判断数据库里是否有这个链接
            if (depItemList == null || depItemList.Count == 0)
            {
                this.InfoBox.ShowPopError("请选择连接信息!");
                return(null);
            }
            var depItemObj = depItemList[0];//从数据库里获取完整的配置信息


            var connection = new CustomerConnectInfo();
            connection.Customer.ID      = customerInfo.ID;
            connection.AccessURL        = depItemObj.access_url;//从完整的数据库配置信息里,取数据。
            connection.DBName           = depItemObj.db_name;
            connection.DBPassword       = depItemObj.db_pwd;
            connection.DBServer         = depItemObj.db_server;
            connection.DBUser           = depItemObj.db_user;
            connection.KeyFile          = depItemObj.key_file;
            connection.MaxShopCount     = depItemObj.max_shop_count;
            connection.MaxTerminalCount = depItemObj.max_terminal_count;
            connection.MaxUserCount     = depItemObj.max_user_count;
            customerInfo.Connect        = connection;
            #region 菜单信息
            List <CustomerMenuInfo> menus = new List <CustomerMenuInfo>();
            foreach (TreeNode item in tvMenu.CheckedNodes)
            {
                menus.Add(new CustomerMenuInfo {
                    Menu = new MenuInfo {
                        ID = item.Value
                    }
                });
            }
            customerInfo.Menus = menus.Count == 0 ? null : menus;
            #endregion
            #region 操作信息
            if (Convert.ToInt32(ViewState["action"]) == 2)
            {
                var creater = new UserOperateInfo();
                creater.Name            = tbCreater.Text;
                customerInfo.Creater    = creater;
                customerInfo.CreateTime = Convert.ToDateTime(tbCreateTime.Text);
                customerInfo.Status     = 1;//状态正常
            }
            else
            {
                customerInfo.ID = this.Request.QueryString["customer_id"];
                var editor = new UserOperateInfo();
                editor.Name               = SessionManager.CurrentLoggingSession.CustomerName;//修改人用当前登录人信息
                customerInfo.LastEditor   = editor;
                customerInfo.LastEditTime = DateTime.Now;
            }
            #endregion
            //添加UnitID ,运营商ID
            if (SessionManager.CurrentLoggingSession.unit_id != "")//如果当前的用户是运营商客户,那么不让其选择运营商
            {
                customerInfo.UnitId = SessionManager.CurrentLoggingSession.unit_id;
            }
            else
            {
                var unitIds = GetUnitSelectedIds();
                if (unitIds != null)
                {
                    var unitIdsList = unitIds.Split(',');
                    if (unitIdsList != null && unitIdsList.Length > 1)
                    {
                        this.InfoBox.ShowPopError("只能选择一个运营商!");
                        return(null);
                    }
                    if (unitIdsList != null && unitIdsList.Length == 1)
                    {
                        customerInfo.UnitId = unitIdsList[0];
                    }
                }
            }
            //这里要根据登录账户本身带不带unitId,如果带,就用账户自身的unitId,如果不带就用上面的id

            return(customerInfo);
        }
        catch (Exception ex)
        {
            PageLog.Current.Write(ex);
            this.InfoBox.ShowPopError("加载数据出错!");
            return(null);
        }
    }