protected void Save_Btn(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["tid"])) { Gov_Model_TypeInfo gov_Model_TypeInfo = this.ViewState["sd"] as Gov_Model_TypeInfo; gov_Model_TypeInfo.Notes = this.Notes.Value; gov_Model_TypeInfo.TypeName = this.TypeName.Value.Replace("#", "").Replace(",", ""); gov_Model_TypeInfo.Orders = Convert.ToInt32(this.Orders.Value); if (Convert.ToInt32(this.parentID.SelectedValue) != gov_Model_TypeInfo.id) { gov_Model_TypeInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue); } Gov_Model_Type.Init().Update(gov_Model_TypeInfo); } else { Gov_Model_TypeInfo gov_Model_TypeInfo = new Gov_Model_TypeInfo(); gov_Model_TypeInfo.TypeName = this.TypeName.Value.Replace("#", "").Replace(",", ""); gov_Model_TypeInfo.Notes = this.Notes.Value; gov_Model_TypeInfo.Orders = Convert.ToInt32(this.Orders.Value); gov_Model_TypeInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue); Gov_Model_Type.Init().Add(gov_Model_TypeInfo); } string str = HttpContext.Current.Server.HtmlEncode("您好!公文模型分类保存成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=../../Manage/Gov/GovType_List.aspx&tip=" + str); }
protected void Del_Btn(object sender, EventArgs e) { LinkButton linkButton = sender as LinkButton; string commandArgument = linkButton.CommandArgument; Gov_Model_TypeInfo byId = Gov_Model_Type.Init().GetById(Convert.ToInt32(commandArgument)); this.DeleteDep(byId); this.Show(); }
private void Show(string did) { Gov_Model_TypeInfo byId = Gov_Model_Type.Init().GetById(Convert.ToInt32(did)); this.ViewState["sd"] = byId; this.parentID.SelectedValue = string.Concat(byId.ParentID); this.TypeName.Value = byId.TypeName; this.Notes.Value = byId.Notes; this.Orders.Value = string.Concat(byId.Orders); }
private string GetModelType(int comid) { string result = "暂无分类"; if (comid > 0) { IList all = Gov_Model_Type.Init().GetAll("id=" + comid, null); if (all.Count > 0) { Gov_Model_TypeInfo gov_Model_TypeInfo = all[0] as Gov_Model_TypeInfo; result = gov_Model_TypeInfo.TypeName; } } return result; }
private void DeleteDep(Gov_Model_TypeInfo sdi) { IList all = Gov_Model_Type.Init().GetAll("ParentID=" + sdi.id, null); for (int i = 0; i < all.Count; i++) { Gov_Model_TypeInfo sdi2 = all[i] as Gov_Model_TypeInfo; this.DeleteDep(sdi2); } string cmdText = "delete from Gov_Model where comid=" + sdi.id; MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText, new SqlParameter[0]); Gov_Model_Type.Init().Delete(sdi.id); }