/// <summary> /// 修改拆迁 /// </summary> /// <param name="model"></param> /// <returns></returns> public int EditCqxm(WJ_CqxmsModel model) { using (Entities db = new Entities()) { wj_cqxms wcmodel = db.wj_cqxms.FirstOrDefault(a => a.cqid == model.cqid); if (wcmodel != null) { wcmodel.cqid = model.cqid; wcmodel.projectname = model.projectname; wcmodel.projectleader = model.projectleader; wcmodel.contackphone = model.contackphone; wcmodel.cqarea = model.cqarea; wcmodel.starttime = model.starttime; wcmodel.endtime = model.endtime; wcmodel.ssqy = model.ssqy; wcmodel.address = model.address; wcmodel.geography = model.geography; wcmodel.remark = model.remark; wcmodel.createuserid = model.createuserid; wcmodel.createtime = DateTime.Now; } db.SaveChanges(); } return(model.cqid); }
public HttpResponseMessage EditCqxm(WJ_CqxmsModel model) { int success = bll.EditCqxm(model); HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (success > 0) { response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
public HttpResponseMessage AddCqxm(WJ_CqxmsModel model) { int success = bll.AddCqxm(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 = 2; wjfilemodel.sourceid = success; wjfilemodel.filesize = item.size; filebll.AddCqxm(wjfilemodel); } HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK); if (success > 0) { response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html"); } return(response); }
/// <summary> /// 拆迁详情 /// </summary> /// <param name="filters"></param> /// <param name="start"></param> /// <param name="limit"></param> /// <returns></returns> public WJ_CqxmsModel GetCqxmModel(int cqid) { WJ_FilesDAL dal = new WJ_FilesDAL(); WJ_CqxmsModel model = new WJ_CqxmsModel(); using (Entities db = new Entities()) { IQueryable <WJ_CqxmsModel> queryable = from a in db.wj_cqxms join b_join in db.base_users on a.createuserid equals b_join.id into bTmp from b in bTmp.DefaultIfEmpty() join c_join in db.base_zds on new { ssqy = a.ssqy, zd_type = "type_cq" } equals new { ssqy = c_join.zd_id, zd_type = c_join.zd_type } into cTmp from c in cTmp.DefaultIfEmpty() where a.cqid == cqid select new WJ_CqxmsModel { cqid = a.cqid, projectname = a.projectname, projectleader = a.projectleader, contackphone = a.contackphone, starttime = a.starttime, endtime = a.endtime, address = a.address, ssqyname = c == null ? "" : c.zd_name, createusername = b == null ? "" : b.displayname, cqarea = a.cqarea, ssqy = a.ssqy, geography = a.geography, remark = a.remark, }; model = queryable.FirstOrDefault(); if (model != null) { model.wjfilelist = dal.GetFileList(model.cqid, 2); model.path = "DemolitionOriginalPath"; } return(model); } }
/// <summary> /// 添加拆迁 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddCqxm(WJ_CqxmsModel model) { using (Entities db = new Entities()) { wj_cqxms wcmodel = new wj_cqxms(); wcmodel.cqid = model.cqid; wcmodel.projectname = model.projectname; wcmodel.projectleader = model.projectleader; wcmodel.contackphone = model.contackphone; wcmodel.cqarea = model.cqarea; wcmodel.starttime = model.starttime; wcmodel.endtime = model.endtime; wcmodel.ssqy = model.ssqy; wcmodel.address = model.address; wcmodel.geography = model.geography; wcmodel.remark = model.remark; wcmodel.createuserid = model.createuserid; wcmodel.createtime = DateTime.Now; db.wj_cqxms.Add(wcmodel); db.SaveChanges(); return(wcmodel.cqid); } }
/// <summary> /// 修改拆迁 /// </summary> /// <param name="model"></param> /// <returns></returns> public int EditCqxm(WJ_CqxmsModel model) { return(dal.EditCqxm(model)); }
/// <summary> /// 添加拆迁 /// </summary> /// <param name="model"></param> /// <returns></returns> public int AddCqxm(WJ_CqxmsModel model) { return(dal.AddCqxm(model)); }