//删除机构 public void Delete_Click(object sender, EventArgs e) { int AgencyID = agen.SelectAgencyID(AgencyName2.Text.Trim()); int level = Convert.ToInt32(Session["SecrecyLevel"]); if (level == 5) { agen.Delete(AgencyID); BindData(); Clear(); BindPeople(); Delete.Enabled = false; Alert.ShowInTop("删除数据成功!"); return; } Common.Entities.Agency ag = new Common.Entities.Agency(); ag = agen.FindByName(AgencyName2.Text.Trim()); OperationLog op = new OperationLog(); BLHelper.BLLOperationLog blop = new BLLOperationLog(); if (ag.EntryPerson != Session["LoginName"].ToString()) { string str = "您无对此机构操作的权限!此机构信息为" + ag.EntryPerson + "录入,请与管理员联系!"; Alert.ShowInTop(str); return; } else { agen.UpdatePass(AgencyID, false); op.LoginIP = ""; op.LoginName = Session["LoginName"].ToString(); op.OperationContent = "Agency"; op.OperationDataID = AgencyID; op.OperationType = "删除"; op.OperationTime = DateTime.Now; blop.Insert(op); BindData(); Alert.ShowInTop("数据已提交,请等待管理员确认!"); } Clear(); }
public void Change_Click(object sender, EventArgs e) { if (AgencyName2.Text.Trim() == "") { Alert.ShowInTop("请选择所要修改的机构!"); return; } Common.Entities.Agency ag = new Common.Entities.Agency(); ag = agen.FindByName(AgencyName2.Text.Trim()); if (Convert.ToInt32(Session["SecrecyLevel"]) < 5) { if (ag.EntryPerson != Session["LoginName"].ToString()) { string str = "您无对此机构操作的权限!此机构信息为" + ag.EntryPerson + "录入,请与管理员联系!"; Alert.ShowInTop(str); return; } } Alert.Show("你确定要修改此数据吗!", "确认消息", MessageBoxIcon.Information, Window4.GetShowReference("ChangeAgency.aspx", "修改机构信息"), Target.Top); }
//保存机构信息 protected void Save_Click(object sender, EventArgs e) { try { if (AgencyName2.Text.Trim() == "") { Alert.ShowInTop("机构名称不能为空!"); AgencyName2.Text = ""; return; } if (AgencyHeads2.Text.Trim() == "") { Alert.ShowInTop("机构负责人不能为空!"); AgencyHeads2.Text = ""; return; } if (FullTimeNumber2.Text.Trim() == "") { Alert.ShowInTop("专职人数不能为空!"); FullTimeNumber2.Text = ""; return; } Common.Entities.Agency ag = new Common.Entities.Agency(); Common.Entities.OperationLog op = new Common.Entities.OperationLog(); BLHelper.BLLOperationLog blop = new BLHelper.BLLOperationLog(); BLHelper.BLLUser user = new BLHelper.BLLUser(); string username = user.FindByLoginName(Session["LoginName"].ToString()).UserName; ag.AgencyName = AgencyName2.Text.ToString(); ag.ParentID = agen.SelectAgencyID(ParentID2.Text.ToString()); ag.SecrecyLevel = Convert.ToInt32(DroSecrecyLevel.SelectedIndex + 1); ag.AgencyHeads = AgencyHeads2.Text.ToString(); ag.Research = Research2.Text.ToString(); ag.AgencyNumber = DroAgencyNumber.SelectedText; ag.FullTimeNumbers = Convert.ToInt32(FullTimeNumber2.Text.ToString()); ag.PartTimeNumbers = Convert.ToInt32(PartTimeNumber2.Text.ToString()); ag.Area = Area2.Text.ToString(); ag.IsGlobal = ddl_glo.SelectedText.Trim(); ag.Location = Location2.Text.ToString(); ag.EntryPerson = username; if (Convert.ToInt32(Session["SecrecyLevel"]) == 5) { ag.IsPass = true; agen.Insert(ag); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference("保存成功") + Alert.GetShowInTopReference("保存成功")); } else { ag.IsPass = false; agen.Insert(ag); op.LoginIP = ""; op.LoginName = Session["LoginName"].ToString(); op.OperationContent = "Agency"; op.OperationDataID = agen.SelectAgencyID(AgencyName2.Text.Trim().ToString()); op.OperationType = "添加"; op.OperationTime = DateTime.Now; blop.Insert(op); PageContext.RegisterStartupScript(ActiveWindow.GetConfirmHidePostBackReference() + Alert.GetShowInTopReference("您的操作已经提交,请等待管理员确认!")); } } catch (Exception ex) { BLCommon.PublicMethod pm = new BLCommon.PublicMethod(); pm.SaveError(ex, this.Request); } }
//初始化文本框数据 public void TextChange() { BLHelper.BLLAgency agen = new BLHelper.BLLAgency(); Common.Entities.Agency ag = new Common.Entities.Agency(); if (Session["AgencyName"].ToString() == "") { return; } ag = agen.FindByName(Session["AgencyName"].ToString()); AgencyName2.Text = Session["AgencyName"].ToString(); if (ag.ParentID != null) { string str = agen.FindAgenName(Convert.ToInt32(ag.ParentID)); if (str != "") { ParentID2.Text = str; } else { ParentID2.Text = " "; } } else { ParentID2.Text = " "; } if (ag.SecrecyLevel != null) { DroSecrecyLevel.SelectedValue = (ag.SecrecyLevel - 1).ToString(); } else { DroSecrecyLevel.Text = " "; } if (ag.AgencyHeads != null) { AgencyHeads2.Text = ag.AgencyHeads.ToString(); } else { AgencyHeads2.Text = " "; } if (ag.Research != null) { Research2.Text = ag.Research.ToString(); } else { Research2.Text = " "; } if (ddl_glo.SelectedText == ag.IsGlobal.Trim()) { ddl_glo.Items[0].Selected = true; } else { ddl_glo.Items[1].Selected = true; } if (ag.FullTimeNumbers != null) { FullTimeNumber2.Text = ag.FullTimeNumbers.ToString(); } else { FullTimeNumber2.Text = " "; } if (ag.PartTimeNumbers != null) { PartTimeNumber2.Text = ag.PartTimeNumbers.ToString(); } else { PartTimeNumber2.Text = " "; } if (ag.Area != null) { Area2.Text = ag.Area.ToString(); } else { Area2.Text = " "; } if (ag.Location != null) { Location2.Text = ag.Location.ToString(); } else { Location2.Text = " "; } }
//绑定Grid1数据,绑定text数据 protected void Tree1_NodeCommand(object sender, TreeCommandEventArgs e) { Delete.Enabled = true; Common.Entities.Agency ag = agen.FindByName(e.Node.Text.Trim()); if (ag.AgencyName != null) { AgencyName2.Text = ag.AgencyName.ToString(); Session["AgencyName"] = ag.AgencyName; } else { AgencyName2.Text = " "; } if (ag.ParentID != null) { string str = agen.FindAgenName(Convert.ToInt32(ag.ParentID)); if (str != "") { ParentID2.Text = str; } else { ParentID2.Text = " "; } } else { ParentID2.Text = " "; } string[] SecrecyLevels = new string[] { "四级", "三级", "二级", "一级", "管理员" }; if (ag.SecrecyLevel != null) { SecrecyLevel2.Text = SecrecyLevels[ag.SecrecyLevel.Value - 1]; } else { SecrecyLevel2.Text = " "; } if (ag.AgencyHeads != null) { AgencyHeads2.Text = ag.AgencyHeads.ToString(); } else { AgencyHeads2.Text = " "; } if (ag.Research != null) { Research2.Text = ag.Research.ToString(); } else { Research2.Text = " "; } if (ag.AgencyNumber != null) { AgencyNumber2.Text = ag.AgencyNumber; } else { AgencyNumber2.Text = " "; } if (ag.FullTimeNumbers != null) { FullTimeNumber2.Text = ag.FullTimeNumbers.ToString(); } else { FullTimeNumber2.Text = " "; } if (ag.PartTimeNumbers != null) { PartTimeNumber2.Text = ag.PartTimeNumbers.ToString(); } else { PartTimeNumber2.Text = " "; } if (ag.Area != null) { Area2.Text = ag.Area.ToString() + "平方米"; } else { Area2.Text = " "; } if (ag.Location != null) { Location2.Text = ag.Location.ToString(); } else { Location2.Text = " "; } BindPeople(); }