protected void btnSave2_Click(object sender, EventArgs e) { DataTable dt = ULCode.QDA.XSql.GetDataTable("select ID from TE_Duties where CompanyID=11"); for (int i = 0; i < dt.Rows.Count; i++) { string sSql = String.Format("if exists(Select * from TE_MenusInDuties where MenuId={0} and DutyId={1})" + " update TE_MenusInDuties set Flag={2} where MenuId={0} and DutyId={1}" + " else " + " insert into TE_MenusInDuties(MenuId,DutyId,Flag) values({0},{1},{2})", WX.Request.rMenuId, dt.Rows[i]["ID"], 1); ULCode.QDA.XSql.Execute(sSql); string menustr = new WX.Json.BuildUserMenus(Convert.ToInt32(dt.Rows[i]["ID"].ToString())).GetUserMenu(); if (menustr != "-1") { WX.Model.Duty.MODEL model = WX.Model.Duty.NewDataModel(dt.Rows[i]["ID"]); List <WX.Json.UserMenu> l_u = WX.Json.JsonConvert.GetJsonObject <List <WX.Json.UserMenu> >(menustr, false); if (l_u != null) { model.Menus.set(menustr); if (model.Update() == 0) { model.RestoreInitial(); } } } } }
protected void Button2_Click(object sender, EventArgs e) { //1.验证用户权限 //2.取得用户变量 int companyId = WX.Request.rCompanyId; int Id = WX.Request.rDutyId; WX.Model.Duty.MODEL model = WX.Request.rDuty; //4.业务处理过程 bool bDeal = false; //填写主要业务逻辑代码 if (true) { DropDownList cbox; //WX.Main.ExecuteDelete("TE_MenusInDuties", "DutyID", Id.ToString()); for (int i = 0; i < Gv_duty.Rows.Count; i++) { cbox = (DropDownList)Gv_duty.Rows[i].Cells[1].FindControl("ddlFlag"); if (cbox == null) { throw new ApplicationException("没有发现控件(ddlFlag)!"); } string sSql = String.Format("if exists(Select * from TE_MenusInDuties where MenuId={0} and DutyId={1})" + " update TE_MenusInDuties set Flag={2} where MenuId={0} and DutyId={1}" + " else " + " insert into TE_MenusInDuties(MenuId,DutyId,Flag) values({0},{1},{2})", cbox.ToolTip, Id, cbox.SelectedValue); ULCode.QDA.XSql.Execute(sSql); //ULCode.QDA.XSql.Execute("insert into TE_MenusInDuties(MenuId,DutyId,Flag) values(" + cbox.ToolTip + "," + Id + "," + cbox.SelectedValue + ")"); } bDeal = true; } else { model.RestoreInitial(); } //5.(用户及业务对象)统计与状态 if (bDeal) { WX.Main.CurUser.LoadDutyUser(true); } //6.登记日志 if (bDeal) { WX.Main.AddLog(WX.LogType.Default, "编辑职务信息成功!", ""); } //7.返回处理结果或返回其它页面。 if (bDeal) { ULCode.Debug.Confirm(this, "已成功修改职务信息!是否返回职务列表页?", "Duty_List.aspx?CompanyID=" + companyId, this.Request.RawUrl); } else { ULCode.Debug.Alert(this, "编辑职务失败,请重试!"); } }
protected void Button2_Click(object sender, EventArgs e) { //1.验证用户权限 //2.取得用户变量 int companyId = WX.Request.rCompanyId; int Id = WX.Request.rDutyId; WX.Model.Duty.MODEL model = WX.Request.rDuty;// WX.Model.Duty.GetModel("select * from [TE_Duties] where ID=" + Request["id"]); //WX.Model.Duty.MODEL model2 = WX.Model.Duty.GetModel("select * from TE_Duties where ID!=" + Request["id"] + " and ID=" + DutyID.Text.Trim()); //以下代码由后台开发人员填写 //3.验证用户变量,包含Request.QueryString及Request.Form //model.CompanyID.value = (Request["cmp"] != null && Request["cmp"] != "" ? Request["cmp"] : "11"); //4.业务处理过程 bool bDeal = false; //填写主要业务逻辑代码 if (model.Update() != 0) { DropDownList cbox; WX.Main.ExecuteDelete("TE_FunctionsInDuties", "DutyID", dutyId.Text); for (int i = 0; i < Gv_duty.Rows.Count; i++) { cbox = (DropDownList)Gv_duty.Rows[i].Cells[1].FindControl("ddlFlag"); if (cbox == null) { throw new ApplicationException("没有发现控件(ddlFlag)!"); } ULCode.QDA.XSql.Execute("insert into TE_FunctionsInDuties values(" + cbox.ToolTip + "," + dutyId.Text.Trim() + "," + cbox.SelectedValue + ")"); } bDeal = true; } else { model.RestoreInitial(); } //5.(用户及业务对象)统计与状态 if (bDeal) { WX.Main.CurUser.LoadDutyUser(true); } //6.登记日志 if (bDeal) { WX.Main.AddLog(WX.LogType.Default, "编辑职务信息成功!", ""); } //7.返回处理结果或返回其它页面。 if (bDeal) { ULCode.Debug.Confirm(this, "已成功修改职务信息!是否返回职务列表页?", "Duty_List.aspx?CompanyID=11", this.Request.RawUrl); } else { ULCode.Debug.Alert(this, "编辑职务失败,请重试!"); } }
protected void Button2_Click(object sender, EventArgs e) { int companyId = WX.Request.rCompanyId; int Id = WX.Request.rDutyId; //2.取得用户变量 int dutyNO = Convert.ToInt32(DutyNO.Text.Trim()); string name = DutyName.Text.Trim(); WX.Model.Duty.MODEL model = WX.Request.rDuty;// WX.Model.Duty.GetModel("select * from [TE_Duties] where ID=" + Request["id"]); //WX.Model.Duty.MODEL model2 = WX.Model.Duty.GetModel("select * from TE_Duties where ID!=" + Request["id"] + " and ID=" + DutyID.Text.Trim()); //以下代码由后台开发人员填写 //3.验证用户变量,包含Request.QueryString及Request.Form if (dutyNO != Id && WX.Model.Duty.Caches.Find(delegate(WX.Model.Duty.MODEL dele) { return(dele.CompanyID.ToInt32() == companyId && dele.ID.ToInt32() == dutyNO); }) != null) { ULCode.Debug.AjaxAlert(this, "编辑职务失败,职务编号已存在!"); return; } model.NO.set(dutyNO); model.Name.set(name); model.DutyCatagoryID.value = DutyCatagory.SelectedValue; model.GradeID.value = ddlGradeId.SelectedValue; model.Description.value = FORM_CONTENT.Value; //model.CompanyID.value = (Request["cmp"] != null && Request["cmp"] != "" ? Request["cmp"] : "11"); //4.业务处理过程 bool bDeal = false; //填写主要业务逻辑代码 if (model.Update() != 0) { bDeal = true; } else { model.RestoreInitial(); } //5.(用户及业务对象)统计与状态 if (bDeal) { WX.Main.CurUser.LoadDutyUser(true); } //6.登记日志 if (bDeal) { WX.Main.AddLog(WX.LogType.Default, "编辑职务信息成功!", ""); } //7.返回处理结果或返回其它页面。 if (bDeal) { ULCode.Debug.Confirm(this, "已成功修改职务信息!是否返回职务列表页?", "Duty_List.aspx?CompanyID=11", this.Request.RawUrl); } else { ULCode.Debug.Alert(this, "编辑职务失败,请重试!"); } }
protected void Button2_Click(object sender, EventArgs e) { //1.验证用户权限 //2.取得用户变量 int id = WX.Request.rDutyId; int companyId = WX.Request.rCompanyId; string menus = this.ui_Htmls.Value; WX.Model.Duty.MODEL model = WX.Request.rDuty; //WX.Model.Duty.GetModel("select * from TE_Duties where ID="+id); //WX.Model.Duty.MODEL model = WX.Model.Duty.GetModel("select * from TE_Duties where ID=" + Request["id"]); //3.验证用户变量,包含Request.QueryString及Request.Form List <WX.Json.UserMenu> l_u = WX.Json.JsonConvert.GetJsonObject <List <WX.Json.UserMenu> >(menus, false); if (l_u == null) { ULCode.Debug.Alert(this, "你的文档不合法!保存失败!"); return; } //4.业务处理过程 bool bDeal = false; //填写主要业务逻辑代码 model.Menus.set(ui_Htmls.Value); if (model.Update() != 0) { //WX.Main.CurUser.LoadDutyUser(true); bDeal = true; } else { model.RestoreInitial(); } //5.(用户及业务对象)统计与状态 //6.登记日志 if (bDeal) { WX.Main.AddLog(WX.LogType.Default, "职务“" + model.Name.value.ToString() + "”生成菜单成功!", ""); } //7.返回处理结果或返回其它页面。 if (bDeal) { ULCode.Debug.Confirm(this, "成功生成职务菜单,是否返回职务列表页?", "/Manage/Sys/Duty_List.aspx?CompanyID=11", this.Request.RawUrl); //Response.Redirect(); } else { ULCode.Debug.Alert(this, "生成失败,请重试!"); } }