public HttpResponseMessage AddWzjzs(WJ_WzjzsModel model) { int id = bll.AddWzjzs(model); model.parentid = id; int success = bll.AddWzjzs(model); string[] fileClass = model.uploadpanelValue; List <FileClass> list = new List <FileClass>(); if (fileClass != null && fileClass.Length > 0) { foreach (var item in fileClass) { FileClass file = new FileClass(); JObject jo = new JObject(); jo = (JObject)JsonConvert.DeserializeObject(item); file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString(); file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString(); file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString(); file.size = jo["size"] == null ? 0 : (double)jo["size"]; list.Add(file); } } WJ_FilesBLL filebll = new WJ_FilesBLL(); foreach (var item in list) { WJ_FilesModel wjfilemodel = new WJ_FilesModel(); wjfilemodel.filetype = item.OriginalType; wjfilemodel.filename = item.OriginalName; wjfilemodel.filepath = item.OriginalPath; wjfilemodel.source = 1; wjfilemodel.sourceid = success; wjfilemodel.filesize = item.size; filebll.AddCqxm(wjfilemodel); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (success > 0) { #region 添加日志 SystemLogBLL slbll = new SystemLogBLL(); slbll.WriteSystemLog("违建管理", "", (int)model.createuserid); #endregion response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); } else { response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
public HttpResponseMessage AddCizitenEvent(RSM_CitizenModel cmmodel) { UserBLL userbll = new UserBLL(); HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request; //文件上传 HttpFileCollectionBase files = request.Files; sm_citizenservices model = new sm_citizenservices(); List <FileClass> list = new List <FileClass>(); string[] fileClass = cmmodel.uploadpanelValue; if (fileClass != null && fileClass.Length > 0) { foreach (var item in fileClass) { FileClass infileClass = new FileClass(); JObject jo = new JObject(); jo = (JObject)JsonConvert.DeserializeObject(item); infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString(); infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString(); infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString(); infileClass.size = jo["size"] == null ? 0 : (double)jo["size"]; list.Add(infileClass); } } if (!string.IsNullOrEmpty(request.Form["dutytime"])) { model.dutytime = Convert.ToDateTime(request.Form["dutytime"]); } model.eventid = request.Form["eventid"]; model.sourceid = Convert.ToInt32(request.Form["sourceid"]); model.complainant = request.Form["complainant"]; if (!string.IsNullOrEmpty(request.Form["cnumber"])) { model.cnumber = Convert.ToInt32(request.Form["cnumber"]); } if (!string.IsNullOrEmpty(request.Form["foundtime"])) { model.foundtime = Convert.ToDateTime(request.Form["foundtime"]); } model.contactphone = request.Form["contactphone"]; model.contactaddress = request.Form["contactaddress"]; model.eventaddress = request.Form["eventaddress"]; model.eventtitle = request.Form["eventtitle"]; model.eventcontent = request.Form["eventcontent"]; model.bigtypeid = Convert.ToInt32(request.Form["bigtypeid"]); model.smalltypeid = Convert.ToInt32(request.Form["smalltypeid"]); if (!string.IsNullOrEmpty(request.Form["limittime"])) { model.limittime = Convert.ToDateTime(request.Form["limittime"]); } model.recorduser = request.Form["recorduser"]; model.grometry = request.Form["grometry"]; model.sfzxzz = Convert.ToInt32(request.Form["sfzxzz"]); if (!string.IsNullOrEmpty(request.Form["srid"])) { model.srid = Convert.ToInt32(request.Form["srid"]); } model.createtime = DateTime.Now; model.createuserid = Convert.ToInt32(request.Form["userid"]); model.workflowtype = request.Form["zptype"]; model.suggest = request.Form["suggest"]; model.officeuserid = Convert.ToInt32(request.Form["userid"]); if (!string.IsNullOrEmpty(request.Form["xzid"])) { model.xzid = Convert.ToInt32(request.Form["xzid"]); model.pqxzid = request.Form["xzid"]; } WorkFlowClass wf = new WorkFlowClass(); WorkFlowClass wfs = new WorkFlowClass(); string userids = request.Form["userid"]; if (!string.IsNullOrEmpty(userids)) { string useridsstr = ""; foreach (UserModel item in userbll.GetUsersStaffList(2)) { useridsstr += item.ID + ","; } userids = "," + useridsstr; } #region 事件流程 wf.FunctionName = "sm_citizenservices"; //市民事件表名 wf.WFID = "2017021409560001"; //工作流程编号 2017021409560001 事件流程 wf.WFDID = "2017021410240010"; //工作流详细编号 2017021410240001 上报事件 wf.NextWFDID = request.Form["zptype"]; //下一步流程编号 2017021410240002 事件派遣 wf.NextWFUSERIDS = request.Form["zptype"] == "2017021410240001" ? userids : request.Form["nextperson"]; //下一步流程ID wf.DEALCONTENT = request.Form["suggest"]; wf.IsSendMsg = "false"; //是否发送短信 wf.WFCreateUserID = Convert.ToInt32(request.Form["userid"]); //当前流程创建人 wf.files = list; #endregion WorkFlowManagerBLL bll = new WorkFlowManagerBLL(); string wf_id = bll.WF_Submit(wf, model); string[] wf_ids = null; string wfsid = ""; string wfasid = ""; string citizenid = ""; if (!string.IsNullOrEmpty(wf_id)) { wf_ids = wf_id.Split(','); wfsid = wf_ids[0]; wfasid = wf_ids[1]; citizenid = wf_ids[2]; } #region 违章建筑同步信息 if (request.Form["sfwj"] == "1") { WJ_WzjzsBLL wjbll = new WJ_WzjzsBLL(); WJ_WzjzsModel wjmodel = new WJ_WzjzsModel(); WJ_FilesBLL filebll = new WJ_FilesBLL(); wjmodel.wjholder = model.eventtitle; wjmodel.citizenid = citizenid; wjmodel.foundtime = model.foundtime; wjmodel.address = model.eventaddress; wjmodel.contactphone = model.contactphone; int wjid = wjbll.AddWzjzs(wjmodel); wjmodel.parentid = wjid; int success = wjbll.AddWzjzs(wjmodel); foreach (var item in list) { WJ_FilesModel wjfilemodel = new WJ_FilesModel(); wjfilemodel.filetype = item.OriginalType; wjfilemodel.filename = item.OriginalName; wjfilemodel.filepath = item.OriginalPath; wjfilemodel.source = 1; wjfilemodel.sourceid = success; wjfilemodel.filesize = item.size; filebll.AddCqxm(wjfilemodel); //复制文件 DateTime dt = DateTime.Now; if (!Directory.Exists(ConfigManageClass.IllegallyBuiltOriginalPath)) { Directory.CreateDirectory(ConfigManageClass.IllegallyBuiltOriginalPath); } string OriginalPathYear = ConfigManageClass.IllegallyBuiltOriginalPath + "\\" + dt.Year; if (!Directory.Exists(OriginalPathYear)) { Directory.CreateDirectory(OriginalPathYear); } string OriginalPathdate = OriginalPathYear + "\\" + dt.ToString("yyyyMMdd"); if (!Directory.Exists(OriginalPathdate)) { Directory.CreateDirectory(OriginalPathdate); } File.Copy(ConfigManageClass.CitizenServiceOriginalPath + wjfilemodel.filepath, ConfigManageClass.IllegallyBuiltOriginalPath + wjfilemodel.filepath, true); } } #endregion #region 添加日志 SystemLogBLL slbll = new SystemLogBLL(); slbll.WriteSystemLog("市民事件", "", Convert.ToInt32(request.Form["userid"])); #endregion //#region 发送短信 //string phone = "";//15888309757,18768196242 //SMS_Messages sm = new SMS_Messages(); //string[] phones = phone.Split(','); //string content = "您有一条新的市民事件需要处理,限办期限:" + model.limittime + ",请及时处理"; //sm.SendMessage(phones, content); //#endregion HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); return(response); }