Ejemplo n.º 1
0
        public HttpResponseMessage CizitenEventEdit(RSM_CitizenModel cmmodel)
        {
            SM_CitizenServicesBLL bll     = new SM_CitizenServicesBLL();
            HttpRequestBase       request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            //文件上传
            HttpFileCollectionBase files = request.Files;
            sm_citizenservices     model = new sm_citizenservices();

            string[] fileClass = cmmodel.uploadpanelValue;

            if (fileClass != null && fileClass.Length > 0)
            {
                //当有图片时,获取上报时的用户活动实例
                string wfsuid = bll.GetEditWFSUID(request.Form["wfsid"]);

                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"];
                    infileClass.wfsuid       = wfsuid;
                    bll.AddEditPictures(infileClass);
                }
            }

            model.citizenid = request.Form["citizenid"];
            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"];

            bll.CizitenEventEdit(model);

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }