public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); string clauseText = context.Request.Form["tv"]; string clauseEtext = context.Request.Form["ev"]; if (string.IsNullOrEmpty(clauseText)) { result.Message = "合约条款中文内容不能为空"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } if (string.IsNullOrEmpty(clauseEtext)) { result.Message = "合约条款英文内容不能为空"; context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); context.Response.End(); } NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Data.Model.ContractClause clause = new NFMT.Data.Model.ContractClause(); clause.ClauseEnText = clauseEtext; clause.ClauseStatus = NFMT.Common.StatusEnum.已录入; clause.ClauseText = clauseText; clause.CreatorId = user.EmpId; NFMT.Data.BLL.ContractClauseBLL clauseBLL = new NFMT.Data.BLL.ContractClauseBLL(); result = clauseBLL.Insert(user, clause); context.Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(result)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int refId = 0; if (string.IsNullOrEmpty(Request.QueryString["id"])) Response.Redirect("MasterClauseAllot.aspx"); if(!int.TryParse(Request.QueryString["id"],out refId)) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Data.BLL.ClauseContractBLL refBLL = new NFMT.Data.BLL.ClauseContractBLL(); NFMT.Common.ResultModel result = refBLL.Get(user, refId); if(result.ResultStatus!=0) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Data.Model.ClauseContract masterClause = result.ReturnValue as NFMT.Data.Model.ClauseContract; if(masterClause==null || masterClause.RefId<=0) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Data.BLL.ContractMasterBLL masterBLL = new NFMT.Data.BLL.ContractMasterBLL(); result = masterBLL.Get(user,masterClause.MasterId); if(result.ResultStatus!=0) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Data.Model.ContractMaster master = result.ReturnValue as NFMT.Data.Model.ContractMaster; if(master==null || master.MasterId<=0) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Data.BLL.ContractClauseBLL clauseBLL = new NFMT.Data.BLL.ContractClauseBLL(); result = clauseBLL.Get(user, masterClause.ClauseId); if(result.ResultStatus!=0) Response.Redirect("MasterClauseAllot.aspx"); NFMT.Data.Model.ContractClause clause = result.ReturnValue as NFMT.Data.Model.ContractClause; if(clause==null || clause.ClauseId<=0) Response.Redirect("MasterClauseAllot.aspx"); this.spnClauseEtext.InnerHtml = clause.ClauseEnText; this.spnClauseText.InnerHtml = clause.ClauseText; this.spnMasterEname.InnerHtml = master.MasterEname; this.spnMasterName.InnerHtml = master.MasterName; this.chkIsChose.Checked = masterClause.IsChose; this.txbSort.Value = masterClause.Sort.ToString(); this.hidRefId.Value = masterClause.RefId.ToString(); int masterId = 0; int.TryParse(Request.QueryString["mid"],out masterId); this.navigation1.Routes.Add("合约模板列表", "MasterClauseAllot.aspx"); this.navigation1.Routes.Add("模板条款分配", string.Format("MasterClauseCreate.aspx?id={0}",masterId)); this.navigation1.Routes.Add("分配修改",string.Empty); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string clauseText = context.Request.Form["tv"]; string clauseEtext = context.Request.Form["ev"]; int clauseStatus = 0; int clauseId = 0; if (string.IsNullOrEmpty(clauseText)) { context.Response.Write("合约条款中文内容不能为空"); context.Response.End(); } if (string.IsNullOrEmpty(clauseEtext)) { context.Response.Write("合约条款英文内容不能为空"); context.Response.End(); } if (!int.TryParse(context.Request.Form["cs"], out clauseStatus) || clauseStatus <= 0) { context.Response.Write("必须选择数据状态"); context.Response.End(); } if (!int.TryParse(context.Request.Form["cid"], out clauseId) || clauseId <= 0) { context.Response.Write("合约条款序号错误"); context.Response.End(); } NFMT.Data.BLL.ContractClauseBLL bll = new NFMT.Data.BLL.ContractClauseBLL(); NFMT.Data.Model.ContractClause clause = new NFMT.Data.Model.ContractClause(); NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; clause.LastModifyId = user.EmpId; clause.ClauseText = clauseText; clause.ClauseEnText = clauseEtext; clause.ClauseId = clauseId; clause.ClauseStatus = (NFMT.Common.StatusEnum)clauseStatus; NFMT.Common.ResultModel result = bll.Update(user, clause); context.Response.Write(result.Message); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int clauseId = 0; int operateId = 0; if (!int.TryParse(context.Request.Form["ci"], out clauseId) || clauseId <= 0) { context.Response.Write("模板序号错误"); context.Response.End(); } if (!int.TryParse(context.Request.Form["oi"], out operateId) || operateId <= 0) { context.Response.Write("操作错误"); context.Response.End(); } NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Data.BLL.ContractClauseBLL bll = new NFMT.Data.BLL.ContractClauseBLL(); NFMT.Data.Model.ContractClause clause = new NFMT.Data.Model.ContractClause(); clause.LastModifyId = user.EmpId; clause.ClauseId = clauseId; NFMT.Common.OperateEnum operateEnum = (NFMT.Common.OperateEnum)operateId; NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); switch (operateEnum) { case NFMT.Common.OperateEnum.冻结: result = bll.Freeze(user, clause); break; case NFMT.Common.OperateEnum.解除冻结: result = bll.UnFreeze(user, clause); break; } context.Response.Write(result.Message); }
/// <summary> /// 动态生成控件绑定javascript代码 /// </summary> /// <param name="user"></param> /// <param name="isCreate">是否在新增时调用</param> /// <returns></returns> public string GetListBoxsInit(UserModel user, OperateEnum operate, int contractId) { try { List<NFMT.Data.Model.ClauseContract> clauseContracts = GetClauseContracts(user); if (clauseContracts == null || !clauseContracts.Any()) return string.Empty; System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.Text.StringBuilder sbCheck = new System.Text.StringBuilder(); System.Text.StringBuilder sbMasterIdsArray = new System.Text.StringBuilder(); NFMT.Data.BLL.ContractClauseBLL contractClauseBLL = new NFMT.Data.BLL.ContractClauseBLL(); NFMT.Common.ResultModel result = new NFMT.Common.ResultModel(); sb.Append("$(\"#jqxTabs\").jqxTabs({ width: \"99%\", position: \"top\" }); "); sb.Append(Environment.NewLine); int i = 0; foreach (int masterId in clauseContracts.Select(a => a.MasterId).Distinct()) { if (i == 1) { sb.Append("$('#jqxTabs').on('selected', function (event) {"); sb.Append(Environment.NewLine); sb.Append("var clickedItem = event.args.item;"); sb.Append(Environment.NewLine); } if (i != 0) { sb.AppendFormat("if(clickedItem =={0}&&is{0}Inited==false) ", i.ToString()); sb.Append("{"); } sb.Append("var localdataArray = ["); foreach (NFMT.Data.Model.ClauseContract clauseContract in clauseContracts.Where(a => a.MasterId == masterId).OrderByDescending(a => a.IsChose).ThenBy(b => b.Sort)) { result = contractClauseBLL.Get(user, clauseContract.ClauseId); if (result.ResultStatus != 0) continue; NFMT.Data.Model.ContractClause contractClause = result.ReturnValue as NFMT.Data.Model.ContractClause; if (contractClause == null) continue; sb.AppendFormat("[\"{0}\",\"{1}\"],", clauseContract.ClauseId.ToString(), contractClause.ClauseText); //勾选 if (operate == OperateEnum.新增) sbCheck.Append(CreateCheckItems(user, clauseContract, masterId, i)); } if (!string.IsNullOrEmpty(sb.ToString())) sb = sb.Remove(sb.Length - 1, 1); sb.Append("];"); sb.Append(Environment.NewLine); sb.AppendFormat("var source{0}=", masterId.ToString()); sb.Append("{localdata:localdataArray,async:false ,datatype:\"array\",datafields: [{ name: \"id\",type: \"int\", map: \"0\" },{ name: \"name\",type: \"string\", map: \"1\"}]};"); sb.Append(Environment.NewLine); sb.Append("try{"); sb.Append(Environment.NewLine); sb.AppendFormat("var listboxDataAdapter{0} = new $.jqx.dataAdapter(source{0});", masterId.ToString()); sb.Append(Environment.NewLine); sb.AppendFormat("$(\"#listbox_{0}\").jqxListBox( ", i.ToString()); sb.Append("{ "); sb.AppendFormat("source: listboxDataAdapter{0}, checkboxes: true,displayMember: \"name\", valueMember: \"id\",autoHeight:true,width:\"99%\",allowDrag:true,autoItemsHeight: true ", masterId.ToString()); sb.Append(Environment.NewLine); sbMasterIdsArray.Append(Environment.NewLine); sbMasterIdsArray.AppendFormat("masterIds.push({0});", masterId); sbMasterIdsArray.Append(Environment.NewLine); sbMasterIdsArray.AppendFormat(" var is{0}Inited = false;", i.ToString()); sb.Append("}); "); sb.Append(Environment.NewLine); sb.AppendFormat("is{0}Inited = true;", i.ToString()); sb.Append(Environment.NewLine); sb.Append(sbCheck); sb.Append(Environment.NewLine); sb.Append("}catch(e){alert(e.Message);}"); sb.Append(Environment.NewLine); if (i != 0) sb.Append("}"); i++; } if (i > 1) sb.Append("})"); //勾选 if (operate == OperateEnum.修改 || operate == OperateEnum.明细) { ContractClauseDAL dal = new ContractClauseDAL(); result = dal.LoadByContractId(user, contractId); if (result.ResultStatus == 0) { List<Model.ContractClause> contractClauses = result.ReturnValue as List<Model.ContractClause>; if (contractClauses != null && contractClauses.Any()) { int masterId = contractClauses.First().MasterId; sbCheck.AppendFormat("$('#jqxTabs').jqxTabs('select', {0}); ", string.Format("masterIds.indexOf({0})", masterId)); sbCheck.Append("for(var i =0;i<masterIds.length;i++){"); sbCheck.AppendFormat("if(masterIds[i]=={0})", masterId); sbCheck.Append("{continue;}"); if (operate == OperateEnum.明细) sbCheck.Append("$('#jqxTabs').jqxTabs('removeAt', i);"); //else // sbCheck.Append("$('#jqxTabs').jqxTabs('disableAt', i);"); sbCheck.Append("}"); sbCheck.Append(UpdateCheckItems(user, contractId)); if (operate == OperateEnum.明细) { sbCheck.AppendFormat("var items = $(\"#listbox_\"+{0}).jqxListBox('getItems');", string.Format("masterIds.indexOf({0})", masterId)); sbCheck.Append("var i =items.length-1;"); sbCheck.Append("for(;i>=0;i--){if(items[i].checked==false){"); sbCheck.AppendFormat("$(\"#listbox_\"+{0}).jqxListBox('removeItem', items[i]);", string.Format("masterIds.indexOf({0})", masterId)); sbCheck.Append("}}"); } sbCheck.Append(Environment.NewLine); if (operate == OperateEnum.明细) sbCheck.AppendFormat("$(\"#listbox_\"+{0}).jqxListBox(\"disabled\",true);", string.Format("masterIds.indexOf({0})", masterId)); } } } else sbCheck.Clear(); return sbMasterIdsArray.Append(sb).Append(Environment.NewLine).Append(sbCheck).Append(Environment.NewLine).ToString(); } catch { return string.Empty; } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int status = -1; int pageIndex = 1, pageSize = 10; string orderStr = string.Empty, whereStr = string.Empty; string sortDataField = string.Empty; string sortOrder = string.Empty; NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser; NFMT.Data.BLL.ContractClauseBLL bll = new NFMT.Data.BLL.ContractClauseBLL(); NFMT.Common.ResultModel result = bll.Load<NFMT.Data.Model.ContractClause>(user); if (result.ResultStatus != 0) { context.Response.Write(result.Message); context.Response.End(); } List<NFMT.Data.Model.ContractClause> clauses = new List<NFMT.Data.Model.ContractClause>(); clauses = result.ReturnValue as List<NFMT.Data.Model.ContractClause>; string masterName = context.Request["n"];//模糊搜索 if (!string.IsNullOrEmpty(masterName)) clauses = clauses.Where(temp => temp.ClauseText.Contains(masterName)).ToList(); if (!string.IsNullOrEmpty(context.Request["s"])) { if (int.TryParse(context.Request["s"], out status) && status > 0) clauses = clauses.Where(temp => (int)temp.ClauseStatus == status).ToList(); } int count = clauses.Count; if (!string.IsNullOrEmpty(context.Request.QueryString["pagenum"])) int.TryParse(context.Request.QueryString["pagenum"], out pageIndex); if (!string.IsNullOrEmpty(context.Request.QueryString["pagesize"])) int.TryParse(context.Request.QueryString["pagesize"], out pageSize); if (!string.IsNullOrEmpty(context.Request.QueryString["sortdatafield"]) && !string.IsNullOrEmpty(context.Request.QueryString["sortorder"])) { sortDataField = context.Request.QueryString["sortdatafield"].Trim(); sortOrder = context.Request.QueryString["sortorder"].Trim(); if (sortDataField == "ClauseStatusName") { if (sortOrder.ToLower() == "asc") clauses = (from m in clauses orderby m.ClauseStatus ascending select m).ToList(); else if (sortOrder.ToLower() == "desc") clauses = (from m in clauses orderby m.ClauseStatus descending select m).ToList(); } else if (sortDataField == "ClauseText") { if (sortOrder.ToLower() == "asc") clauses = (from m in clauses orderby m.ClauseText ascending select m).ToList(); else if (sortOrder.ToLower() == "desc") clauses = (from m in clauses orderby m.ClauseText descending select m).ToList(); } else if (sortDataField == "ClauseEnText") { if (sortOrder.ToLower() == "asc") clauses = (from m in clauses orderby m.ClauseEnText ascending select m).ToList(); else if (sortOrder.ToLower() == "desc") clauses = (from m in clauses orderby m.ClauseEnText descending select m).ToList(); } } clauses = (from m in clauses orderby m.ClauseId descending select m).ToList(); context.Response.ContentType = "application/json; charset=utf-8"; int pageStart = pageIndex * pageSize; clauses = clauses.Skip(pageStart).Take(pageSize).ToList(); Dictionary<string, object> dic = new Dictionary<string, object>(); dic.Add("count", count); dic.Add("data", clauses); string jsonStr = Newtonsoft.Json.JsonConvert.SerializeObject(dic); context.Response.Write(jsonStr); }