/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.Repair.repair_Scheme model, out string message) { message = "保存成功!"; int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Scheme == "" || model.AttachmentId_Scheme == null ? "" : model.AttachmentId_Scheme + ","); string FileUse = "维修意向"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID); } if (model.SchemeDate != null && model.AttachmentId_Agreement != "") { BLL.Repair.repair_Intention intentionBll = new repair_Intention(); string message_agreement = ""; intentionBll.SaveAgreement(model.IntentionId, model.AttachmentId_Agreement, (model.SchemeDate == null?DateTime.Now:Utils.StrToDateTime((model.SchemeDate.ToString()))), out message_agreement); } return(true); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Repair.repair_SettlementList model, out string message) { message = "保存成功!"; int rowId = dal.Add(model); if (rowId < 1) { message = "保存失败!"; } else { DAL.Repair.repair_Intention dal_Intention = new DAL.Repair.repair_Intention(); dal_Intention.UpdateRepairState(model.IntentionId.ToString(), 40); BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Settlement == "" || model.AttachmentId_Settlement == null ? "" : model.AttachmentId_Settlement + ",") ; string FileUse = "维修结算"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId); } } return(rowId); }
private void GetData(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } try { int mailId = RequestHelper.GetInt("id", 0); int receiveId = RequestHelper.GetInt("receiveId", 0); BLL.System.sys_Mail_Send bll = new BLL.System.sys_Mail_Send(); DataTable dt = bll.GetList(mailId).Tables[0]; if (dt.Rows.Count == 0) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,该条数据已被其他人删除!\"}"); return; } //如果收件箱ID大于0,表示来源于收件箱页面,则更新收件箱已读标志 if (receiveId > 0) { bll.UpdateFlagRead(receiveId.ToString(), 1); } string rowsStr = Utils.ToJson(dt); string attachStr = ""; string attachId = Utils.ObjectToStr(dt.Rows[0]["Attachment"]); if (attachId != "" && attachId != "0") { DataTable attachDT = new BLL.System.sys_Attachment().GetList("ID in(" + attachId + ")").Tables[0]; attachStr = Utils.ToJson(attachDT); } StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append(rowsStr); if (attachStr == "") { jsonStr.Append(",\"attachinfo\":\"\""); } else { jsonStr.Append(",\"attachinfo\":" + attachStr); } jsonStr.Append("}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
protected void Page_Load(object sender, EventArgs e) { string exportType = Request["txtExportType"]; if (exportType == "1") { string error = BaseWeb.CheckUserBtnPower(); if (error != "") { return; } string attachmentId = Request["txtAttachmentId"]; if (attachmentId == "") { return; } BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); Model.System.sys_Attachment model = bll.GetModel(Utils.StrToInt(attachmentId, 0)); string filename = Utils.GetMapPath(model.FilePath); if (filename == "") { return; } System.IO.FileInfo file = new System.IO.FileInfo(filename); Response.Clear(); Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name)); Response.AddHeader("Content-Length", file.Length.ToString()); Response.ContentType = "application/x-bittorrent"; Response.WriteFile(file.FullName); Response.End(); } else { string filename = Request["txtName"]; Response.Clear(); Response.Buffer = true; Response.Charset = "utf-8"; Response.ContentEncoding = System.Text.Encoding.UTF8; Response.AppendHeader("content-disposition", "attachment;filename=\"" + System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(filename)) + "-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx\""); Response.ContentType = "Application/ms-excel"; Response.Write("<html>\n<head>\n"); Response.Write("<style type=\"text/css\">\n.pb{font-size:13px;border-collapse:collapse;} " + "\n.pb th{font-weight:bold;text-align:center;border:0.5pt solid windowtext;padding:2px;} " + "\n.pb td{border:0.5pt solid windowtext;padding:2px;}\n</style>\n</head>\n"); Response.Write("<body>\n" + Request["txtContent"] + "\n</body>\n</html>"); Response.Flush(); Response.End(); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Proj.proj_Contract model, int submitFlag, out string message) { message = "保存成功!"; if (dal.Exists(model.ProjId, 0)) { message = "对不起,该项目合同已存在!"; return(0); } string errMessage = ""; BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec(); string tableName = "proj_Contract"; if (submitFlag == 1) { message = "保存并提交成功!"; errMessage = procBLL.CheckSubmit(tableName, model.BillSign, model.DepId, "", model.OperaId); if (errMessage != "") { message = errMessage; return(0); } } int rowId = dal.Add(model); if (rowId < 1) { message = "保存失败!"; } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") + (model.AttachmentId_ControlCard == "" || model.AttachmentId_ControlCard == null ? "" : model.AttachmentId_ControlCard + ",") ; string FileUse = "项目合同"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId); } if (submitFlag == 1) { errMessage = procBLL.SetBillProcess_Submit(tableName, rowId.ToString(), 1, model.OperaId); if (errMessage != "") { message = "保存成功,但提交失败,请联系系统管理员!"; } } } return(rowId); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(UHPROJ.Model.Base.shop_NewBuildApply model, int submitFlag, out string message) { message = "保存成功!"; string errMessage = ""; BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec(); string tableName = "shop_NewBuildApply"; if (submitFlag == 1) { message = "保存并提交成功!"; errMessage = procBLL.CheckSubmit(tableName, model.BillSign, model.DepId, "", model.OperaId); if (errMessage != "") { message = errMessage; return(false); } } int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_ZSRW == "" || model.AttachmentId_ZSRW == null ? "" : model.AttachmentId_ZSRW + ",") + (model.AttachmentId_GH == "" || model.AttachmentId_GH == null ? "" : model.AttachmentId_GH + ",") ; string FileUse = "加盟申请"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID); } if (submitFlag == 1) { errMessage = procBLL.SetBillProcess_Submit(tableName, model.ID.ToString(), 1, model.OperaId); if (errMessage != "") { message = "保存成功,但提交失败,请联系系统管理员!"; } } return(true); } }
private void DelData(HttpContext context, string btn) { if (btn != "btnDel") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); //string status = "0"; string operaAction = ""; string operaMemo = ""; try { UpLoad upFiles = new UpLoad(); DataTable dt = bll.GetList("Source=1 and UseId=0").Tables[0]; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { upFiles.fileDel(dt.Rows[i]["FilePath"].ToString()); } } bll.Delete("Source=1 and UseId=0"); //status = "1"; operaAction = Enums.ActionEnum.Delete.ToString(); operaMemo = "清理上传文件"; //写入操作日志 BaseWeb.AddOpera(loginUserModel, int.Parse(RequestHelper.GetQueryString("MenuId")), operaAction, operaMemo); context.Response.Write("{\"status\":\"1\",\"msg\":\"清理成功!\"}"); return; } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
private void ResponseInfo(HttpContext context, string remsg) { JsonData jd = JsonMapper.ToObject(remsg); string status = jd["status"].ToString(); string msg = jd["msg"].ToString(); if (status == "0") { showError(context, msg); return; } string filePath = jd["path"].ToString(); //取得上传后的路径 string fileName = jd["name"].ToString(); //取得上传的文件名 Model.System.sys_Attachment model = new Model.System.sys_Attachment(); Model.System.sys_LoginUser loginUserModel = BaseWeb.GetLoginInfo(); model.Source = 1; model.FileName = fileName; model.FilePath = filePath; model.FileUse = ""; model.UseId = 0; model.OperaName = loginUserModel.PerName; model.OperaTime = DateTime.Now; string operaMessage = ""; BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); int fileId = bll.Add(model, out operaMessage); Hashtable hash = new Hashtable(); hash["error"] = 0; hash["url"] = filePath; hash["fileName"] = fileName; hash["fileId"] = fileId; context.Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); context.Response.Write(JsonMapper.ToJson(hash)); context.Response.End(); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Proj.proj_PurchaseInvoice model, out string message) { message = "保存成功!"; int rowId = dal.Add(model); if (rowId < 1) { message = "保存失败!"; } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Invoice == "" || model.AttachmentId_Invoice == null ? "" : model.AttachmentId_Invoice + ",") ; string FileUse = "付款发票"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId); } } return(rowId); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Repair.repair_Contract model, out string message) { message = "保存成功!"; int rowId = dal.Add(model); if (rowId < 1) { message = "保存失败!"; } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") ; string FileUse = "维修合同"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId); } } return(rowId); }
public bool SaveAgreement(int ID, string AttachmentId_Agreement, DateTime AgreementDate, out string message) { message = "上传成功"; int row = dal.SaveAgreement(ID, AttachmentId_Agreement, AgreementDate); if (row == 0) { message = "对不起,所选数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (AttachmentId_Agreement == "" || AttachmentId_Agreement == null ? "" : AttachmentId_Agreement + ","); string FileUse = "维修协议"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, ID); } return(true); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.Proj.proj_PurchaseInvoice model, out string message) { message = "保存成功!"; int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Invoice == "" || model.AttachmentId_Invoice == null ? "" : model.AttachmentId_Invoice + ",") ; string FileUse = "付款发票"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID); } return(true); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.Repair.repair_Contract model, out string message) { message = "保存成功!"; int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") ; string FileUse = "维修合同"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID); } return(true); } }
private void GetList(HttpContext context, string btn) { if (btn != "show") { context.Response.Write("{\"status\":\"0.2\",\"msg\":\"对不起,您没有操作权限!\"}"); return; } string fileName = RequestHelper.GetString("fileName"); string fileUse = RequestHelper.GetString("fileUse"); string operaName = RequestHelper.GetString("operaName"); string beginDate = RequestHelper.GetString("beginDate"); string endDate = RequestHelper.GetString("endDate"); StringBuilder strWhere = new StringBuilder(); strWhere.Append("Source=1 and "); List <SqlParameter> parameterList = new List <SqlParameter>(); SqlParameter tempParameter = new SqlParameter(); if (fileName != "") { strWhere.Append("FileName like '%' + @FileName + '%' and "); tempParameter = new SqlParameter("@FileName", SqlDbType.NVarChar); tempParameter.Value = fileName; parameterList.Add(tempParameter); } if (fileUse != "") { strWhere.Append("FilePath like '%' + @FilePath + '%' and "); tempParameter = new SqlParameter("@FilePath", SqlDbType.NVarChar); tempParameter.Value = fileUse; parameterList.Add(tempParameter); } if (operaName != "") { strWhere.Append("OperaName like '%' + @OperaName + '%' and "); tempParameter = new SqlParameter("@OperaName", SqlDbType.NVarChar); tempParameter.Value = operaName; parameterList.Add(tempParameter); } if (beginDate != "") { strWhere.Append("OperaTime >= @BeginOperTime and "); tempParameter = new SqlParameter("@BeginOperTime", SqlDbType.DateTime); tempParameter.Value = DateTime.Parse(beginDate); parameterList.Add(tempParameter); } if (endDate != "") { strWhere.Append("OperaTime <= @EndOperTime and "); tempParameter = new SqlParameter("@EndOperTime", SqlDbType.DateTime); tempParameter.Value = DateTime.Parse(endDate + " 23:59:59"); parameterList.Add(tempParameter); } BLL.System.sys_Attachment bll = new BLL.System.sys_Attachment(); try { DataTable dt = bll.GetList(Utils.DelLastChar(strWhere.ToString(), " and "), parameterList).Tables[0]; string rowsStr = Utils.ToJson(dt); StringBuilder jsonStr = new StringBuilder(); jsonStr.Append("{\"status\":\"1\",\"msg\":\"数据获取成功!\",\"info\":"); jsonStr.Append("{\"total\":" + dt.Rows.Count + ",\"rows\":"); jsonStr.Append(rowsStr); jsonStr.Append("}}"); context.Response.Write(jsonStr); } catch (Exception e) { context.Response.Write("{\"status\":\"0\",\"msg\":\"对不起,系统出错:" + Utils.HtmlEncode(e.Message) + "\"}"); return; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(SCZM.Model.Repair.repair_Schedule model, out string message) { message = "保存成功!"; if (!dal.CheckSaveData(model.ScheduleDate, model.ID, model.AssignmentProcedureId)) { message = "请合理保存反馈时间"; return(0); } int ScheduleType_current = dal.GetScheduleType(model.AssignmentProcedureId); switch (ScheduleType_current) { case 1: if (model.ScheduleType == 1) { message = "当前进度以保存,请返回查看"; return(0); } break; case 2: if (model.ScheduleType == 2 || model.ScheduleType == 3) { message = "当前进度以保存,请返回查看"; return(0); } break; case 3: message = "当前进度以保存,请返回查看"; return(0); case -1: if (model.ScheduleType == 2 || model.ScheduleType == 3) { message = "当前进度以保存,请返回查看"; return(0); } break; default: break; } int rowId = dal.Add(model); if (rowId < 1) { message = "保存失败!"; } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentList_Schedule == "" || model.AttachmentList_Schedule == null ? "" : model.AttachmentList_Schedule + ",") ; string FileUse = "进度反馈"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, rowId); } } return(rowId); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(SCZM.Model.Proj.proj_Contract model, int submitFlag, out string message) { message = "保存成功!"; if (dal.Exists(model.ProjId, model.ID)) { message = "对不起,该项目合同已存在!"; return(false); } string errMessage = ""; BLL.System.sys_Process_Exec procBLL = new BLL.System.sys_Process_Exec(); string tableName = "proj_Contract"; Model.Proj.proj_Contract model_old = dal.GetModel(model.ID); if (model_old.BillState == 2) { int Num = procBLL.DelBillProcess(model.BillSign, model.ID, tableName, model.OperaId, model.OperaName); //if (Num == -1) { // message = "对不起,系统出错,请联系系统管理员!"; // return false; //} } if (submitFlag == 1) { message = "保存并提交成功!"; errMessage = procBLL.CheckSubmit(tableName, model.BillSign, model.DepId, "", model.OperaId); if (errMessage != "") { message = errMessage; return(false); } } int rows = dal.Update(model); if (rows == 0) { message = "对不起,该条数据已被其他人删除!"; return(false); } else { BLL.System.sys_Attachment attachmenBLL = new BLL.System.sys_Attachment(); string IDList = (model.AttachmentId_Contract == "" || model.AttachmentId_Contract == null ? "" : model.AttachmentId_Contract + ",") + (model.AttachmentId_ControlCard == "" || model.AttachmentId_ControlCard == null ? "" : model.AttachmentId_ControlCard + ",") ; string FileUse = "项目合同"; if (IDList != "") { attachmenBLL.UpdateUseList(Utils.DelLastComma(IDList), FileUse, model.ID); } // if (submitFlag == 1) { errMessage = procBLL.SetBillProcess_Submit(tableName, model.ID.ToString(), 1, model.OperaId); if (errMessage != "") { message = "保存成功,但提交失败,请联系系统管理员!"; } } return(true); } }