protected void btnSave_Click(object sender, System.EventArgs e) { if (this.txtPrjTypeName.Text.Trim() == "") { base.RegisterScript("alert('系统提示:\\n\\n工程类型名称必须输入!');"); return; } PrjType prjType = PrjType.Create(this.typeCode, System.Convert.ToInt32(this.hlfdItemCode.Value), this.txtPrjTypeName.Text.Trim()); System.Collections.Generic.List <PrjType> byItemName = PrjType.GetByItemName(this.typeCode, this.txtPrjTypeName.Text.Trim()); if (this.action == "add") { if (byItemName.Count > 0) { base.RegisterScript("alert('系统提示:\\n\\n此名称已存在!请重新定义!');"); return; } PrjType.Add(prjType); base.RegisterScript("alert('系统提示:\\n\\n添加成功!');"); } else { PrjType byItemCode = PrjType.GetByItemCode(this.typeCode, System.Convert.ToInt32(this.hlfdItemCode.Value)); if (byItemCode.ItemName != this.txtPrjTypeName.Text.Trim() && byItemName.Count > 0) { base.RegisterScript("alert('系统提示:\\n\\n此名称已存在!请重新定义!');"); return; } PrjType.Update(prjType); base.RegisterScript("alert('系统提示:\\n\\n修改成功!');"); } base.RegisterScript("winclose('PrjTypeEdit', 'PrjTypeList.aspx?tv=" + this.typeCode + "', true);"); }
protected void BindTV() { System.Collections.Generic.Dictionary <string, string> codeType = PrjType.GetCodeType(); this.tvPrjType.Nodes.Clear(); TreeNode treeNode = new TreeNode(); treeNode.Text = "工程类型"; treeNode.Value = ""; this.tvPrjType.Nodes.Add(treeNode); TreeNode treeNode2 = new TreeNode(); treeNode2.Text = codeType["ConstructType"].ToString(); treeNode2.Value = "ConstructType"; if (base.Request["tv"] != null && base.Request["tv"] == treeNode2.Value) { treeNode2.Select(); } treeNode.ChildNodes.Add(treeNode2); TreeNode treeNode3 = new TreeNode(); treeNode3.Text = codeType["DesignType"].ToString(); treeNode3.Value = "DesignType"; treeNode.ChildNodes.Add(treeNode3); if (base.Request["tv"] != null && base.Request["tv"] == treeNode3.Value) { treeNode3.Select(); } if (base.Request["tv"] == null) { treeNode2.Select(); } }
protected void BindGv() { this.AspNetPager1.RecordCount = PrjType.GetCountByType(this.tvPrjType.SelectedValue); System.Collections.Generic.List <PrjType> byType = PrjType.GetByType(this.tvPrjType.SelectedValue, this.AspNetPager1.CurrentPageIndex - 1, this.AspNetPager1.PageSize); this.gvPrjType.DataSource = byType; this.gvPrjType.DataBind(); }
protected void Page_Load(object sender, System.EventArgs e) { if (!base.IsPostBack) { if (this.action == "add") { this.hlfdItemCode.Value = PrjType.GetNewItemCode(this.typeCode).ToString(); return; } PrjType byItemCode = PrjType.GetByItemCode(this.typeCode, this.itemCode); this.hlfdItemCode.Value = byItemCode.ItemCode.ToString(); this.txtPrjTypeName.Text = byItemCode.ItemName; } }
protected void btnDel_Click(object sender, System.EventArgs e) { System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>(); if (this.hfldPurchaseChecked.Value.Contains("[")) { list = JsonHelper.GetListFromJson(this.hfldPurchaseChecked.Value); } else { list.Add(this.hfldPurchaseChecked.Value); } try { PrjType.Delete(this.tvPrjType.SelectedValue, list); base.RegisterScript("alert('系统提示:\\n\\n删除成功!');"); this.BindGv(); } catch (System.Exception ex) { base.RegisterScript("alert('系统提示:\\n\\n" + ex.Message + "!');"); } }
public static string GetPrjType(PrjType type) { return(PrjProperty.FindByValue((int)type)); }