Beispiel #1
0
        private void InitForModify()
        {
            IPStrategyInfo dataById = SinGooCMS.BLL.IPStrategy.GetDataById(base.OpID);

            if (dataById.IPAddress.IndexOf('-') == -1)
            {
                this.TextBox1.Text = dataById.IPAddress;
            }
            else
            {
                this.TextBox1.Text = dataById.IPAddress.Split(new char[]
                {
                    '-'
                })[0];
                this.TextBox2.Text = dataById.IPAddress.Split(new char[]
                {
                    '-'
                })[1];
            }
            ListItem listItem = this.DropDownList3.Items.FindByValue(dataById.Strategy);

            if (listItem != null)
            {
                listItem.Selected = true;
            }
        }
Beispiel #2
0
 protected void lnk_Delete_Click(object sender, System.EventArgs e)
 {
     if (!base.IsAuthorizedOp(ActionType.Delete.ToString()))
     {
         base.H5Tip(this.UpdatePanel1, "Không có thẩm quyền");
     }
     else
     {
         int            @int     = WebUtils.GetInt((sender as LinkButton).CommandArgument);
         IPStrategyInfo dataById = SinGooCMS.BLL.IPStrategy.GetDataById(@int);
         if (dataById == null)
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Không tìm thấy dữ liệu, dữ liệu không tồn tại hoặc đã bị xóa ");
         }
         else if (SinGooCMS.BLL.IPStrategy.Delete(@int))
         {
             this.BindData();
             PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除IP策略[" + dataById.IPAddress + "] thành công");
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công");
         }
         else
         {
             base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại");
         }
     }
 }
Beispiel #3
0
        public static int Add(IPStrategyInfo entity)
        {
            int result;

            if (entity == null)
            {
                result = 0;
            }
            else
            {
                result = BizBase.dbo.InsertModel <IPStrategyInfo>(entity);
            }
            return(result);
        }
Beispiel #4
0
 public static bool Update(IPStrategyInfo entity)
 {
     return(entity != null && BizBase.dbo.UpdateModel <IPStrategyInfo>(entity));
 }
Beispiel #5
0
 protected void btnok_Click(object sender, System.EventArgs e)
 {
     if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString()))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString()))
     {
         base.ShowMsg("Không có thẩm quyền");
     }
     else
     {
         IPStrategyInfo iPStrategyInfo = new IPStrategyInfo();
         if (base.IsEdit)
         {
             iPStrategyInfo = SinGooCMS.BLL.IPStrategy.GetDataById(base.OpID);
         }
         string @string = WebUtils.GetString(this.TextBox1.Text);
         string string2 = WebUtils.GetString(this.TextBox2.Text);
         iPStrategyInfo.AutoTimeStamp = System.DateTime.Now;
         if (string.IsNullOrEmpty(@string) && string.IsNullOrEmpty(string2))
         {
             base.ShowMsg("IP地址不能为空");
         }
         else if (!string.IsNullOrEmpty(@string) && !ValidateUtils.IsIP(@string))
         {
             base.ShowMsg("起始IP不是有效的IP格式");
         }
         else if (!string.IsNullOrEmpty(string2) && !ValidateUtils.IsIP(string2))
         {
             base.ShowMsg("结束IP不是有效的IP格式");
         }
         else
         {
             if (!string.IsNullOrEmpty(@string) && !string.IsNullOrEmpty(string2))
             {
                 iPStrategyInfo.IPAddress = @string + "-" + string2;
             }
             else if (!string.IsNullOrEmpty(@string))
             {
                 iPStrategyInfo.IPAddress = @string;
             }
             else if (!string.IsNullOrEmpty(string2))
             {
                 iPStrategyInfo.IPAddress = string2;
             }
             iPStrategyInfo.Strategy = this.DropDownList3.SelectedValue;
             if (base.Action.Equals(ActionType.Add.ToString()))
             {
                 if (SinGooCMS.BLL.IPStrategy.Add(iPStrategyInfo) > 0)
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加IP策略[" + iPStrategyInfo.IPAddress + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
                 else
                 {
                     base.ShowMsg("添加IP策略失败");
                 }
             }
             if (base.Action.Equals(ActionType.Modify.ToString()))
             {
                 if (SinGooCMS.BLL.IPStrategy.Update(iPStrategyInfo))
                 {
                     PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改IP策略[" + iPStrategyInfo.IPAddress + "] thành công");
                     MessageUtils.DialogCloseAndParentReload(this);
                 }
                 else
                 {
                     base.ShowMsg("修改IP策略失败");
                 }
             }
         }
     }
 }