Example #1
0
 protected override void MoveFirst()
 {
     this._stockCheck = this.stockCheckManager.Get(this.stockCheckManager.GetFirst() == null ? "" : this.stockCheckManager.GetFirst().StockCheckId);
 }
Example #2
0
        public override void Refresh()
        {
            if (this._stockCheck == null)
            {
                //this._stockCheck = new Book.Model.StockCheck();
                this.action = "insert";
                AddNew();
            }
            else
            {
                if (this.action == "view")
                {
                    this._stockCheck = this.stockCheckManager.GetDetails(_stockCheck.StockCheckId);
                }
            }
            this.textEditId.Text = this._stockCheck.StockCheckId;

            if (global::Helper.DateTimeParse.DateTimeEquls(this._stockCheck.StockCheckDate, global::Helper.DateTimeParse.NullDate))
            {
                this.dateEditDate.EditValue = null;
            }
            else
            {
                this.dateEditDate.EditValue = this._stockCheck.StockCheckDate;
            }

            this.newChooseContorlEmp.EditValue = this._stockCheck.Employee;
            this.memoEditDesc.Text             = this._stockCheck.Directions;

            this.lookUpEditProCate.EditValue = this._stockCheck.ProductCategoryId;

            this.lookUpEditDepot.EditValue = this._stockCheck.DepotId;// this.depotManger.Get(this.lookUpEditDepot.EditValue.ToString());
            //this._stockCheck.DepotId = this._stockCheck.Depot.DepotId;

            this.newChooseContorlAuditEmp.EditValue = this._stockCheck.AuditEmp;
            this.txt_AuditState.EditValue           = this.GetAuditName(this._stockCheck.AuditState);

            this.bindingSource1.DataSource = this._stockCheck.Details;

            switch (this.action)
            {
            case "insert":
                //this.textEdit_stockCheckId.Properties.ReadOnly = false;
                //this.dateEdit_stockCheckDate.Properties.ReadOnly = false;
                //this.dateEdit_stockCheckDate.Properties.Buttons[0].Visible = true;

                //this.barButtonItemGeneral.Enabled = false;

                ////this.textEditAbstract.Properties.ReadOnly = false;
                //this.textEditNote.Properties.ReadOnly = false;

                //this.buttonEditCompany.ShowButton = true;
                //this.buttonEditEmployee.ShowButton = true;

                //this.buttonEditCompany.ButtonReadOnly = false;
                //this.buttonEditEmployee.ButtonReadOnly = false;

                this.gridView1.OptionsBehavior.Editable = true;

                //this.simpleButtonAppend.Enabled = true;
                //this.simpleButtonRemove.Enabled = true;
                break;

            case "update":
                //this.textEdit_stockCheckId.Properties.ReadOnly = true;
                //this.dateEdit_stockCheckDate.Properties.ReadOnly = true;
                //this.dateEdit_stockCheckDate.Properties.Buttons[0].Visible = false;

                //this.barButtonItemGeneral.Enabled = false;

                ////this.textEditAbstract.Properties.ReadOnly = false;
                //this.textEditNote.Properties.ReadOnly = false;

                //this.buttonEditCompany.ShowButton = true;
                //this.buttonEditEmployee.ShowButton = true;

                //this.buttonEditCompany.ButtonReadOnly = false;
                //this.buttonEditEmployee.ButtonReadOnly = false;

                this.gridView1.OptionsBehavior.Editable = true;

                //this.simpleButtonAppend.Enabled = true;
                //this.simpleButtonRemove.Enabled = true;
                break;

            case "view":
                //this.textEdit_stockCheckId.Properties.ReadOnly = true;
                //this.dateEdit_stockCheckDate.Properties.ReadOnly = true;
                //this.dateEdit_stockCheckDate.Properties.Buttons[0].Visible = false;

                //this.barButtonItemGeneral.Enabled = true;

                ////this.textEditAbstract.Properties.ReadOnly = true;
                //this.textEditNote.Properties.ReadOnly = true;

                //this.buttonEditCompany.ShowButton = false;
                //this.buttonEditEmployee.ShowButton = false;

                //this.buttonEditCompany.ButtonReadOnly = true;
                //this.buttonEditEmployee.ButtonReadOnly = true;

                this.gridView1.OptionsBehavior.Editable = false;

                //this.simpleButtonAppend.Enabled = false;
                //this.simpleButtonRemove.Enabled = false;
                break;

            default:
                break;
            }

            base.Refresh();
            this.newChooseContorlEmp.ShowButton     = false;
            this.newChooseContorlEmp.ButtonReadOnly = true;
            this.lookUpEditDepot.Enabled            = false;
            this.lookUpEditProCate.Enabled          = false;
        }
Example #3
0
 public Model.StockCheck GetNext(Model.StockCheck e)
 {
     return(accessor.GetNext(e));
 }
Example #4
0
 public Model.StockCheck GetPrev(Model.StockCheck e)
 {
     return(accessor.GetPrev(e));
 }
Example #5
0
 public bool HasRowsAfter(Model.StockCheck e)
 {
     return(accessor.HasRowsAfter(e));
 }
Example #6
0
 public bool HasRowsBefore(Model.StockCheck e)
 {
     return(accessor.HasRowsBefore(e));
 }
Example #7
0
        public override void Refresh()
        {
            if (_stockCheck == null)
            {
                _stockCheck = new Model.StockCheck();
                _stockCheck.StockCheckId   = this.stockCheckManager.GetNewId();
                _stockCheck.StockCheckDate = DateTime.Now;
                _stockCheck.Details        = new List <Model.StockCheckDetail>();
                _stockCheck.ProductPositionNums.Clear();

                foreach (Model.Product product in this._productManager.GetProduct())
                {
                    Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                    detail.StockCheckDetailId = Guid.NewGuid().ToString();
                    detail.StockCheckId       = _stockCheck.StockCheckId;
                    detail.Product            = product;
                    detail.ProductId          = product.ProductId;
                    detail.DepotPosition      = product.DepotPosition;
                    detail.DepotPositionId    = product.DepotPositionId;
                    detail.Directions         = product.ProductDescription;
                    detail.ProductUnitName    = product.DepotUnit.CnName;
                    _stockCheck.Details.Add(detail);
                    //this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                }
                this.action = "insert";
            }
            else
            {
                if (this.lookUpEditProductCategory.EditValue != null)
                {
                    category = this._productCategoryManager.Get(this.lookUpEditProductCategory.EditValue.ToString());
                    _stockCheck.Details.Clear();
                    foreach (Model.Product product in this._productManager.Select(category))
                    {
                        Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                        detail.StockCheckDetailId = Guid.NewGuid().ToString();
                        detail.StockCheckId       = _stockCheck.StockCheckId;
                        detail.Product            = product;
                        detail.Product.Id         = product.Id;
                        detail.ProductId          = product.ProductId;
                        detail.DepotPosition      = product.DepotPosition;

                        detail.DepotPositionId = product.DepotPositionId;
                        detail.Directions      = product.ProductDescription;
                        object nums = this.stockCheckDetailManager.GetNumsByProductIdAndDepositionId(detail.DepotPositionId, product.ProductId);
                        if (nums != null)
                        {
                            detail.StockCheckQuantity = Convert.ToDouble(nums);
                        }
                        else
                        {
                            detail.StockCheckQuantity = null;
                        }
                        detail.DepotPositionId = product.DepotPositionId;
                        detail.ProductUnitName = product.DepotUnit.CnName;
                        _stockCheck.Details.Add(detail);
                        this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                    }
                }
                else
                {
                    _stockCheck.Details.Clear();
                    foreach (Model.Product product in this._productManager.GetProduct())
                    {
                        Model.StockCheckDetail detail = new Book.Model.StockCheckDetail();
                        detail.StockCheckDetailId = Guid.NewGuid().ToString();
                        detail.StockCheckId       = _stockCheck.StockCheckId;
                        detail.Product            = product;
                        detail.Product.Id         = product.Id;
                        detail.ProductId          = product.ProductId;
                        detail.DepotPosition      = product.DepotPosition;
                        detail.DepotPositionId    = product.DepotPositionId;
                        detail.Directions         = product.ProductDescription;
                        object nums = this.stockCheckDetailManager.GetNumsByProductIdAndDepositionId(detail.DepotPositionId, product.ProductId);
                        if (nums != null)
                        {
                            detail.StockCheckQuantity = Convert.ToDouble(nums);
                        }
                        else
                        {
                            detail.StockCheckQuantity = null;
                        }
                        detail.ProductUnitName = product.DepotUnit.CnName;
                        _stockCheck.Details.Add(detail);
                        this.bindingSourceEmployee.Position = this.bindingSourceEmployee.IndexOf(detail);
                    }
                }
            }
            this.textEditStockCheckId.Text                = _stockCheck.StockCheckId;
            this.textEditStockCheckId.EditValue           = _stockCheck.StockCheckId;
            this.dateEditStockCheckDate.EditValue         = _stockCheck.StockCheckDate;
            this.newChooseEmployee.EditValue              = _stockCheck.Employee;
            this.lookUpEditDepot.EditValue                = _stockCheck.Depot;
            this.textEditNote.EditValue                   = _stockCheck.Directions;
            this.bindingSourceStockCheckDetail.DataSource = _stockCheck.Details;

            this.newChooseContorlAuditEmp.EditValue = _stockCheck.AuditEmp;
            this.txt_AuditState.EditValue           = this.GetAuditName(_stockCheck.AuditState);

            base.Refresh();

            switch (this.action)
            {
            case "insert":
            case "update":
                this.gridControl1.Enabled = true;
                break;

            case "view":
                this.gridControl1.Enabled = false;
                break;
            }
        }