Пример #1
0
        private void barPronoteHeader_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(null, 0);
            if (pronoForm.ShowDialog(this) == DialogResult.OK)
            {
                Model.PronoteHeader currentModel = pronoForm.SelectItem;
                if (currentModel != null)
                {
                    this.txt_PronoteHeaderId.Text = currentModel.PronoteHeaderID;
                    //this.nccCustomer.EditValue = currentModel.InvoiceXO.Customer;
                    Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(currentModel.InvoiceXOId);
                    if (xo != null)
                    {
                        this.nccCustomer.EditValue = xo.Customer;
                        this.txt_InvoiceCusId.Text = xo.CustomerInvoiceXOId;
                    }
                    //this.txt_Model.Text = (currentModel.Product) == null ? "" : (currentModel.Product).CustomerProductName;
                    Model.Product p = new BL.ProductManager().Get(currentModel.ProductId);
                    if (p != null)
                    {
                        this.txt_Model.Text = p.CustomerProductName;
                    }

                    Model.PCSamplingEarDetail detail = new Book.Model.PCSamplingEarDetail();
                    detail.PCSamplingEarDetailId   = Guid.NewGuid().ToString();
                    detail.PCSamplingEarDetailDate = DateTime.Now;
                    detail.PCSamplingEarId         = this._PCSamplingEar.PCSamplingEarId;
                    detail.Product   = p;
                    detail.ProductId = currentModel.ProductId;
                    this._PCSamplingEar.Details.Add(detail);
                    this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);

                    this.gridControl1.RefreshDataSource();
                }
            }
            pronoForm.Dispose();
            GC.Collect();
        }
Пример #2
0
        private void barPronoteHeader_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm pronoForm = new Book.UI.produceManager.PronoteHeader.ChoosePronoteHeaderDetailsForm(null, 0);
            if (pronoForm.ShowDialog(this) == DialogResult.OK)
            {
                if (pronoForm.SelectItems == null || pronoForm.SelectItems.Count == 0)
                {
                    Model.PronoteHeader currentModel = pronoForm.SelectItem;
                    if (currentModel != null)
                    {
                        this.txt_PronoteHeaderId.Text            = currentModel.PronoteHeaderID;
                        this._pCAssemblyInspection.PronoteHeader = currentModel;
                        Model.InvoiceXO xo = new BL.InvoiceXOManager().Get(currentModel.InvoiceXOId);
                        if (xo != null)
                        {
                            currentModel.InvoiceXO     = xo;
                            this.txt_InvoiceCusId.Text = xo.CustomerInvoiceXOId;
                        }
                        //this.txt_Model.Text = (currentModel.Product) == null ? "" : (currentModel.Product).CustomerProductName;
                        Model.Product p = new BL.ProductManager().Get(currentModel.ProductId);
                        Model.PCAssemblyInspectionDetail detail = new Book.Model.PCAssemblyInspectionDetail();
                        detail.PCAssemblyInspectionDetailId   = Guid.NewGuid().ToString();
                        detail.PCAssemblyInspectionDetailDate = DateTime.Now;
                        detail.PCAssemblyInspectionId         = this._pCAssemblyInspection.PCAssemblyInspectionId;
                        detail.Product    = p;
                        detail.ProductId  = currentModel.ProductId;
                        detail.CustomerId = xo == null ? null : xo.CustomerId;

                        if (p.IsQiangHua == true)
                        {
                            detail.Jiagongbie = "強化";
                        }
                        else if (p.IsFangWu == true)
                        {
                            detail.Jiagongbie = "防霧";
                        }
                        else if (p.IsNoQiangFang == true)
                        {
                            detail.Jiagongbie = "無強化防霧";
                        }

                        this._pCAssemblyInspection.Details.Add(detail);
                        this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                    }
                }
                else
                {
                    foreach (var item in pronoForm.SelectItems)
                    {
                        Model.Product p = new BL.ProductManager().Get(item.ProductId);
                        Model.PCAssemblyInspectionDetail detail = new Book.Model.PCAssemblyInspectionDetail();
                        detail.PCAssemblyInspectionDetailId   = Guid.NewGuid().ToString();
                        detail.PCAssemblyInspectionDetailDate = DateTime.Now;
                        detail.PCAssemblyInspectionId         = this._pCAssemblyInspection.PCAssemblyInspectionId;
                        detail.Product   = p;
                        detail.ProductId = item.ProductId;
                        //detail.CustomerId = xo == null ? null : xo.CustomerId;

                        if (p.IsQiangHua == true)
                        {
                            detail.Jiagongbie = "強化";
                        }
                        else if (p.IsFangWu == true)
                        {
                            detail.Jiagongbie = "防霧";
                        }
                        else if (p.IsNoQiangFang == true)
                        {
                            detail.Jiagongbie = "無強化防霧";
                        }

                        this._pCAssemblyInspection.Details.Add(detail);
                        this.bindingSourceDetail.Position = this.bindingSourceDetail.IndexOf(detail);
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
            pronoForm.Dispose();
            GC.Collect();
        }