Esempio n. 1
0
 public PipeQualityCertification(string key, DeliverNotice deliverNotice, DateTime dateCreated)
     : base(key)
 {
     this.Code = string.Empty;
     this.DateCreated = dateCreated;
     this.DeliverNotice = deliverNotice;
 }
Esempio n. 2
0
        public BusinessCheckNotice(int key, DeliverNotice deliverNotice, Account creator, DateTime dateCreated, Account keeper,
            DateTime firstReciveDate, DateTime lastReceiveDate, int reciveCount)
            : base(key)
        {
            if (deliverNotice == null)
            {
                throw new ArgumentNullException("deliverNotice");
            }

            this.DeliverNotice = deliverNotice;
            this.PipeType = this.DeliverNotice.PipeType;
            this.DetectionCompany = this.DeliverNotice.Company;
            this.Creator = creator;
            this.DateCreated = dateCreated;
            this.Keeper = keeper;
            this.FirstReciveDate = firstReciveDate;
            this.LastReciveDate = lastReceiveDate;
            this.ReceiveCount = reciveCount;
        }
        public JsonResult Create()
        {
            JavaScriptSerializer serialize = new JavaScriptSerializer();
            PDCPMS.DataContracts.Income.DeliverNotice noticeContract =
                serialize.Deserialize<PDCPMS.DataContracts.Income.DeliverNotice>(Request.Form["notice"]);

            string CompanyId = null;
            string ProducerId = null;
            if (!string.IsNullOrEmpty(Request.Form["CompanyId"]))
            {
                CompanyId = Request.Form["CompanyId"].ToString();
            }
            if (!string.IsNullOrEmpty(Request.Form["ProducerId"]))
            {
                ProducerId = Request.Form["ProducerId"].ToString();
            }

            if (noticeContract == null)
            {
                return Json(new { success = false, message = "输入有误" });
            }
            bool isDataValid = true;
            DeliverNotice notice = new DeliverNotice(0,
                RepositoryFactory.GetRepository<IDetectionCompanyRepository, DetectionCompany>().FindBy(CompanyId),
                UserSession.OnlineAccount,
                RepositoryFactory.GetRepository<IPipeTypeRepository, PipeType>().FindBy(noticeContract.PipeTypeId),
                DateTime.Now);
            notice.CompanyContract = noticeContract.CompanyContract;
            notice.DateDelivering = noticeContract.DateDelivering;
            notice.DeliverMethod = (DeliverMethod)noticeContract.DeliverMethod;
            notice.Fax = noticeContract.Fax;
            notice.Producer = RepositoryFactory.GetRepository<IProducerRepository, Producer>().FindBy(ProducerId);
            notice.ProductContractNO = noticeContract.ProductContractNO;
            notice.Sender = noticeContract.Sender;
            notice.Sign = noticeContract.Sign;
            notice.State = DeliverNoticeState.NotVerified;
            notice.Supplier = RepositoryFactory.GetRepository<ISupplierRepository, Supplier>().FindBy(noticeContract.SupplierId);
            notice.Telephone = noticeContract.Telephone;

            if (notice.GetBrokenRules().Count != 0)
            {
                return Json(new { success = false, message = "输入有误" });
            }
            else
            {
                repository.Add(notice);
            }

            foreach (PDCPMS.DataContracts.Income.DeliverWaggon w in noticeContract.Waggons)
            {
                DeliverWaggon waggon = new DeliverWaggon(0, notice);
                waggon.EstimatedNO = w.EstimatedNO;
                waggon.NumberPlate = w.NumberPlate;

                if (waggon.GetBrokenRules().Count != 0)
                {
                    isDataValid = false;
                    break;
                }

                notice.Waggons.Add(waggon);
            }

            if (isDataValid)
            {
                unitOfWork.Commit();
                TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = "成功添加来料通知单" };
            }
            else
            {
                return Json(new { success = false, message = "输入有误" });
            }

            return Json(new { success = true });
        }
Esempio n. 4
0
        public static Boolean CanEdit(DeliverNotice notice, string currentUserName)
        {
            if (notice == null) throw new ArgumentNullException("notice");

            // 只能由创建者修改
            if (notice.Creator.LoginName == currentUserName && notice.State == DeliverNoticeState.NotVerified)
            {
                return true;
            }
            return false;
        }
Esempio n. 5
0
        public static Boolean CanEdit(DeliverNotice notice)
        {
            if (notice == null) throw new ArgumentNullException("notice");

            // 只能由创建者修改
            if (notice.State == DeliverNoticeState.NotVerified)
            {
                return true;
            }
            return false;
        }
Esempio n. 6
0
        public void CopyTo(DeliverNotice notice)
        {
            if (notice == null) throw new ArgumentNullException("notice");

            notice.CompanyContract = this.CompanyContract;
            notice.DeliverMethod = this.DeliverMethod;
            notice.Fax = this.Fax;
            notice.Owner = this.Owner;
            notice.PipeType = this.PipeType;
            notice.Producer = this.Producer;
            notice.ProductContractNO = this.ProductContractNO;
            notice.Sender = this.Sender;
            notice.Sign = this.Sign;
            notice.Supplier = this.Supplier;
            notice.Telephone = this.Telephone;
            notice.Verifier = this.Verifier;
            notice.VerifyComment = this.VerifyComment;
            notice.State = this.State;
            notice.VerifyTime = this.VerifyTime;
        }
Esempio n. 7
0
 public Pipe(long key, PipeType type, PipeCategory category, DetectionCompany company, PipeOwner owner, Producer producer,
     Supplier supplier, DeliverNotice notice, DeliverWaggon waggon)
     : base(key)
 {
     this.PipeType = type;
     this.Category = category;
     this.DetectionCompany = company;
     this.Owner = owner;
     this.Producer = producer;
     this.Supplier = supplier;
     this.DeliverNotice = notice;
     this.DeliverWaggon = waggon;
 }
Esempio n. 8
0
 public DeliverWaggon(long key, DeliverNotice notice)
     : base(key)
 {
     this.DeliverNotice = notice;
     this.DeliverMethod = notice.DeliverMethod;
 }