protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); AutoRlyInfo dataById = AutoRly.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa"); } else if (AutoRly.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除自动回复关键字[" + dataById.MsgKey + "] 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"); } } }
private void InitForModify() { AutoRlyInfo dataById = AutoRly.GetDataById(base.OpID); if (dataById != null) { this.TextBox5.Text = dataById.MsgKey; this.TextBox1.Text = dataById.MsgText; this.TextBox2.Text = dataById.MediaPath; this.Image1.ImageUrl = dataById.MediaPath; this.Image1.Attributes.Add("data-original", dataById.MediaPath); this.TextBox3.Text = dataById.Description; this.TextBox4.Text = dataById.LinkUrl; } }
protected void btnok_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { AutoRlyInfo autoRlyInfo = new AutoRlyInfo(); if (base.IsEdit) { autoRlyInfo = AutoRly.GetDataById(base.OpID); } autoRlyInfo.RlyType = "关键字回复"; autoRlyInfo.MsgKey = WebUtils.GetString(this.TextBox5.Text); autoRlyInfo.MsgText = WebUtils.GetString(this.TextBox1.Text); autoRlyInfo.MediaPath = WebUtils.GetString(this.TextBox2.Text); autoRlyInfo.Description = WebUtils.GetString(this.TextBox3.Text); autoRlyInfo.LinkUrl = WebUtils.GetString(this.TextBox4.Text); autoRlyInfo.AutoTimeStamp = System.DateTime.Now; if (string.IsNullOrEmpty(autoRlyInfo.MsgText)) { base.ShowMsg("文本内容不能为空"); } else { if (base.Action.Equals(ActionType.Add.ToString())) { if (AutoRly.Add(autoRlyInfo) > 0) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加微信自动回复关键字[" + autoRlyInfo.MsgKey + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "MessageKeyRly.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("添加失败"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (AutoRly.Update(autoRlyInfo)) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改微信自动回复关键字[" + autoRlyInfo.MsgKey + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "MessageKeyRly.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("修改失败"); } } } } }