public void Delete(int id) { Sys_DepInfo sys_DepInfo = new Sys_DepInfo(); sys_DepInfo.id = id; this.control.DeleteEntity(sys_DepInfo); }
protected void DownLoad(object sender, EventArgs e) { IList all = Sys_Dep.Init().GetAll(null, "order by orders asc,phone desc"); string text = "组织机构通讯录\r\n\r\n"; string str = "Organization ContactsBook"; foreach (object current in all) { Sys_DepInfo sys_DepInfo = current as Sys_DepInfo; if (!string.IsNullOrEmpty(sys_DepInfo.Phone)) { string text2 = text; text = string.Concat(new string[] { text2, sys_DepInfo.DepName, ":", sys_DepInfo.Phone, "\r\n" }); } } base.Response.Clear(); base.Response.ClearHeaders(); base.Response.Buffer = false; base.Response.AppendHeader("Content-Disposition", "attachment;filename=" + str + ".txt"); base.Response.ContentType = "application/vnd.txt"; base.Response.Write(text); base.Response.Flush(); base.Response.End(); }
private void DeleteDep(Sys_DepInfo sdi) { IList all = Sys_Dep.Init().GetAll("ParentID=" + sdi.id, null); for (int i = 0; i < all.Count; i++) { Sys_DepInfo sdi2 = all[i] as Sys_DepInfo; this.DeleteDep(sdi2); } this.DeleteUser(sdi.id); this.DeleteModule(sdi.id); Sys_Dep.Init().Delete(sdi.id); }
protected void Del_Btn(object sender, EventArgs e) { LinkButton linkButton = sender as LinkButton; string commandArgument = linkButton.CommandArgument; Sys_DepInfo byId = Sys_Dep.Init().GetById(Convert.ToInt32(commandArgument)); if (byId.ParentID != 0) { this.DeleteDep(byId); this.Show(); } else { base.Response.Write("<script>alert('根节点不可删除!');window.location='Dep_List.aspx';</script>"); } }
private void GetFirtNode() { DataSet dataSet = MsSqlOperate.ExecuteDataset(CommandType.Text, "select * from Sys_Dep", null); dataSet.Relations.Add("sort", dataSet.Tables[0].Columns["id"], dataSet.Tables[0].Columns["ParentID"], false); foreach (DataRow dataRow in dataSet.Tables[0].Rows) { if (dataRow["ParentID"].ToString() == "0") { Sys_DepInfo sys_DepInfo = this.SetPram(dataRow); sys_DepInfo.Ch = ""; sys_DepInfo.Sh = sys_DepInfo.DepName; this.li.Add(sys_DepInfo); this.PopulateSubTree(dataRow, this.i); } } }
private void GetFirtNode() { DataSet dataSet = MsSqlOperate.ExecuteDataset(CommandType.Text, "select * from Sys_Dep order by orders asc", null); dataSet.Relations.Add("sort", dataSet.Tables[0].Columns["id"], dataSet.Tables[0].Columns["ParentID"], false); foreach (DataRow dataRow in dataSet.Tables[0].Rows) { if (dataRow["ParentID"].ToString() == "0") { Sys_DepInfo sys_DepInfo = this.SetPram(dataRow); sys_DepInfo.Ch = "<img src=../images/ico_system.gif />"; this.li.Add(sys_DepInfo); this.PopulateSubTree(dataRow, this.i); } } dataSet.Dispose(); }
private void Show(string uid) { Sys_DepInfo byId = Sys_Dep.Init().GetById(Convert.ToInt32(uid)); this.UDepName5.InnerText = byId.DepName; this.Orders5.InnerText = string.Concat(byId.Orders); this.Notes5.InnerText = byId.Notes; this.IsPosition5.InnerText = ((byId.IsPosition == 0) ? "职位" : "部门"); this.Phone5.InnerText = byId.Phone; if (byId.ParentID != 0) { Sys_DepInfo byId2 = Sys_Dep.Init().GetById(Convert.ToInt32(byId.ParentID)); this.father5.InnerText = byId2.DepName; } else { this.father5.InnerText = "无上级 部门/职位"; } }
private void Show(string did) { Sys_DepInfo byId = Sys_Dep.Init().GetById(Convert.ToInt32(did)); this.ViewState["sd"] = byId; this.parentID.SelectedValue = string.Concat(byId.ParentID); this.UDepName.Value = byId.DepName; this.Notes.Value = byId.Notes; this.IsPosition.SelectedValue = string.Concat(byId.IsPosition); this.Orders.Value = string.Concat(byId.Orders); this.Phone.Value = byId.Phone; IList all = Sys_Dep_Module.Init().GetAll("DepID=" + did, null); List <string> list = new List <string>(); for (int i = 0; i < all.Count; i++) { Sys_Dep_ModuleInfo sys_Dep_ModuleInfo = all[i] as Sys_Dep_ModuleInfo; list.Add(string.Concat(sys_Dep_ModuleInfo.ModuleID)); } this.ViewState["old_module"] = list; this.powerListBind(all, this.powerList); }
protected void Save_Btn(object sender, EventArgs e) { if (!string.IsNullOrEmpty(base.Request.QueryString["did"])) { int num = Convert.ToInt32(base.Request.QueryString["did"]); Sys_DepInfo sys_DepInfo = this.ViewState["sd"] as Sys_DepInfo; sys_DepInfo.DepName = this.UDepName.Value.Replace("#", "").Replace(",", ""); sys_DepInfo.IsPosition = Convert.ToInt32(this.IsPosition.SelectedValue); sys_DepInfo.Orders = Convert.ToInt32(this.Orders.Value); sys_DepInfo.Notes = this.Notes.Value; sys_DepInfo.Phone = this.Phone.Value; if (sys_DepInfo.ParentID != 0) { sys_DepInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue); } Sys_Dep.Init().Update(sys_DepInfo); string cmdText = string.Concat(new object[] { "update Sys_User set DepName='", sys_DepInfo.DepName, "' where DepID=", sys_DepInfo.id }); MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText, null); List <string> list = this.ViewState["old_module"] as List <string>; List <string> list2 = new List <string>(); for (int i = 0; i < this.powerList.Items.Count; i++) { if (this.powerList.Items[i].Selected) { list2.Add(this.powerList.Items[i].Value); } } for (int i = 0; i < list.Count; i++) { if (!list2.Contains(list[i])) { string cmdText2 = string.Concat(new object[] { "delete from Sys_Dep_Module where DepID=", num, " and ModuleID=", list[i] }); MsSqlOperate.ExecuteNonQuery(CommandType.Text, cmdText2, null); } } for (int i = 0; i < list2.Count; i++) { if (!list.Contains(list2[i])) { Sys_Dep_ModuleInfo sys_Dep_ModuleInfo = new Sys_Dep_ModuleInfo(); sys_Dep_ModuleInfo.ModuleID = Convert.ToInt32(list2[i]); sys_Dep_ModuleInfo.DepID = num; Sys_Dep_Module.Init().Add(sys_Dep_ModuleInfo); } } string str = HttpContext.Current.Server.HtmlEncode("您好!部门/职位已编辑成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { Sys_DepInfo sys_DepInfo = new Sys_DepInfo(); sys_DepInfo.DepName = this.UDepName.Value.Replace("#", "").Replace(",", ""); sys_DepInfo.IsPosition = Convert.ToInt32(this.IsPosition.SelectedValue); sys_DepInfo.Orders = Convert.ToInt32(this.Orders.Value); sys_DepInfo.Notes = this.Notes.Value; sys_DepInfo.Phone = this.Phone.Value; sys_DepInfo.ParentID = Convert.ToInt32(this.parentID.SelectedValue); Sys_Dep.Init().Add(sys_DepInfo); for (int i = 0; i < this.powerList.Items.Count; i++) { if (this.powerList.Items[i].Selected) { Sys_Dep_ModuleInfo sys_Dep_ModuleInfo = new Sys_Dep_ModuleInfo(); sys_Dep_ModuleInfo.ModuleID = Convert.ToInt32(this.powerList.Items[i].Value); sys_Dep_ModuleInfo.DepID = sys_DepInfo.id; Sys_Dep_Module.Init().Add(sys_Dep_ModuleInfo); } } string str = HttpContext.Current.Server.HtmlEncode("您好!部门/职位已添加成功!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } }
private void PopulateSubTree(DataRow dbRow, int depth) { depth++; DataRow[] childRows = dbRow.GetChildRows("sort"); for (int i = 0; i < childRows.Length - 1; i++) { int num = i; for (int j = i + 1; j < childRows.Length; j++) { if (Convert.ToInt32(childRows[num]["Orders"]) > Convert.ToInt32(childRows[j]["Orders"])) { num = j; } } if (num != i) { object obj = childRows[i]; childRows[i] = childRows[num]; childRows[num] = (DataRow)obj; } } DataRow[] array = childRows; for (int k = 0; k < array.Length; k++) { DataRow dataRow = array[k]; Sys_DepInfo sys_DepInfo = this.SetPram(dataRow); if (depth == 2) { if (object.ReferenceEquals(dataRow, childRows[childRows.Length - 1])) { sys_DepInfo.Ch = "\u3000└ "; } else { sys_DepInfo.Ch = "\u3000├ "; } } else { if (depth > 2) { if (object.ReferenceEquals(dataRow, childRows[childRows.Length - 1])) { for (int l = 1; l < depth - 1; l++) { sys_DepInfo.Ch = "\u3000│" + sys_DepInfo.Ch; } Sys_DepInfo expr_132 = sys_DepInfo; expr_132.Ch += "\u3000└ "; } else { for (int l = 1; l < depth - 1; l++) { sys_DepInfo.Ch = "\u3000│" + sys_DepInfo.Ch; } Sys_DepInfo expr_177 = sys_DepInfo; expr_177.Ch += "\u3000├ "; } } } sys_DepInfo.Sh = sys_DepInfo.Ch + sys_DepInfo.DepName; this.li.Add(sys_DepInfo); this.PopulateSubTree(dataRow, depth); } }
private void PopulateSubTree(DataRow dbRow, int depth) { depth++; DataRow[] childRows = dbRow.GetChildRows("sort"); for (int i = 0; i < childRows.Length - 1; i++) { int num = i; for (int j = i + 1; j < childRows.Length; j++) { if (Convert.ToInt32(childRows[num]["orders"]) > Convert.ToInt32(childRows[j]["orders"])) { num = j; } } if (num != i) { object obj = childRows[i]; childRows[i] = childRows[num]; childRows[num] = (DataRow)obj; } } DataRow[] array = childRows; for (int k = 0; k < array.Length; k++) { DataRow dataRow = array[k]; Sys_DepInfo sys_DepInfo = this.SetPram(dataRow); string text; if (sys_DepInfo.IsPosition == 0) { text = "<img src=../images/ico_jingpin.gif />"; } else { text = "<img src=../images/group.gif />"; } if (depth == 2) { if (object.ReferenceEquals(dataRow, childRows[childRows.Length - 1])) { sys_DepInfo.Ch = "\u3000└ " + text; } else { sys_DepInfo.Ch = "\u3000├ " + text; } } else { if (depth > 2) { if (object.ReferenceEquals(dataRow, childRows[childRows.Length - 1])) { for (int l = 1; l < depth - 1; l++) { sys_DepInfo.Ch = "\u3000│" + sys_DepInfo.Ch; } Sys_DepInfo expr_166 = sys_DepInfo; expr_166.Ch = expr_166.Ch + "\u3000└ " + text; } else { for (int l = 1; l < depth - 1; l++) { sys_DepInfo.Ch = "\u3000│" + sys_DepInfo.Ch; } Sys_DepInfo expr_1AD = sys_DepInfo; expr_1AD.Ch = expr_1AD.Ch + "\u3000├ " + text; } } } this.li.Add(sys_DepInfo); this.PopulateSubTree(dataRow, depth); } }
protected void Save_Btn(object sender, EventArgs e) { this.nums = Convert.ToInt32(this.ViewState["nums"]); if (this.nums == 0) { Bas_ComInfo bas_ComInfo = new Bas_ComInfo(); bas_ComInfo.MsgState = Convert.ToInt32(this.TypeID.Value); bas_ComInfo.et3 = Convert.ToInt32(this.et3.Value); bas_ComInfo.ComName = this.ComName.Value.Replace("#", "").Replace(",", ""); bas_ComInfo.Notes = this.Notes.Value; bas_ComInfo.AddTime = DateTime.Now; bas_ComInfo.BBSState = Convert.ToInt32(this.BBSState.Checked); bas_ComInfo.ValidCodeState = Convert.ToInt32(this.ValidCodeState.Checked); bas_ComInfo.TipsState = Convert.ToInt32(this.TipsState.Checked); bas_ComInfo.WebUrl = "http://" + this.WebUrl.Value.ToLower().Replace("http://", ""); bas_ComInfo.Logo = this.Logo.Value; bas_ComInfo.et4 = this.et4.Value; Bas_Com.Init().Add(bas_ComInfo); Sys_DepInfo sys_DepInfo = new Sys_DepInfo(); sys_DepInfo.DepName = bas_ComInfo.ComName.Replace("#", "").Replace(",", ""); sys_DepInfo.Notes = bas_ComInfo.Notes; sys_DepInfo.ParentID = 0; sys_DepInfo.Orders = 0; sys_DepInfo.ComID = bas_ComInfo.id; sys_DepInfo.ComGUID = bas_ComInfo.guid; Sys_Dep.Init().Add(sys_DepInfo); HttpContext.Current.Application["cominfo"] = bas_ComInfo; try { // this.Sendcom(bas_ComInfo); } catch { } string str = HttpContext.Current.Server.HtmlEncode("您好!企业信息已成功保存!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } else { Bas_ComInfo bas_ComInfo = this.ViewState["Bas_Com"] as Bas_ComInfo; bas_ComInfo.MsgState = Convert.ToInt32(this.TypeID.Value); bas_ComInfo.et3 = Convert.ToInt32(this.et3.Value); bas_ComInfo.ComName = this.ComName.Value.Replace("#", "").Replace(",", ""); bas_ComInfo.Notes = this.Notes.Value; bas_ComInfo.BBSState = Convert.ToInt32(this.BBSState.Checked); bas_ComInfo.ValidCodeState = Convert.ToInt32(this.ValidCodeState.Checked); bas_ComInfo.TipsState = Convert.ToInt32(this.TipsState.Checked); bas_ComInfo.WebUrl = "http://" + this.WebUrl.Value.ToLower().Replace("http://", ""); bas_ComInfo.Logo = this.Logo.Value; bas_ComInfo.et4 = this.et4.Value; Bas_Com.Init().Update(bas_ComInfo); HttpContext.Current.Application["cominfo"] = bas_ComInfo; IList all = Sys_Dep.Init().GetAll("ComID=" + bas_ComInfo.id, null); if (all.Count != 0) { Sys_DepInfo sys_DepInfo = all[0] as Sys_DepInfo; sys_DepInfo.DepName = bas_ComInfo.ComName.Replace("#", "").Replace(",", ""); sys_DepInfo.Notes = bas_ComInfo.Notes; sys_DepInfo.ParentID = 0; sys_DepInfo.Orders = 0; sys_DepInfo.ComID = bas_ComInfo.id; sys_DepInfo.ComGUID = bas_ComInfo.guid; Sys_Dep.Init().Update(sys_DepInfo); IList all2 = Sys_User.Init().GetAll("depid=" + sys_DepInfo.id, null); foreach (object current in all2) { Sys_UserInfo sys_UserInfo = current as Sys_UserInfo; sys_UserInfo.DepName = sys_DepInfo.DepName.Replace("#", "").Replace(",", ""); Sys_User.Init().Update(sys_UserInfo); } } try { // this.Sendcom(bas_ComInfo); } catch { } string str = HttpContext.Current.Server.HtmlEncode("您好!企业信息已成功保存!"); base.Response.Redirect("~/InfoTip/Operate_Success.aspx?returnpage=" + base.Request.Url.AbsoluteUri + "&tip=" + str); } }
public void Update(Sys_DepInfo Sys_Dep) { this.control.UpdateEntity(Sys_Dep, Sys_Dep.id); }
public void Add(Sys_DepInfo Sys_Dep) { this.control.AddEntity(Sys_Dep); }
public void Update(Sys_DepInfo com) { Sys_Dep.dal.Update(com); }
public void Add(Sys_DepInfo com) { Sys_Dep.dal.Add(com); }