示例#1
0
        private void CheckAvailableQuantity(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            if (!isEdit)
            {
                if (CheckDuplicate())
                {
                    DataRow row = this.gridView1.GetDataRow(gridView1.FocusedRowHandle);

                    if (row["strItemCode"].ToString().Length > 0 && row["strItemCode"].ToString() != "Select Product")
                    {
                        string strProductCode  = row["strItemCode"].ToString();
                        int    quantityRequest = Convert.ToInt32(row["nQuantity"].ToString());

                        ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();
                        if (!stockRequest.GetAvailableQuantity(strProductCode, this.lkBranchTo.EditValue.ToString(), quantityRequest))
                        {
                            UI.ShowErrorMessage(this, "Quantity request exceeded Balance", "Error");
                            this.canSave       = false;
                            this.canAdd        = false;
                            inValidQuantityRow = gridView1.FocusedRowHandle;
                        }
                        else
                        {
                            this.canSave = true;
                            this.canAdd  = true;
                            return;
                        }
                    }
                }
            }
            this.canSave = false;
        }
        private void CheckAvailableQuantity(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            if (!isEdit)
            {
                DataRow row = this.gridView1.GetDataRow(gridView1.FocusedRowHandle);

                if (row["strItemCode"] != null)
                {
                    if (row["strItemCode"].ToString() != "Select Product")
                    {
                        string strProductCode  = row["strItemCode"].ToString();
                        int    quantityRequest = Convert.ToInt32(row["nQuantity"].ToString());


                        ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();
                        if (!stockRequest.GetAvailableQuantity(strProductCode, this.terminalUser.Branch.Id, quantityRequest))
                        {
                            UI.ShowErrorMessage(this, "Invalid Operation. Please change valid product quantity", "Error");
                            this.canSave       = false;
                            this.canAdd        = false;
                            inValidQuantityRow = gridView1.FocusedRowHandle;
                        }
                        else
                        {
                            this.canSave = true;
                            this.canAdd  = true;
                        }
                    }
                    else
                    {
                        this.canSave = false;
                    }
                }
                else
                {
                    this.canSave = false;
                }
            }
        }
示例#3
0
        private void CheckAvailableQuantity(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            if(!isEdit)
            {
                if(CheckDuplicate())
                {
                    DataRow row = this.gridView1.GetDataRow(gridView1.FocusedRowHandle);

                    if(row["strItemCode"].ToString().Length>0 && row["strItemCode"].ToString()!="Select Product")
                    {
                            string strProductCode = row["strItemCode"].ToString();
                            int quantityRequest = Convert.ToInt32(row["nQuantity"].ToString());

                            ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();
                            if(!stockRequest.GetAvailableQuantity(strProductCode,this.lkBranchTo.EditValue.ToString(),quantityRequest))
                            {
                                UI.ShowErrorMessage(this,"Quantity request exceeded Balance","Error");
                                this.canSave=false;
                                this.canAdd=false;
                                inValidQuantityRow=gridView1.FocusedRowHandle;
                            }
                            else
                            {
                                this.canSave=true;
                                this.canAdd=true;
                                return;
                            }
                        }
                    }
            }
            this.canSave=false;
        }
        private void CheckAvailableQuantity(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            if(!isEdit)
            {
                DataRow row = this.gridView1.GetDataRow(gridView1.FocusedRowHandle);

                if(row["strItemCode"]!=null)
                {
                    if(row["strItemCode"].ToString()!="Select Product")
                    {
                        string strProductCode = row["strItemCode"].ToString();
                        int quantityRequest = Convert.ToInt32(row["nQuantity"].ToString());

                        ACMSLogic.StockRequest.StockRequest stockRequest = new ACMSLogic.StockRequest.StockRequest();
                        if(!stockRequest.GetAvailableQuantity(strProductCode,this.terminalUser.Branch.Id,quantityRequest))
                        {
                            UI.ShowErrorMessage(this,"Invalid Operation. Please change valid product quantity","Error");
                            this.canSave=false;
                            this.canAdd=false;
                            inValidQuantityRow=gridView1.FocusedRowHandle;
                        }
                        else
                        {
                            this.canSave=true;
                            this.canAdd=true;
                        }
                    }
                    else
                    {
                        this.canSave=false;
                    }
                }
                else
                {
                    this.canSave=false;
                }
            }
        }