Ejemplo n.º 1
0
        public object AddCitizenService(AddCitizenEventModel scmodel)
        {
            try
            {
                SM_CitizenServicesBLL scbll = new SM_CitizenServicesBLL();
                WorkFlowClass         wf    = new WorkFlowClass();
                UserBLL            userbll  = new UserBLL();
                sm_citizenservices model    = new sm_citizenservices();
                string             userids  = "";

                //获取指挥中心人员id
                foreach (UserModel item in userbll.GetUsersStaffList(2))
                {
                    userids += item.ID + ",";
                }
                userids = "," + userids;

                #region 图片处理
                List <FileClass> List_FC    = new List <FileClass>();
                string           OriginPath = ConfigManageClass.CitizenServiceOriginalPath;
                string           smallPath  = ConfigManageClass.CitizenServiceFilesPath;


                if (scmodel.photo1 != null && scmodel.photo1.Length != 0)
                {
                    string[] spilt = scmodel.photo1.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo2 != null && scmodel.photo2.Length != 0)
                {
                    string[] spilt = scmodel.photo2.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo3 != null && scmodel.photo3.Length != 0)
                {
                    string[] spilt = scmodel.photo3.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                if (scmodel.photo4 != null && scmodel.photo4.Length != 0)
                {
                    string[] spilt = scmodel.photo4.Split(',');
                    if (spilt.Length > 1)
                    {
                        byte[]    myByte = Convert.FromBase64String(spilt[1]);
                        FileClass FC     = FileFactory.FileUpload(myByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(FC);
                    }
                }
                #endregion

                #region 事件流程
                if (scmodel.processingType == 1)
                {
                    wf.FunctionName   = "sm_citizenservices";            //市民事件表名
                    wf.WFID           = "2017021409560001";              //工作流程编号 2017021409560001 事件流程
                    wf.WFDID          = "2017021410240010";              //工作流详细编号 2017021410240001 上报事件
                    wf.NextWFDID      = "2017021410240003";              //下一步流程编号 2017021410240002 事件派遣
                    wf.NextWFUSERIDS  = scmodel.createuserid.ToString(); //下一步流程ID
                    wf.IsSendMsg      = "false";                         //是否发送短信
                    wf.WFCreateUserID = scmodel.createuserid;            //当前流程创建人
                    wf.files          = List_FC;
                }
                else
                {
                    wf.FunctionName   = "sm_citizenservices"; //市民事件表名
                    wf.WFID           = "2017021409560001";   //工作流程编号 2017021409560001 事件流程
                    wf.WFDID          = "2017021410240010";   //工作流详细编号 2017021410240001 上报事件
                    wf.NextWFDID      = "2017021410240001";   //下一步流程编号 2017021410240002 事件派遣
                    wf.NextWFUSERIDS  = userids;              //下一步流程ID
                    wf.IsSendMsg      = "false";              //是否发送短信
                    wf.WFCreateUserID = scmodel.createuserid; //当前流程创建人
                    wf.files          = List_FC;
                }
                #endregion
                string id = (scbll.GetCitizenAutoID()["AutoXCFXDayID"] + 1).ToString();
                if (id.Length == 1)
                {
                    id = "00" + id;
                }
                else if (id.Length == 2)
                {
                    id = "0" + id;
                }
                model.dutytime       = scmodel.dutytime;
                model.eventid        = "巡查发现" + DateTime.Now.ToString("yyyyMMdd") + id; //scmodel.eventid;
                model.sourceid       = scmodel.sourceid;
                model.complainant    = scmodel.complainant;
                model.cnumber        = scmodel.cnumber;
                model.foundtime      = scmodel.foundtime;
                model.contactphone   = scmodel.contactphone;
                model.contactaddress = scmodel.contactaddress;
                model.eventaddress   = scmodel.eventaddress;
                model.eventtitle     = scmodel.eventtitle;
                model.eventcontent   = scmodel.eventcontent;
                model.bigtypeid      = scmodel.bigtypeid;
                model.smalltypeid    = scmodel.smalltypeid;
                model.limittime      = scmodel.limittime;
                model.recorduser     = scmodel.recorduser;
                model.grometry       = scmodel.grometry;
                model.sfzxzz         = scmodel.sfzxzz;
                model.srid           = scmodel.srid;
                model.createtime     = DateTime.Now;
                model.createuserid   = scmodel.createuserid;
                WorkFlowManagerBLL bll   = new WorkFlowManagerBLL();
                string             wf_id = bll.WF_Submit(wf, model);

                //#region 发送短信
                //if (scmodel.isSendMsg == "1")
                //{
                //    string phone = userbll.GetPhones(wf.NextWFUSERIDS);//15888309757,18768196242
                //    string[] phones = phone.Split(',');
                //    string content = "您有一条新的市民事件需要处理,限办期限:" + scmodel.limittime + ",请及时处理";
                //    SMSMessagesBLL smsbll = new SMSMessagesBLL();
                //    smsbll.SendMessage(phones, content);
                //}
                //#endregion
                //return "{\"msg\":\"上报成功!\",\"resCode\":\"1\"}";
                return(new
                {
                    msg = "上报成功",
                    resCode = 1
                });
            }
            catch (Exception)
            {
                return(new
                {
                    msg = "json数据不正确",
                    resCode = 0
                });
                // return "{\"msg\":\"json数据不正确\",\"resCode\":\"0\"}";
            }
        }
Ejemplo n.º 2
0
        public Dictionary <string, int?> GetCitizenAutoID()
        {
            SM_CitizenServicesBLL bll = new SM_CitizenServicesBLL();

            return(bll.GetCitizenAutoID());
        }