public object AddStdSys()
 {
     try
     {
         string res = HttpContext.Current.Request["json"]; //json.Value<string>("json");
         Submit <StdsysFilesEntity> dy = JsonConvert.DeserializeObject <Submit <StdsysFilesEntity> >(res, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
         {
             DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm':'ss"
         });
         string userid = dy.userId;
         //获取用户基本信息
         OperatorProvider.AppUserId = userid;  //设置当前用户
         Operator curUser = OperatorProvider.Provider.Current();
         if (null == curUser)
         {
             return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
         }
         var entity = dy.data;
         entity.ID = Guid.NewGuid().ToString();
         var stdsysfilesbll = new StdsysFilesBLL();
         if (!stdsysfilesbll.ExistSame(curUser.OrganizeCode, entity.FileName, entity.ID))
         {
             HttpFileCollection files = hcontent.Request.Files; //附件
             UploadifyFile(entity.ID, "", files);               //上传附件
             stdsysfilesbll.SaveForm("", entity);
         }
         else
         {
             return(new { code = -1, count = 0, info = "保存失败,存在同名文件,请校正。", data = new object() });
         }
     }
     catch (Exception ex)
     {
         return(new { code = -1, count = 0, info = "保存失败,错误:" + ex.Message, data = new object() });
     }
     return(new { code = 0, count = 0, info = "保存成功", data = new object() });
 }
Esempio n. 2
0
 public object Edit()
 {
     try
     {
         string res = HttpContext.Current.Request["json"]; //json.Value<string>("json");
         Submit <WorkMeetingEntity> dy = JsonConvert.DeserializeObject <Submit <WorkMeetingEntity> >(res, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
         {
             DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm':'ss"
         });
         string userid = dy.userId;
         //获取用户基本信息
         OperatorProvider.AppUserId = userid;  //设置当前用户
         Operator curUser = OperatorProvider.Provider.Current();
         if (null == curUser)
         {
             return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
         }
         string            roleNames = curUser.RoleName;
         var               data      = dy.data;
         string            recordId  = data.ID;
         WorkMeetingEntity entity    = workMeetingbll.GetEntity(recordId);
         if (entity != null)
         {
             entity.ENGINEERAREA    = data.ENGINEERAREA;
             entity.ENGINEERCODE    = data.ENGINEERCODE;
             entity.ENGINEERCONTENT = data.ENGINEERCONTENT;
             entity.ENGINEERLETDEPT = data.ENGINEERLETDEPT;
             entity.ENGINEERID      = data.ENGINEERID;
             entity.ENGINEERLEVEL   = data.ENGINEERLEVEL;
             entity.ENGINEERNAME    = data.ENGINEERNAME;
             entity.ENGINEERTYPE    = data.ENGINEERTYPE;
             entity.MEETINGDATE     = data.MEETINGDATE;
             entity.MEETINGNAME     = data.MEETINGNAME;
             entity.MEETINGTYPE     = data.MEETINGTYPE;
             entity.ADDRESS         = data.ADDRESS;
             entity.CERTSTA         = data.CERTSTA;
             entity.HEALTHSTA       = data.HEALTHSTA;
             entity.CLOTHESTA       = data.CLOTHESTA;
             entity.SAFEGOODSSTA    = data.SAFEGOODSSTA;
             entity.ENUM            = (int?)data.ENUM;
             entity.GNUM            = (int?)data.GNUM;
             entity.LNUM            = (int?)data.LNUM;
             entity.ONUM            = (int?)data.ONUM;
             entity.ISCOMMIT        = data.ISCOMMIT;
             entity.REMARK          = data.REMARK;
             entity.REALPERNUM      = (int?)data.REALPERNUM;
             entity.SHOUDPERNUM     = (int?)data.SHOUDPERNUM;
             entity.SIGNPERSONS     = data.SIGNPERSONS;
             entity.CONTENT1        = data.CONTENT1;
             entity.CONTENT2        = data.CONTENT2;
             entity.CONTENT3        = data.CONTENT3;
             entity.CONTENTOTHER    = data.CONTENTOTHER;
             //获取删除附件ID
             string deleteFileId = data.DELETEFILEID;
             if (!string.IsNullOrEmpty(deleteFileId))
             {
                 DeleteFile(deleteFileId);
             }
             HttpFileCollection files = ctx.Request.Files; //上传的文件
             UploadifyFile(entity.ID, "sign", files);      //上传签名附件
             UploadifyFile(entity.ID + "c1", "c1", files); //上传录音1
             UploadifyFile(entity.ID + "c2", "c2", files); //上传录音2
             UploadifyFile(entity.ID + "c3", "c3", files); //上传录音3
             workMeetingbll.SaveForm(recordId, entity);
         }
         else
         {
             return(new { code = -1, count = 0, info = "保存失败,记录不存在。", data = new object() });
         }
     }
     catch (Exception ex)
     {
         return(new { code = -1, count = 0, info = "保存失败,错误:" + ex.Message, data = new object() });
     }
     return(new { code = 0, count = 0, info = "保存成功", data = new object() });
 }
Esempio n. 3
0
 public object Add()
 {
     try
     {
         string res = HttpContext.Current.Request["json"]; //json.Value<string>("json");
         Submit <WorkMeetingEntity> dy = JsonConvert.DeserializeObject <Submit <WorkMeetingEntity> >(res, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
         {
             DateTimeFormat = "yyyy'-'MM'-'dd HH':'mm':'ss"
         });
         string userid = dy.userId;
         //获取用户基本信息
         OperatorProvider.AppUserId = userid;  //设置当前用户
         Operator curUser = OperatorProvider.Provider.Current();
         if (null == curUser)
         {
             return(new { code = -1, count = 0, info = "请求失败,请登录!", data = new object() });
         }
         var data = dy.data;
         WorkMeetingEntity entity = new WorkMeetingEntity()
         {
             ID              = Guid.NewGuid().ToString(),
             ENGINEERAREA    = data.ENGINEERAREA,
             ENGINEERCODE    = data.ENGINEERCODE,
             ENGINEERCONTENT = data.ENGINEERCONTENT,
             ENGINEERLETDEPT = data.ENGINEERLETDEPT,
             ENGINEERID      = data.ENGINEERID,
             ISCOMMIT        = data.ISCOMMIT,
             ENGINEERLEVEL   = data.ENGINEERLEVEL,
             ENGINEERNAME    = data.ENGINEERNAME,
             ENGINEERTYPE    = data.ENGINEERTYPE,
             MEETINGDATE     = data.MEETINGDATE,
             MEETINGNAME     = data.MEETINGNAME,
             MEETINGTYPE     = data.MEETINGTYPE,
             ADDRESS         = data.ADDRESS,
             CERTSTA         = data.CERTSTA,
             HEALTHSTA       = data.HEALTHSTA,
             CLOTHESTA       = data.CLOTHESTA,
             SAFEGOODSSTA    = data.SAFEGOODSSTA,
             ENUM            = (int?)data.ENUM,
             GNUM            = (int?)data.GNUM,
             LNUM            = (int?)data.LNUM,
             JNUM            = (int?)data.JNUM,
             ONUM            = (int?)data.ONUM,
             REMARK          = data.REMARK,
             REALPERNUM      = (int?)data.REALPERNUM,
             SHOUDPERNUM     = (int?)data.SHOUDPERNUM,
             SIGNPERSONS     = data.SIGNPERSONS,
             CONTENT1        = data.CONTENT1,
             CONTENT2        = data.CONTENT2,
             CONTENT3        = data.CONTENT3,
             CONTENTOTHER    = data.CONTENTOTHER
         };
         HttpFileCollection files = ctx.Request.Files; //上传的文件
         UploadifyFile(entity.ID, "sign", files);      //上传签名附件
         UploadifyFile(entity.ID + "c1", "c1", files); //上传录音1
         UploadifyFile(entity.ID + "c2", "c2", files); //上传录音2
         UploadifyFile(entity.ID + "c3", "c3", files); //上传录音3
         workMeetingbll.SaveForm("", entity);
     }
     catch (Exception ex)
     {
         return(new { code = -1, count = 0, info = "保存失败,错误:" + ex.Message, data = new object() });
     }
     return(new { code = 0, count = 0, info = "保存成功", data = new object() });
 }