protected void storeSPSendClientParams_Refresh(object sender, StoreRefreshDataEventArgs e)
        {
            int    recordCount   = 0;
            string sortFieldName = "";

            if (e.Sort != null)
            {
                sortFieldName = e.Sort;
            }

            int startIndex = 0;

            if (e.Start > -1)
            {
                startIndex = e.Start;
            }

            int limit = this.PagingToolBar1.PageSize;

            int pageIndex = 1;

            if ((startIndex % limit) == 0)
            {
                pageIndex = startIndex / limit + 1;
            }
            else
            {
                pageIndex = startIndex / limit;
            }

            storeSPSendClientParams.DataSource = SPClientChannelSycnParamsWrapper.FindAllByOrderByAndFilterAndClientChannelSettingID(sortFieldName, (e.Dir == SortDirection.DESC), pageIndex, limit, SPClientChannelSettingWrapper.FindById(ChannleClientID), out recordCount);
            e.TotalCount = recordCount;

            storeSPSendClientParams.DataBind();
        }
        protected void btnSaveSPSendClientParams_Click(object sender, AjaxEventArgs e)
        {
            try
            {
                SPClientChannelSycnParamsWrapper obj = SPClientChannelSycnParamsWrapper.FindById(int.Parse(hidId.Text.Trim()));
                obj.Name          = this.txtName.Text.Trim();
                obj.Description   = this.txtDescription.Text.Trim();
                obj.IsEnable      = this.chkIsEnable.Checked;
                obj.IsRequired    = this.chkIsRequired.Checked;
                obj.MappingParams = this.cmbMappingParams.SelectedItem.Value.Trim();
                obj.Title         = this.txtTitle.Text.Trim();

                SPClientChannelSycnParamsWrapper.Update(obj);

                winSPSendClientParamsEdit.Hide();
            }
            catch
            (Exception
             ex)
            {
                Coolite.Ext.Web.ScriptManager.AjaxSuccess      = false;
                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }
 public void FromWrapper(SPClientChannelSycnParamsWrapper wrapper)
 {
     this.Id                     = wrapper.Id;
     this.Name                   = wrapper.Name;
     this.Description            = wrapper.Description;
     this.IsEnable               = wrapper.IsEnable;
     this.IsRequired             = wrapper.IsRequired;
     this.ClientChannelSettingID = (wrapper.ClientChannelSettingID != null) ? wrapper.ClientChannelSettingID.Id : 0;
     this.MappingParams          = wrapper.MappingParams;
     this.Title                  = wrapper.Title;
 }
        public SPClientChannelSycnParamsWrapper ToWrapper()
        {
            SPClientChannelSycnParamsWrapper wrapper = new SPClientChannelSycnParamsWrapper();

            wrapper.Id                     = this.Id;
            wrapper.Name                   = this.Name;
            wrapper.Description            = this.Description;
            wrapper.IsEnable               = this.IsEnable;
            wrapper.IsRequired             = this.IsRequired;
            wrapper.ClientChannelSettingID = (this.ClientChannelSettingID == null) ? null : SPClientChannelSettingWrapper.FindById(this.ClientChannelSettingID);
            wrapper.MappingParams          = this.MappingParams;
            wrapper.Title                  = this.Title;

            return(wrapper);
        }
        public void PatchAdd()
        {
            try
            {
                SPClientChannelSycnParamsWrapper.PatchAdd(ChannleClientID);

                ScriptManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
        public void DeleteRecord(int id)
        {
            try
            {
                SPClientChannelSycnParamsWrapper.DeleteByID(id);

                ScriptManager.AjaxSuccess = true;
            }
            catch (Exception ex)
            {
                ScriptManager.AjaxSuccess      = false;
                ScriptManager.AjaxErrorMessage = string.Format(ex.Message);
                return;
            }
        }
        protected void btnSaveSPSendClientParams_Click(object sender, AjaxEventArgs e)
        {
            try
            {
                SPClientChannelSycnParamsWrapper obj = new SPClientChannelSycnParamsWrapper();
                obj.Name                   = this.txtName.Text.Trim();
                obj.Description            = this.txtDescription.Text.Trim();
                obj.IsEnable               = this.chkIsEnable.Checked;
                obj.IsRequired             = this.chkIsRequired.Checked;
                obj.ClientChannelSettingID = SPClientChannelSettingWrapper.FindById(Convert.ToInt32(this.hidClientID.Text.Trim()));
                obj.MappingParams          = this.cmbMappingParams.SelectedItem.Value.Trim();
                obj.Title                  = this.txtTitle.Text.Trim();
                SPClientChannelSycnParamsWrapper.Save(obj);

                winSPSendClientParamsAdd.Hide();
            }
            catch (Exception ex)
            {
                Coolite.Ext.Web.ScriptManager.AjaxSuccess      = false;
                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message;
            }
        }
        public void Show(int id)
        {
            try
            {
                SPClientChannelSycnParamsWrapper obj = SPClientChannelSycnParamsWrapper.FindById(id);

                if (obj != null)
                {
                    this.txtName.Text          = obj.Name.ToString();
                    this.txtDescription.Text   = obj.Description.ToString();
                    this.chkIsEnable.Checked   = ValueConvertUtil.ConvertNullableValue <bool>(obj.IsEnable);
                    this.chkIsRequired.Checked = ValueConvertUtil.ConvertNullableValue <bool>(obj.IsRequired);
                    this.lblClientName.Text    = obj.ClientChannelSettingID.Name.ToString();
                    this.cmbMappingParams.SetValue(obj.MappingParams.ToString());
                    this.txtTitle.Text = obj.Title;



                    hidId.Text = id.ToString();


                    winSPSendClientParamsEdit.Show();
                }
                else
                {
                    ScriptManager.AjaxSuccess      = false;
                    ScriptManager.AjaxErrorMessage = "错误信息:数据不存在";
                    return;
                }
            }
            catch (Exception ex)
            {
                Coolite.Ext.Web.ScriptManager.AjaxSuccess      = false;
                Coolite.Ext.Web.ScriptManager.AjaxErrorMessage = "错误信息:" + ex.Message;
                return;
            }
        }