コード例 #1
0
        public Status AddEnvironment(TTransportationEnvironmentInfo info)
        {
            EFHelper <TTransportationEnvironmentInfo> eFHelper = new EFHelper <TTransportationEnvironmentInfo>();
            int result = eFHelper.Add(info);

            return(result > 0 ? new Status(true): new Status(false));
        }
コード例 #2
0
 public NewErrorModel Save([FromBody] List <Maintain> goDownList)
 {
     try
     {
         EFHelper <Maintain> eFHelper = new EFHelper <Maintain>();
         foreach (var goDown in goDownList)
         {
             eFHelper.Add(goDown);
         }
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         return(new NewErrorModel()
         {
             error = new Error(1, ex.Message, "")
             {
             },
         });
     }
 }
コード例 #3
0
        public object Save([FromBody] NewsAndCases newsAndCases)
        {
            try
            {
                EFHelper <NewsAndCases> eFHelper = new EFHelper <NewsAndCases>();
                newsAndCases.CreateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                eFHelper.Add(newsAndCases);
                return(new NewErrorModel()
                {
                    error = new Error(0, "保存成功!", "")
                    {
                    },
                });
            }
            catch (Exception ex)
            {
                return(new NewErrorModel()
                {
                    error = new Error(1, ex.Message, "")
                    {
                    },
                });
            }
        }
コード例 #4
0
        public NewErrorModel Save(DrawingChangeTable drawingChangeTable)
        {
            try
            {
                EFHelper <DrawingChange> eFHelper = new EFHelper <DrawingChange>();
                foreach (var item in drawingChangeTable.DrawingChangeList)
                {
                    eFHelper.Add(item);
                }

                EFHelper <FileChange> eFHelpers = new EFHelper <FileChange>();
                eFHelpers.Add(drawingChangeTable.fileChange);

                return(new NewErrorModel()
                {
                    data = "",
                    error = new Error(0, "保存成功!", "")
                    {
                    },
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
        public Status AddStaff(string staffname, string tel, string companyname, List <IFormFile> files)
        {
            List <string>          filenames      = new List <string>();
            string                 resultfilename = string.Empty;
            bool                   flag;
            TTransportCompanyStaff staff = new TTransportCompanyStaff()
            {
                StaffName            = staffname,
                Telephone            = tel,
                TransPortCompanyName = companyname
            };

            if (staff.StaffName != "")
            {
                flag = UpLoadFile.FileSave(files, staff.StaffName, out filenames);
            }
            else
            {
                flag = UpLoadFile.FileSave(files, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), out filenames);
            }
            filenames.Sort();
            resultfilename = string.Join("", filenames.ToArray());
            staff.Image    = resultfilename;
            EFHelper <TTransportCompanyStaff> eFHelper = new EFHelper <TTransportCompanyStaff>();
            int result = eFHelper.Add(staff);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #6
0
 public object Save(List <PurchaseOrder> purchaseOrderList)
 {
     try
     {
         EFHelper <PurchaseOrder> eFHelper = new EFHelper <PurchaseOrder>();
         foreach (var item in purchaseOrderList)
         {
             eFHelper.Add(item);
         }
         return(new NewErrorModel()
         {
             data = "",
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         return(new NewErrorModel()
         {
             error = new Error(1, ex.Message, "")
             {
             },
         });
     }
 }
コード例 #7
0
        public Status AddProductionBaseInfo(string proname, string category, string responsiblename, string tel, List <IFormFile> file)
        {
            this._logger.LogWarning("The server execute AddProductionBaseInfo   --" + DateTime.Now.ToString());
            TProductionBaseInfo productionBaseInfo = new TProductionBaseInfo()
            {
                Name            = proname,
                Category        = category,
                ResponsibleName = responsiblename,
                Telephone       = tel
            };
            List <string> filenames      = new List <string>();
            string        resultfilename = string.Empty;

            if (productionBaseInfo.Name != "")
            {
                UpLoadFile.FileSave(file, productionBaseInfo.Name, out filenames);
            }
            else
            {
                UpLoadFile.FileSave(file, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), out filenames);
            }
            filenames.Sort();
            resultfilename           = string.Join("", filenames.ToArray());
            productionBaseInfo.Image = resultfilename;
            EFHelper <TProductionBaseInfo> eFHelper = new EFHelper <TProductionBaseInfo>();
            int result = eFHelper.Add(productionBaseInfo);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #8
0
        public async Task <object> Save([FromBody] ErrorLogs ErrorLog)
        {
            try
            {
                EFHelper <ErrorLogs> eFHelper = new EFHelper <ErrorLogs>();
                ErrorLog.ApplyTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                eFHelper.Add(ErrorLog);
                //钉钉推送超管

                string[] SaIds = System.Configuration.ConfigurationManager.AppSettings["administrator"].Split(',');
                DingTalkServersController dingTalkServersController = new DingTalkServersController();

                foreach (var SaId in SaIds)
                {
                    await dingTalkServersController.sendOaMessage(SaId, "报错反馈", "系统报错", "eapp://util/errorPage/errorPage");
                }

                return(new NewErrorModel()
                {
                    error = new Error(0, "保存成功!", "")
                    {
                    },
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        public Status AddStaff(string staffname, string tel, string productionbasename, string level, List <IFormFile> file)
        {
            this._logger.LogWarning("The server excute AddStaff   --" + DateTime.Now.ToString());
            TProductionBaseStaff productionBaseStaff = new TProductionBaseStaff()
            {
                StaffName          = staffname,
                Telephone          = tel,
                ProductionBaseName = productionbasename,
                Position           = level
            };
            List <string> filenames      = new List <string>();
            string        resultfilename = string.Empty;

            if (productionBaseStaff.StaffName != "")
            {
                UpLoadFile.FileSave(file, productionBaseStaff.StaffName, out filenames);
            }
            else
            {
                UpLoadFile.FileSave(file, DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"), out filenames);
            }
            filenames.Sort();
            resultfilename            = string.Join("", filenames.ToArray());
            productionBaseStaff.Image = resultfilename;
            EFHelper <TProductionBaseStaff> eFHelper = new EFHelper <TProductionBaseStaff>();
            int result = eFHelper.Add(productionBaseStaff);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #10
0
ファイル: PickController.cs プロジェクト: yanjiuyuan/huaShu
 public object Save([FromBody] List <Pick> pickList)
 {
     try
     {
         EFHelper <Pick> eFHelper = new EFHelper <Pick>();
         foreach (var pick in pickList)
         {
             eFHelper.Add(pick);
         }
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         return(new NewErrorModel()
         {
             error = new Error(1, ex.Message, "")
             {
             },
         });
     }
 }
コード例 #11
0
        public Status AddWaterQuality(double ph, string comprehensiveevaluation, string remark, List <IFormFile> files)
        {
            this._logger.LogWarning("The server execute AddWaterQuality   --" + DateTime.Now.ToString());
            List <string>     filenames      = new List <string>();
            string            resultfilename = string.Empty;
            bool              flag;
            TWaterQualityInfo waterQualityInfo = new TWaterQualityInfo()
            {
                DateOfSampling          = DateTime.Now,
                Ph                      = ph,
                ComprehensiveEvaluation = comprehensiveevaluation,
                Remark                  = remark
            };

            flag = UpLoadFile.FileSave(files, DateTime.Now.ToString("yyyy-MM-dd"), out filenames);
            if (flag)
            {
                filenames.Sort();
                resultfilename         = string.Join("", filenames.ToArray());
                waterQualityInfo.Image = resultfilename;
                EFHelper <TWaterQualityInfo> eFHelper = new EFHelper <TWaterQualityInfo>();
                int result = eFHelper.Add(waterQualityInfo);
                return(result > 0 ? new Status(true) : new Status(false));
            }
            else
            {
                return(new Status(false));
            }
        }
コード例 #12
0
        public Status AddCompanyInfo(TTransportationCompanyInfo transportationCompanyInfo)
        {
            this._logger.LogWarning("The server excute AddCompanyInfo  --" + DateTime.Now.ToString());
            EFHelper <TTransportationCompanyInfo> eFHelper = new EFHelper <TTransportationCompanyInfo>();
            int result = eFHelper.Add(transportationCompanyInfo);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #13
0
        public Status AddWareHouseInfo(TWarehouseInfo warehouseInfo)
        {
            this._logger.LogWarning("The server execute AddWareHouseInfo   --" + DateTime.Now.ToString());
            EFHelper <TWarehouseInfo> eFHelper = new EFHelper <TWarehouseInfo>();
            int result = eFHelper.Add(warehouseInfo);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #14
0
        public Status AddPlantInfo(TPlantInfo plantInfo)
        {
            this._logger.LogWarning("The server execute AddPlantInfo   --" + DateTime.Now.ToString());
            plantInfo.PlantTime = DateTime.Now;
            EFHelper <TPlantInfo> eFHelper = new EFHelper <TPlantInfo>();
            int result = eFHelper.Add(plantInfo);

            return(result > 0 ? new Status(true) : new Status(false));
        }
コード例 #15
0
ファイル: UnitTest1.cs プロジェクト: Cloudyang/Homework10
        public void TestAdd()
        {
            var company2 = new Company()
            {
                Name       = "测试增加22",
                CreateTime = DateTime.Now,
                CreatorId  = 2
            };
            var iResult = _EFHelper.Add(company2);

            Assert.AreEqual(iResult, 1);
        }
コード例 #16
0
 public NewErrorModel Add(Contract contract)
 {
     try
     {
         using (DDContext context = new DDContext())
         {
             if (context.Roles.Where(r => r.RoleName == "合同管理员" && r.UserId == contract.ApplyManId).ToList().Count > 0)
             {
                 EFHelper <Contract> eFHelper = new EFHelper <Contract>();
                 if (eFHelper.Add(contract) == 1)
                 {
                     return(new NewErrorModel()
                     {
                         error = new Error(0, "保存成功!", "")
                         {
                         },
                     });
                 }
                 else
                 {
                     return(new NewErrorModel()
                     {
                         error = new Error(1, "保存失败!", "")
                         {
                         },
                     });
                 }
             }
             else
             {
                 return(new NewErrorModel()
                 {
                     error = new Error(1, "用户没有权限!", "")
                     {
                     },
                 });
             }
         }
     }
     catch (Exception ex)
     {
         return(new NewErrorModel()
         {
             error = new Error(2, ex.Message, "")
             {
             },
         });
     }
 }
コード例 #17
0
 /// <summary>
 /// 新增合同
 /// </summary>
 /// <param name="contract"></param>
 /// <returns></returns>
 public object Add(Contract contract)
 {
     try
     {
         EFHelper <Contract> eFHelper = new EFHelper <Contract>();
         if (eFHelper.Add(contract) == 1)
         {
         }
         return("");
     }
     catch (Exception)
     {
         throw;
     }
 }
コード例 #18
0
        /// <summary>
        /// 发布通知接口
        /// </summary>
        /// <param name="VisitorID">游客ID,如果Admin代表管理员</param>
        /// <param name="NoticeType"></param>
        /// <param name="OccurTime"></param>
        /// <param name="OccurAddress"></param>
        /// <param name="NoticeDetail"></param>
        /// <returns></returns>
        public Stream PublishNotice(string VisitorID, int NoticeType, string OccurTime, string OccurAddress, string NoticeDetail)
        {
            if (VisitorID != "Admin" && NoticeType == 2)//合法性检查
            {
                return(ResponseHelper.Failure("只有管理员可以发布活动通知!"));
            }

            string id     = IDHelper.getNextNoticeID(DateTime.Now);
            Notice notice = new Notice()
            {
                NoticeID     = id,
                VisitorID    = VisitorID,
                NoticeType   = NoticeType,
                NoticeTime   = DateTime.Now,
                OccurTime    = OccurTime,
                OccurAddress = OccurAddress,
                NoticeDetail = NoticeDetail,
                NoticeStatus = 0,
                Remarks      = "",
                CheckTime    = null
            };

            if (VisitorID == "Admin")
            {
                notice.NoticeStatus = 1;
                notice.CheckTime    = DateTime.Now;
            }


            try
            {
                EFHelper.Add <Notice>(notice);  //通知信息提交数据库
                return(ResponseHelper.Success(new List <string>()
                {
                    "发布成功,等待审核!"
                }));
            }
            catch (Exception ex)
            {
                while (ex.InnerException != null)
                {
                    ex = ex.InnerException;
                }
                return(ResponseHelper.Failure(ex.Message));
            }
        }
コード例 #19
0
 public NewErrorModel Save([FromBody] MaterialRelease evection)
 {
     try
     {
         EFHelper <MaterialRelease> eFHelper = new EFHelper <MaterialRelease>();
         eFHelper.Add(evection);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #20
0
 public object Save([FromBody] Cooperate cooperate)
 {
     try
     {
         EFHelper <Cooperate> eFHelper = new EFHelper <Cooperate>();
         eFHelper.Add(cooperate);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #21
0
 public object Save([FromBody] CreateProject createProject)
 {
     try
     {
         EFHelper <CreateProject> eFHelper = new EFHelper <CreateProject>();
         eFHelper.Add(createProject);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #22
0
 public NewErrorModel Save([FromBody] IntellectualProperty evection)
 {
     try
     {
         EFHelper <IntellectualProperty> eFHelper = new EFHelper <IntellectualProperty>();
         eFHelper.Add(evection);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #23
0
 public object Save([FromBody] Jobs jobs)
 {
     try
     {
         EFHelper <Jobs> eFHelper = new EFHelper <Jobs>();
         eFHelper.Add(jobs);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #24
0
 public object Save([FromBody] PicInfo picInfo)
 {
     try
     {
         EFHelper <PicInfo> eFHelper = new EFHelper <PicInfo>();
         picInfo.CreateTime = DateTime.Now.ToString("yyyy-dd-MM HH:hh:ss");
         eFHelper.Add(picInfo);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #25
0
 public object SaveTable([FromBody] Receiving ReceivingList)
 {
     try
     {
         EFHelper <Receiving> eFHelper = new EFHelper <Receiving>();
         ReceivingList.ReceivingNo = DateTime.Now.ToString("yyyyMMddHHmmss");
         eFHelper.Add(ReceivingList);
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #26
0
 public object Save([FromBody] List <GoDown> goDownList)
 {
     try
     {
         EFHelper <GoDown> eFHelper = new EFHelper <GoDown>();
         foreach (var goDown in goDownList)
         {
             eFHelper.Add(goDown);
         }
         return(new NewErrorModel()
         {
             error = new Error(0, "保存成功!", "")
             {
             },
         });
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #27
0
 public Stream AddLocator(Locator locator)
 {
     try
     {
         if (EFHelper.Add(locator))
         {
             return(ResponseHelper.Success(null));
         }
         else
         {
             return(ResponseHelper.Failure("添加失败!"));
         }
     }
     catch (Exception ex)
     {
         while (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         return(ResponseHelper.Failure(ex.Message));
     }
 }
コード例 #28
0
 public Stream AddChargeProject(ChargeProject chargeProject)
 {
     try
     {
         if (EFHelper.Add(chargeProject))
         {
             return(ResponseHelper.Success(null));
         }
         else
         {
             return(ResponseHelper.Failure("添加失败!"));
         }
     }
     catch (Exception ex)
     {
         while (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         return(ResponseHelper.Failure(ex.Message));
     }
 }
コード例 #29
0
 public Stream AddCommodity(Commodity commodity)
 {
     try
     {
         if (EFHelper.Add(commodity))
         {
             return(ResponseHelper.Success(null));
         }
         else
         {
             return(ResponseHelper.Failure("添加失败!"));
         }
     }
     catch (Exception ex)
     {
         while (ex.InnerException != null)
         {
             ex = ex.InnerException;
         }
         return(ResponseHelper.Failure(ex.Message));
     }
 }
コード例 #30
0
        public NewErrorModel Save(TechnicalSupport technicalSupport)
        {
            try
            {
                EFHelper <TechnicalSupport> eFHelper = new EFHelper <TechnicalSupport>();
                technicalSupport.CompanyName  = "泉州华中科技大学智能制造研究院";
                technicalSupport.ProjectState = "在研";
                eFHelper.Add(technicalSupport);

                return(new NewErrorModel()
                {
                    data = "",
                    error = new Error(0, "保存成功!", "")
                    {
                    },
                });
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }