private void GetDetail(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { int ID = RequestHelper.GetInt("ID", 0); SCZM.BLL.Repair.repair_Contract bll = new SCZM.BLL.Repair.repair_Contract(); DataSet ds = bll.GetDetail(ID); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}"); return; } string rowsStr = Utils.ToJson(dt); DataTable AttachmentDT = ds.Tables["attachment"]; string attachmentStr = Utils.ToJson(AttachmentDT); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":" + rowsStr); jsonStr.Append(",\"attachmentInfo\":" + attachmentStr); jsonStr.Append("}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void DelData(HttpContext context, string btn) { if (btn != "btnDel") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string IDStr = RequestHelper.GetString("IDStr"); if (IDStr == "") { context.Response.Write("{\"status\":\"0\",\"msg\":\"请选择需要删除的记录!\"}"); return; } Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.BLL.Repair.repair_Contract bll = new SCZM.BLL.Repair.repair_Contract(); string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (bll.DeleteList(PageValidate.SafeLongFilter(IDStr, 0), out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "删除维修合同:" + IDStr; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void GetList(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { string IntentionCode = RequestHelper.GetString("IntentionCode").Trim(); string ContractCode = RequestHelper.GetString("ContractCode").Trim(); string CustTypeId = RequestHelper.GetString("CustTypeId").Trim(); string CustName = RequestHelper.GetString("CustName").Trim(); string MachineModel = RequestHelper.GetString("MachineModel").Trim(); string MachineCode = RequestHelper.GetString("MachineCode").Trim(); StringBuilder strWhere = new StringBuilder(); //-------------------------------------------------------------- Model.System.sys_LoginUser LoginUserModel = BaseWeb.GetLoginInfo(); if (LoginUserModel.IsAdmin == false) { strWhere.Append(" and a.OperaId in (select CtrlPerId from v_sys_PersonCtrl where PerId=" + LoginUserModel.ID + ") "); } //------------------------------------------------------------------------- //维修意向号 if (IntentionCode != "" && Utils.IsSafeSqlString(IntentionCode)) { strWhere.Append(" and b.IntentionCode like '%" + Utils.Filter(IntentionCode) + "%'"); } //合同单号 if (ContractCode != "" && Utils.IsSafeSqlString(ContractCode)) { strWhere.Append(" and a.ContractCode like '%" + Utils.Filter(ContractCode) + "%'"); } //客户类型 if (CustTypeId != "") { strWhere.Append(" and b.CustTypeId=" + Utils.StrToInt(CustTypeId, 0)); } //客户名 if (CustName != "" && Utils.IsSafeSqlString(CustName)) { strWhere.Append(" and b.CustName like '%" + Utils.Filter(CustName) + "%'"); } //机型 if (MachineModel != "") { strWhere.Append(" and c.MachineModel like '%" + Utils.Filter(MachineModel) + "%' "); } //机号 if (MachineCode != "") { strWhere.Append(" and b.MachineCode like '%" + Utils.Filter(MachineCode) + "%'"); } SCZM.BLL.Repair.repair_Contract bll = new SCZM.BLL.Repair.repair_Contract(); DataTable dt = bll.GetList(strWhere.ToString()).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":" + rowsStr + "}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); } }
private void SaveData(HttpContext context, string btn) { if (btn != "btnSave") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string ID = RequestHelper.GetString("ID"); string IntentionId = RequestHelper.GetString("IntentionId"); string ContractCode = RequestHelper.GetString("ContractCode"); string WarrantyPeriod = RequestHelper.GetString("WarrantyPeriod"); string WarrantyContent = RequestHelper.GetString("WarrantyContent"); string AttachmentId_Contract = RequestHelper.GetString("AttachmentId_Contract"); string ContractDate = RequestHelper.GetString("ContractDate"); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); SCZM.Model.Repair.repair_Contract model = new SCZM.Model.Repair.repair_Contract(); SCZM.BLL.Repair.repair_Contract bll = new SCZM.BLL.Repair.repair_Contract(); model.ID = Utils.StrToInt(ID, 0); model.IntentionId = Utils.StrToInt(IntentionId, 0); model.WarrantyPeriod = Utils.StrToInt(WarrantyPeriod, 0); model.WarrantyContent = WarrantyContent; model.AttachmentId_Contract = AttachmentId_Contract; if (ContractDate != "") { model.ContractDate = Utils.StrToDateTime(ContractDate); } if (ContractCode == "") { model.ContractCode = "HT" + DateTime.Now.ToString("yyyyMMdd") + bll.GetMaxId(); } else { model.ContractCode = ContractCode; } model.OperaDepId = loginUserModel.DepId; model.OperaId = loginUserModel.ID; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; string status = "0"; string operaAction = ""; string operaMemo = ""; try { if (ID == "") { model.ID = bll.Add(model, out operaMessage); if (model.ID > 0) { status = "1"; operaAction = Enums.ActionEnum.Add.ToString(); operaMemo = "新增维修合同:" + model.ID; } } else { if (bll.Update(model, out operaMessage)) { status = "1"; operaAction = Enums.ActionEnum.Edit.ToString(); operaMemo = "修改维修合同:" + model.ID; } } if (status == "1") { //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); } context.Response.Write("{\"status\":\"" + status + "\",\"msg\":\"" + operaMessage + "\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }