protected void btnSaveSPSClient_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPSClientWrapper obj = SPSClientWrapper.FindById(int.Parse(hidId.Text.Trim()));

                SystemUserWrapper clientUser = SystemUserWrapper.FindById(obj.UserID);

                if (clientUser.UserLoginID != this.txtUserID.Text.Trim())
                {
                    if (SystemUserWrapper.FindByLoginID(this.txtUserID.Text.Trim()) != null)
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "错误信息:用户已存在。";
                    }
                }


                clientUser.UserLoginID = this.txtUserID.Text.Trim();

                SPSClientWrapper.Update(obj);

                if (this.chkChangePassword.Checked && !string.IsNullOrEmpty(this.txtUserPasword.Text.Trim()))
                {
                    if (!((NHibernateMembershipProvider)Membership.Provider).ChangePassword(clientUser.UserLoginID, this.txtUserPasword.Text.Trim()))
                    {
                        ResourceManager.AjaxSuccess      = false;
                        ResourceManager.AjaxErrorMessage = "Change Password Failed!";
                        return;
                    }
                }



                winSPClientChangeUserLoginInfo.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
                return;
            }
        }
        protected void btnSaveSPSClient_Click(object sender, DirectEventArgs e)
        {
            try
            {
                SPSClientWrapper obj = SPSClientWrapper.FindById(int.Parse(hidId.Text.Trim()));

                obj.Name        = this.txtName.Text.Trim();
                obj.Description = this.txtDescription.Text.Trim();

                obj.InterceptRate         = Convert.ToDecimal(this.txtInterceptRate.Text.Trim());
                obj.DefaultPrice          = Convert.ToDecimal(this.txtDefaultPrice.Text.Trim());
                obj.SycnNotInterceptCount = Convert.ToInt32(this.txtNotInterceptCount.Text.Trim());
                obj.DefaultShowRecordDays = Convert.ToInt32(this.numShowDayRecord.Text.Trim());
                obj.SyncData = chkSyncData.Checked;

                if (obj.SyncDataSetting == null)
                {
                    obj.SyncDataSetting = new SPSDataSycnSettingWrapper();

                    SPSDataSycnSettingWrapper.Save(obj.SyncDataSetting);
                }



                if (obj.SyncData)
                {
                    if (obj.SyncDataSetting == null)
                    {
                        SPSDataSycnSettingWrapper spsDataSycnSetting = new SPSDataSycnSettingWrapper();

                        SPSDataSycnSettingWrapper.Save(spsDataSycnSetting);

                        obj.SyncDataSetting = spsDataSycnSetting;
                    }

                    obj.SyncDataSetting.SycnRetryTimes = Convert.ToInt32(txtSycnRetryTimes.Text);

                    obj.SyncDataSetting.SycnMO = fsSyncMO.Collapsed;

                    if (obj.SyncDataSetting.SycnMO.HasValue && obj.SyncDataSetting.SycnMO.Value)
                    {
                        obj.SyncDataSetting.SycnMOUrl           = txtSycnMOUrl.Text.Trim();
                        obj.SyncDataSetting.SycnMOOkMessage     = txtSycnMOOkMessage.Text.Trim();
                        obj.SyncDataSetting.SycnMOFailedMessage = txtSycnMOFailedMessage.Text.Trim();
                    }
                    else
                    {
                        obj.SyncDataSetting.SycnMOUrl           = "";
                        obj.SyncDataSetting.SycnMOOkMessage     = "";
                        obj.SyncDataSetting.SycnMOFailedMessage = "";
                    }

                    obj.SyncDataSetting.SycnMR = fsSyncMR.Collapsed;

                    if (obj.SyncDataSetting.SycnMR.HasValue && obj.SyncDataSetting.SycnMR.Value)
                    {
                        obj.SyncDataSetting.SycnMRUrl           = txtSycnMRUrl.Text.Trim();
                        obj.SyncDataSetting.SycnMROkMessage     = txtSycnMROkMessage.Text.Trim();
                        obj.SyncDataSetting.SycnMRFailedMessage = txtSycnMRFailedMessage.Text.Trim();
                    }
                    else
                    {
                        obj.SyncDataSetting.SycnMRUrl           = "";
                        obj.SyncDataSetting.SycnMROkMessage     = "";
                        obj.SyncDataSetting.SycnMRFailedMessage = "";
                    }

                    obj.SyncDataSetting.SycnSate = fsSyncState.Collapsed;

                    if (obj.SyncDataSetting.SycnSate.HasValue && obj.SyncDataSetting.SycnSate.Value)
                    {
                        obj.SyncDataSetting.SycnSateUrl           = txtSycnStateUrl.Text.Trim();
                        obj.SyncDataSetting.SycnSateOkMessage     = txtSycnStateOkMessage.Text.Trim();
                        obj.SyncDataSetting.SycnSateFailedMessage = txtSycnStateFailedMessage.Text.Trim();
                    }
                    else
                    {
                        obj.SyncDataSetting.SycnSateUrl           = "";
                        obj.SyncDataSetting.SycnSateOkMessage     = "";
                        obj.SyncDataSetting.SycnSateFailedMessage = "";
                    }

                    SPSDataSycnSettingWrapper.Save(obj.SyncDataSetting);
                }



                SPSClientWrapper.Update(obj);

                winSPSClientEdit.Hide();
                ResourceManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ResourceManager.AjaxSuccess      = false;
                ResourceManager.AjaxErrorMessage = "Error Message:" + ex.Message;
                return;
            }
        }