public bool SynTerminal(string customerID, int typeID, string terminalInfo)
    {
        this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "customerID: " + customerID);
        this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "typeID: " + typeID.ToString());
        this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, MessageType.PARAMATER, "terminalInfo: " + terminalInfo);

        //验证参数
        bool ret = ArgumentHelper.Validate("customerID", customerID, false);

        if (!ret)
        {
            this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "customerID", "参数不正确");
            this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, ret.ToString());
            return(ret);
        }

        CustomerConnectInfo cConnect = this.GetCustomerService().GetCustomerConnectByID(customerID);

        if (cConnect == null)
        {
            this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "CustomerConnect", "未找到");
            this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, "false");
            return(false);
        }

        if (typeID < 1 || typeID > 2)
        {
            this.log(LogLevel.ERROR, FunctionName.WS_SYS_TERMINAL, "typeID", "参数不正确");
            this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, "false");
            return(false);
        }

        //解密
        cPos.Admin.Service.BaseService base_service = this.GetCustomerService() as cPos.Admin.Service.BaseService;
        string s = base_service.DecryptStringByCustomer(customerID, terminalInfo);

        this.log(LogLevel.DEBUG, FunctionName.WS_SYS_TERMINAL, "DecryptCustomerTerminal", s);

        CustomerTerminalInfo terminal = (CustomerTerminalInfo)XMLGenerator.Deserialize(typeof(CustomerTerminalInfo), s);

        terminal.Customer.ID = customerID;
        switch (typeID)
        {
        case 1:    //新建
            ret = this.GetCustomerService().InsertCustomerTerminalFromCP(terminal);
            break;

        case 2:    //修改
            ret = this.GetCustomerService().ModifyCustomerTerminalFromCP(terminal);
            break;

        default:
            ret = false;
            break;
        }
        this.log(LogLevel.INFO, FunctionName.WS_SYS_TERMINAL, MessageType.RESULT, ret.ToString());
        return(ret);
    }
예제 #2
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);
    }