protected void btnSubmit_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                IDeviceService service = ServiceFactory.GetService <IDeviceService>();

                bool       isRegister = false;
                DeviceInfo entity     = null;

                if (this.IsInsert)
                {
                    entity = new DeviceInfo()
                    {
                        DeviceNumber    = this.txtDeviceNumber.Text.Trim(),
                        SoftwareVersion = this.txtSoftwareVersion.Text.Trim(),
                        RegisterIp      = this.txtRegisterIp.Text.Trim(),
                        KindCode        = this.ddlDeviceKind.SelectedValue.ToByte(0),
                        ModelCode       = this.ddlDeviceModel.SelectedValue.ToByte(0),
                        OrgId           = this.hfOrgId.Value.Trim().ToInt(),
                        OnLineTime      = this.txtOnLineTime.Text.Trim().ToDateTime(),
                        DeviceStatus    = this.ddlDeviceStatus.SelectedValue.ToByte(0)
                    };

                    if (service.CheckExists_Info(entity))
                    {
                        this.JscriptMsg("设备号码已存在", null, "Error");

                        return;
                    }
                }

                else
                {
                    entity = service.GetObject_Info(this.PkId);

                    if (entity != null)
                    {
                        isRegister = (entity.OrgId == 0 && entity.KindCode == 0 && entity.ModelCode == 0);

                        entity.SoftwareVersion = this.txtSoftwareVersion.Text.Trim();
                        entity.RegisterIp      = this.txtRegisterIp.Text.Trim();
                        entity.KindCode        = this.ddlDeviceKind.SelectedValue.ToByte(0);
                        entity.ModelCode       = this.ddlDeviceModel.SelectedValue.ToByte(0);
                        entity.OrgId           = this.hfOrgId.Value.Trim().ToInt();
                        entity.OnLineTime      = this.txtOnLineTime.Text.Trim().ToDateTime();
                        entity.DeviceStatus    = this.ddlDeviceStatus.SelectedValue.ToByte(0);
                    }
                }

                service.Save_Info(entity);

                if (isRegister)
                {
                    CurrencyInfo objCurrencyInfo = new CurrencyInfo()
                    {
                        OrgId           = entity.OrgId,
                        DeviceNumber    = entity.DeviceNumber,
                        DeviceKindCode  = entity.KindCode,
                        DeviceModelCode = entity.ModelCode
                    };

                    ICurrencyService currencyService = ServiceFactory.GetService <ICurrencyService>();

                    currencyService.BatchRegister_Info(objCurrencyInfo);
                }

                if (this.IsInsert && (sender as Button).CommandName == "SubmitContinue")
                {
                    this.ReturnUrl = this.Request.Url.PathAndQuery;
                }

                this.JscriptMsg("数据保存成功", this.ReturnUrl, "Success");
            }
        }