Example #1
0
        public HttpResponseMessage AddYhTask(YH_YhtaskModel 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);
                }
            }


            yh_yhtasks yhmodel = new yh_yhtasks();

            yhmodel.yhcompany    = model.yhcompany;
            yhmodel.foundtime    = model.foundtime;
            yhmodel.fileename    = model.fileename;
            yhmodel.wtsource     = model.wtsource;
            yhmodel.yhtype       = model.yhtype;
            yhmodel.wtbigclass   = model.wtbigclass;
            yhmodel.wtsmallclass = model.wtsmallclass;
            yhmodel.yhobject     = model.yhobject;
            yhmodel.weather      = model.weather;
            yhmodel.duetime      = model.duetime;
            yhmodel.outlay       = model.outlay;
            yhmodel.workload     = model.workload;
            yhmodel.yhcontract   = model.yhcontract;
            yhmodel.wtaddress    = model.wtaddress;
            yhmodel.wtdescribe   = model.wtdescribe;
            yhmodel.geography84  = model.geography84;
            //if (!string.IsNullOrEmpty(model.geography84))
            //{
            //    yhmodel.geography2000=new MapXYConvent().WGS84ToCGCS2000(model.geography84);
            //}
            yhmodel.wtnature     = model.wtnature;
            yhmodel.points       = model.points;
            yhmodel.debit        = model.debit;
            yhmodel.sendusername = model.sendusername;
            yhmodel.sendopinion  = model.sendopinion;
            yhmodel.createuserid = model.createuserid;
            WorkFlowClass wf = new WorkFlowClass();

            wf.FunctionName   = "yh_yhtasks";                  //市民事件表名
            wf.WFID           = "2017040610490001";            //工作流程编号 2017021409560001 事件流程
            wf.WFDID          = "2017040610570001";            //工作流详细编号 2017021410240001 上报事件
            wf.NextWFDID      = "2017040610570002";            //下一步流程编号 2017021410240002 事件派遣
            wf.NextWFUSERIDS  = model.createuserid.ToString(); //下一步流程ID
            wf.IsSendMsg      = "false";                       //是否发送短信
            wf.WFCreateUserID = model.createuserid;            //当前流程创建人
            wf.files          = list;
            WorkFlowManagerBLL wfbll = new WorkFlowManagerBLL();
            string             wf_id = wfbll.WF_Submit(wf, yhmodel);

            #region 添加日志
            SystemLogBLL slbll = new SystemLogBLL();
            slbll.WriteSystemLog("养护问题", "", (int)model.createuserid);
            #endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }
Example #2
0
        public object AddYhTaskApi(YH_YhtaskModel model)
        {
            #region 图片处理
            List <FileClass> List_FC    = new List <FileClass>();
            string           OriginPath = ConfigManageClass.YhTaskOriginalPath;
            string           smallPath  = ConfigManageClass.YhTaskFilesPath;

            for (int i = 0; i < model.uploadpanelValue.Length; i++)
            {
                string   imgArray = model.uploadpanelValue[i];
                string[] spilt    = imgArray.Split(',');
                if (spilt.Length > 0)
                {
                    byte[]    imgByte = Convert.FromBase64String(spilt[1]);
                    FileClass imgFile = FileFactory.FileUpload(imgByte, ".jpg", OriginPath, smallPath, 100, 100);
                    List_FC.Add(imgFile);
                }
            }

            #endregion

            yh_yhtasks yhmodel = new yh_yhtasks();
            yhmodel.yhcompany    = model.yhcompany;
            yhmodel.foundtime    = model.foundtime;
            yhmodel.fileename    = model.fileename;
            yhmodel.wtsource     = model.wtsource;
            yhmodel.yhtype       = model.yhtype;
            yhmodel.wtbigclass   = model.wtbigclass;
            yhmodel.wtsmallclass = model.wtsmallclass;
            yhmodel.yhobject     = model.yhobject;
            yhmodel.weather      = model.weather;
            yhmodel.duetime      = model.duetime;
            yhmodel.outlay       = model.outlay;
            yhmodel.workload     = model.workload;
            yhmodel.yhcontract   = model.yhcontract;
            yhmodel.wtaddress    = model.wtaddress;
            yhmodel.wtdescribe   = model.wtdescribe;
            yhmodel.geography84  = model.geography84;
            yhmodel.wtnature     = model.wtnature;
            yhmodel.points       = model.points;
            yhmodel.debit        = model.debit;
            yhmodel.sendusername = model.sendusername;
            yhmodel.sendopinion  = model.sendopinion;
            yhmodel.createuserid = model.createuserid;
            WorkFlowClass wf = new WorkFlowClass();

            wf.FunctionName   = "yh_yhtasks";                  //市民事件表名
            wf.WFID           = "2017040610490001";            //工作流程编号 2017021409560001 事件流程
            wf.WFDID          = "2017040610570001";            //工作流详细编号 2017021410240001 上报事件
            wf.NextWFDID      = "2017040610570003";            //下一步流程编号 2017021410240002 事件派遣
            wf.NextWFUSERIDS  = model.createuserid.ToString(); //下一步流程ID
            wf.IsSendMsg      = "false";                       //是否发送短信
            wf.WFCreateUserID = model.createuserid;            //当前流程创建人
            wf.files          = List_FC;

            try
            {
                WorkFlowManagerBLL wfbll = new WorkFlowManagerBLL();
                string             wf_id = wfbll.WF_Submit(wf, yhmodel);
                return(new
                {
                    msg = "上报成功",
                    resCode = 1
                });
            }
            catch (Exception)
            {
                return(new
                {
                    msg = "json数据不正确",
                    resCode = 0
                });
                // return "{\"msg\":\"json数据不正确\",\"resCode\":\"0\"}";
            }
        }