Ejemplo n.º 1
0
		private void attach_Report(Report entity)
		{
			this.SendPropertyChanging();
			entity.Employee = this;
		}
Ejemplo n.º 2
0
		private void detach_Report(Report entity)
		{
			this.SendPropertyChanging();
			entity.Employee = null;
		}
Ejemplo n.º 3
0
 partial void DeleteReport(Report instance);
Ejemplo n.º 4
0
 partial void UpdateReport(Report instance);
Ejemplo n.º 5
0
 partial void InsertReport(Report instance);
Ejemplo n.º 6
0
 /// <summary>
 /// 新建报告
 /// </summary>
 /// <param name="report">报告</param>
 public void Add(Report report)
 {
     context.Report.InsertOnSubmit(report);
 }
        /// <summary>
        /// 模具测试
        /// </summary>
        /// <param name="moldNR">模具号</param>
        /// <param name="operatorNR">操作员工号</param>
        /// <param name="files">文件列表</param>
        /// <returns>测试信息</returns>
        public Message MoldTest(string moldNR, string operatorNR, FileUP[] files,int currentCutTimes,bool moldNormal)
        {
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    using (IUnitOfWork unitwork = MSSqlHelper.DataContext())
                    {
                        IReportRepository reportRep = new ReportRepository(unitwork);

                        Report report = new Report();
                        report.ReportId = GuidUtil.GenerateGUID();
                        report.MoldID = moldNR;
                        report.ReportType = ReportType.TestReport;
                        report.OperatorID = operatorNR;
                        report.Date = DateTime.Now;

                        //upload files
                        FileUpLoad(files, report.ReportId.ToString());

                        reportRep.Add(report);

                        // update the last released date
                        IMoldRepository moldRep = new MoldRepository(unitwork);
                        Mold mold = moldRep.GetById(moldNR);
                        mold.LastReleasedDate = report.Date;
                        mold.Cuttedtimes += mold.CurrentCuttimes;
                        mold.CurrentCuttimes = 0;
                        if (moldNormal)
                            mold.State = MoldStateType.Normal;
                        unitwork.Submit();

                        ts.Complete();

                        return new Message() { MsgType = MsgType.OK, Content = "实验报告上传成功!" };
                    }
                }
            }
            catch (Exception ex)
            {
                  LogUtil.log.Error(ex.ToString());
                return new Message() { MsgType = MsgType.Error, Content = ex.Message };
            }
        }