コード例 #1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (this.hidServiceType.Value.ToInt(0) < 1)
     {
         this.ShowMsg("请选择客服类型", false);
     }
     else
     {
         string text = Globals.StripAllTags(this.txtAccount.Text.Trim());
         if (string.IsNullOrEmpty(text) || text.Length > 50)
         {
             this.ShowMsg("请输入客服帐号,帐号长度必须在50个字符以内", false);
         }
         else
         {
             string text2 = Globals.StripAllTags(this.txtNickName.Text.Trim());
             if (string.IsNullOrEmpty(text2) || text2.Length > 50)
             {
                 this.ShowMsg("请输入显示昵称,昵称长度必须在50个字符以内", false);
             }
             else
             {
                 int imageType = 1;
                 int.TryParse(this.txtImageType.Text, out imageType);
                 int orderId = 0;
                 int.TryParse(this.txtOrderId.Text, out orderId);
                 OnlineServiceInfo onlineServiceInfo = new OnlineServiceInfo();
                 onlineServiceInfo.Account     = text;
                 onlineServiceInfo.ImageType   = imageType;
                 onlineServiceInfo.NickName    = text2;
                 onlineServiceInfo.OrderId     = orderId;
                 onlineServiceInfo.ServiceType = this.hidServiceType.Value.ToInt(0);
                 onlineServiceInfo.Status      = (this.hidShowStatus.Value.ToBool() ? 1 : 0);
                 if (this.hidID.Value.ToInt(0) > 0)
                 {
                     onlineServiceInfo.Id = this.hidID.Value.ToInt(0);
                     if (OnlineServiceHelper.Update(onlineServiceInfo))
                     {
                         this.ShowMsg("成功编辑了一个在线客服", true);
                         this.BindOnlineService();
                     }
                     else
                     {
                         this.ShowMsg("未知错误", false);
                     }
                 }
                 else if (OnlineServiceHelper.SaveOnlineService(onlineServiceInfo))
                 {
                     this.ShowMsg("成功添加了一个在线客服", true);
                     this.BindOnlineService();
                 }
                 else
                 {
                     this.ShowMsg("未知错误", false);
                 }
                 this.Reset();
             }
         }
     }
 }
コード例 #2
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            OnlineServiceInfo onlineServiceInfo = OnlineServiceHelper.GetOnlineServiceInfo(this.ServiceId);

            if (onlineServiceInfo == null)
            {
                base.GotoResourceNotFound();
            }
            else if (!this.dropServiceType.SelectedValue.HasValue)
            {
                this.ShowMsg("请选择客服类型", false);
            }
            else
            {
                string text = Globals.StripAllTags(this.txtAccount.Text.Trim());
                if (string.IsNullOrEmpty(text) || text.Length > 50)
                {
                    this.ShowMsg("请输入客服帐号,帐号长度必须在50个字符以内", false);
                }
                else
                {
                    string text2 = Globals.StripAllTags(this.txtNickName.Text.Trim());
                    if (string.IsNullOrEmpty(text2) || text2.Length > 50)
                    {
                        this.ShowMsg("请输入显示昵称,昵称长度必须在50个字符以内", false);
                    }
                    else
                    {
                        int imageType = 1;
                        int.TryParse(this.txtImageType.Text, out imageType);
                        int orderId = 0;
                        int.TryParse(this.txtOrderId.Text, out orderId);
                        onlineServiceInfo.Id          = this.ServiceId;
                        onlineServiceInfo.Account     = text;
                        onlineServiceInfo.ImageType   = imageType;
                        onlineServiceInfo.NickName    = text2;
                        onlineServiceInfo.OrderId     = orderId;
                        onlineServiceInfo.ServiceType = this.dropServiceType.SelectedValue.Value;
                        onlineServiceInfo.Status      = (this.radioShowStatus.SelectedValue ? 1 : 0);
                        if (OnlineServiceHelper.Update(onlineServiceInfo))
                        {
                            this.ShowMsg("成功编辑了一个在线客服", true);
                        }
                        else
                        {
                            this.ShowMsg("未知错误", false);
                        }
                    }
                }
            }
        }