Example #1
0
 /// <summary>
 /// 带一个参构造函数
 /// </summary>
 public EditForm(Model.ProduceTransfer produceTransfer)
     : this()
 {
     this.produceTransfer         = produceTransfer;
     this.produceTransfer.Details = this.produceTransferDetailManager.Select(produceTransfer);
     this.action = "update";
 }
Example #2
0
 /// <summary>
 /// 带两个参构造函数
 /// </summary>
 public EditForm(Model.ProduceTransfer produceTransfer, string action)
     : this()
 {
     this.produceTransfer         = produceTransfer;
     this.produceTransfer.Details = this.produceTransferDetailManager.Select(produceTransfer);
     this.action = action;
 }
Example #3
0
 //尾笔
 protected override void MoveLast()
 {
     // if (produceTransfer == null)
     {
         this.produceTransfer = this.produceTransferManager.Get(this.produceTransferManager.GetLast() == null ? "" : this.produceTransferManager.GetLast().ProduceTransferId);
     }
 }
 public void Delete(Model.ProduceTransfer produceTransfer)
 {
     //
     // todo:add other logic here
     //
     accessor.Delete(produceTransfer.ProduceTransferId);
 }
Example #5
0
        public override void Refresh()
        {
            if (this.produceTransfer == null)
            {
                this.produceTransfer = new Book.Model.ProduceTransfer();
                this.action          = "insert";
            }
            else
            {
                if (this.action == "view")
                {
                    this.produceTransfer = this.produceTransferManager.GetDetails(produceTransfer.ProduceTransferId);
                }
            }

            this.textEditProduceTransferId.Text = this.produceTransfer.ProduceTransferId;
            this.memoEditdescription.Text       = this.produceTransfer.description;
            //this.newChooseContorlWorkHouseInId.EditValue = this.produceTransfer.WorkHouseIn;
            this.newChooseContorlWorkHouseOutId.EditValue = this.produceTransfer.WorkHouseOut;
            if (global::Helper.DateTimeParse.DateTimeEquls(this.produceTransfer.ProduceTransferDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditProduceTransferDate.EditValue = null;
            }
            else
            {
                this.dateEditProduceTransferDate.EditValue = this.produceTransfer.ProduceTransferDate;
            }
            this.newChooseContorlEmployee0Id.EditValue = this.produceTransfer.Employee0;
            this.newChooseContorlEmployee1Id.EditValue = this.produceTransfer.Employee1;
            this.newChooseContorlEmployee2Id.EditValue = this.produceTransfer.Employee2;
            this.bindingSourceDetails.DataSource       = this.produceTransfer.Details;

            base.Refresh();
        }
Example #6
0
 //上一笔
 protected override void MovePrev()
 {
     Model.ProduceTransfer produceTransfer = this.produceTransferManager.GetPrev(this.produceTransfer);
     if (produceTransfer == null)
     {
         throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
     }
     this.produceTransfer = this.produceTransferManager.Get(produceTransfer.ProduceTransferId);
 }
 /// <summary>
 /// Update a ProduceTransfer.
 /// </summary>
 public void Update(Model.ProduceTransfer produceTransfer)
 {
     //
     // todo: add other logic here.
     //
     Validate(produceTransfer);
     if (produceTransfer != null)
     {
         this.Delete(produceTransfer);
         produceTransfer.UpdateTime = DateTime.Now;
         this.Insert(produceTransfer);
     }
 }
 private void Validate(Model.ProduceTransfer produceTransfer)
 {
     if (string.IsNullOrEmpty(produceTransfer.ProduceTransferId))
     {
         throw new Helper.RequireValueException(Model.ProduceTransfer.PRO_ProduceTransferId);
     }
     if (string.IsNullOrEmpty(produceTransfer.WorkHouseInId))
     {
         throw new Helper.RequireValueException(Model.ProduceTransfer.PRO_WorkHouseInId);
     }
     if (string.IsNullOrEmpty(produceTransfer.WorkHouseOutId))
     {
         throw new Helper.RequireValueException(Model.ProduceTransfer.PRO_WorkHouseOutId);
     }
 }
Example #9
0
        public XR1(Model.ProduceTransfer produceTransfer)
        {
            InitializeComponent();
            this.produceTransfer = produceTransfer;
            if (this.produceTransfer == null)
            {
                return;
            }
            this.produceTransfer.Details = this.produceTransferDetailManager.Select(this.produceTransfer);

            this.DataSource = this.produceTransfer.Details;

            //CompanyInfo
            this.xrLabelCompanyInfoName.Text = BL.Settings.CompanyChineseName;
            this.xrLabelDataName.Text        = Properties.Resources.ProduceTransferReport;
            //aa.WorkHouseIn
            this.xrLabelProduceTransferId.Text   = this.produceTransfer.ProduceTransferId;
            this.xrLabelProduceTransferDate.Text = this.produceTransfer.ProduceTransferDate.Value.ToString("yyyy-MM-dd");
            if (this.produceTransfer.WorkHouseOut != null)
            {
                this.xrLabelOutWorkHorse.Text = this.produceTransfer.WorkHouseOut.Workhousename;
            }
            if (this.produceTransfer.Employee0 != null)
            {
                this.xrLabelErry0.Text = this.produceTransfer.Employee0.EmployeeName;
            }
            if (this.produceTransfer.Employee1 != null)
            {
                this.xrLabelErry1.Text = this.produceTransfer.Employee1.EmployeeName;
            }
            if (this.produceTransfer.Employee2 != null)
            {
                this.xrLabelErry2.Text = this.produceTransfer.Employee2.EmployeeName;
            }
            this.xrLabeldescription.Text = this.produceTransfer.description;

            //Ã÷ϸ
            this.xrTableCellProductId.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_Id);
            this.xrTableCellProductName.DataBindings.Add("Text", this.DataSource, "Product." + Model.Product.PRO_ProductName);
            this.xrTableCellCustomerInvoiceXOId.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_CustomerInvoiceXOId);
            this.xrTableCellProceduresMoQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_ProceduresMoQuantity);
            this.xrTableCellProceduresQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_ProceduresQuantity);
            this.xrTableCellScrapQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_ScrapQuantity);
            this.xrTableCellTransferQuantity.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_TransferQuantity);
            this.xrTableCel1ProductUnit.DataBindings.Add("Text", this.DataSource, Model.ProduceTransferDetail.PRO_ProductUnit);
            this.xrTableCellWorkHouseInId.DataBindings.Add("Text", this.DataSource, "WorkHouseIn." + Model.WorkHouse.PROPERTY_WORKHOUSENAME);
        }
Example #10
0
        protected override void AddNew()
        {
            this.produceTransfer = new Model.ProduceTransfer();
            this.produceTransfer.ProduceTransferId   = this.produceTransferManager.GetId();
            this.produceTransfer.ProduceTransferDate = DateTime.Now;
            this.produceTransfer.Details             = new List <Model.ProduceTransferDetail>();

            if (this.action == "insert")
            {
                Model.ProduceTransferDetail detail = new Model.ProduceTransferDetail();
                detail.ProduceTransferDetailId = Guid.NewGuid().ToString();
                detail.ScrapQuantity           = 0;
                detail.TransferQuantity        = 0;
                detail.Product = new Book.Model.Product();
                this.produceTransfer.Details.Add(detail);
                this.bindingSourceDetails.Position = this.bindingSourceDetails.IndexOf(detail);
            }
        }
        /// <summary>
        /// Insert a ProduceTransfer.
        /// </summary>
        public void Insert(Model.ProduceTransfer produceTransfer)
        {
            //
            // todo:add other logic here
            //
            Validate(produceTransfer);
            try
            {
                produceTransfer.InsertTime = DateTime.Now;

                produceTransfer.UpdateTime = DateTime.Now;
                BL.V.BeginTransaction();
                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, produceTransfer.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, produceTransfer.InsertTime.Value.Year, produceTransfer.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, produceTransfer.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);
                accessor.Insert(produceTransfer);
                foreach (Model.ProduceTransferDetail produceTransferDetail in produceTransfer.Details)
                {
                    if (produceTransferDetail.Product == null || string.IsNullOrEmpty(produceTransferDetail.Product.ProductId))
                    {
                        throw new Exception("貨品不為空");
                    }
                    produceTransferDetail.ProduceTransferId = produceTransfer.ProduceTransferId;
                    //produceMaterialdetails.Materialprocesedsum = produceMaterialdetails.Materialprocessum;
                    ProduceTransferDetailAccessor.Insert(produceTransferDetail);
                }

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
                throw;
            }
        }
 public Model.ProduceTransfer GetNext(Model.ProduceTransfer e)
 {
     return(accessor.GetNext(e));
 }
 public Model.ProduceTransfer GetPrev(Model.ProduceTransfer e)
 {
     return(accessor.GetPrev(e));
 }
 public bool HasRowsAfter(Model.ProduceTransfer e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public bool HasRowsBefore(Model.ProduceTransfer e)
 {
     return(accessor.HasRowsBefore(e));
 }
Example #16
0
 //首笔
 protected override void MoveFirst()
 {
     this.produceTransfer = this.produceTransferManager.Get(this.produceTransferManager.GetFirst() == null ? "" : this.produceTransferManager.GetFirst().ProduceTransferId);
 }
 public Model.ProduceTransfer GetDetails(string produceTransferId)
 {
     Model.ProduceTransfer produceTransfer = accessor.Get(produceTransferId);
     produceTransfer.Details = ProduceTransferDetailAccessor.Select(produceTransfer);
     return(produceTransfer);
 }
Example #18
0
 public IList <Book.Model.ProduceTransferDetail> Select(Model.ProduceTransfer produceTransfer)
 {
     return(accessor.Select(produceTransfer));
 }