Ejemplo n.º 1
0
        //private void Query_StockAsOn(string whid, string partyid, string product)
        //{
        //    try
        //    {
        //        base.ExecutionStart();
        //        base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

        //        using (QueryBLL queryBll = new QueryBLL())
        //        {
        //            this.dtbStockAsOn = queryBll.StockAsOn(whid, partyid, product);
        //        }


        //        string expression = string.Empty;
        //        switch (this.GetDefaultViewType(this.grdQrySummary))
        //        {
        //            case eViewType.GridView:
        //                GridView gView = (GridView)this.grdQrySummary.MainView;
        //                foreach (GridColumn column in gView.VisibleColumns)
        //                {
        //                    switch (column.FieldName)
        //                    {
        //                        case "ALLOC_STK":
        //                            expression += "ALLOC_STK+";
        //                            break;
        //                        case "HOLD_QTY":
        //                            expression += "HOLD_QTY+";
        //                            break;
        //                        case "FREE_STK":
        //                            expression += "FREE_STK+";
        //                            break;
        //                        default:
        //                            break;
        //                    }
        //                }
        //                break;
        //            case eViewType.CardView:
        //               // CardView cView = (CardView)this.grdQrySummary.MainView;

        //                break;
        //            case eViewType.BandedView:
        //                BandedGridView bView = (BandedGridView)this.grdQrySummary.MainView;
        //                foreach (GridColumn column in bView.VisibleColumns)
        //                {
        //                    switch (column.FieldName)
        //                    {
        //                        case "ALLOC_STK":
        //                            expression += "ALLOC_STK+";
        //                            break;
        //                        case "HOLD_QTY":
        //                            expression += "HOLD_QTY+";
        //                            break;
        //                        case "FREE_STK":
        //                            expression += "FREE_STK+";
        //                            break;
        //                        default:
        //                            break;
        //                    }
        //                }
        //                break;
        //            case eViewType.AdvanceView:
        //                //AdvBandedGridView aView = (AdvBandedGridView)this.grdQryMainMTL.MainView;
        //                break;
        //            default:
        //                break;
        //        }

        //        if (!string.IsNullOrEmpty(expression))
        //        {
        //            expression = expression.Substring(0, expression.LastIndexOf("+"));

        //            if (this.dtbStockAsOn.Columns.IndexOf("TOTAL_QTY") == -1)
        //            {
        //                this.dtbStockAsOn.Columns.Add("TOTAL_QTY", typeof(int), expression);
        //            }
        //            else
        //            {
        //                this.dtbStockAsOn.Columns["TOTAL_QTY"].Expression = expression;
        //            }
        //        }

        //        if (dtbStockAsOn != null)
        //        {
        //            dtbStockAsOn.DefaultView.Sort = "WH_NAME,PRODUCT_NO";
        //        }

        //        this.grdQrySummary.DataSource = this.dtbStockAsOn;
        //        this.dntQryStkAsOn.DataSource = this.dtbStockAsOn;

        //        base.ExecutionStop();
        //    }
        //    catch (Exception ex)
        //    {
        //        base.FinishedProcessing();

        //        this.grdQrySummary.DataSource = null;
        //        this.dntQryStkAsOn.DataSource = null;

        //        XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
        //    }
        //    finally
        //    {
        //        ((frmMainMenu)this.ParentForm).ExecuteTime.Caption = base.ExecuteTime;
        //        base.FinishedProcessing();
        //    }

        //}

        private void Query_StockAsOn(string whid, string partyid, string product)
        {
            try
            {
                base.ExecutionStart();
                base.BeginProcessing("Begin Load data...", "Please Waiting for Loading Data");

                using (QueryBLL queryBll = new QueryBLL())
                {
                    this.dtbStockAsOn = queryBll.StockAsOn(whid, partyid, product);
                }

                string expressionPCS = string.Empty;
                string expressionBOX = string.Empty;

                switch (this.GetDefaultViewType(this.grdQrySummary))
                {
                case eViewType.GridView:
                    GridView gView = (GridView)this.grdQrySummary.MainView;
                    foreach (GridColumn column in gView.VisibleColumns)
                    {
                        switch (column.FieldName)
                        {
                        case "ALLOC_QTY":
                            expressionPCS += "ALLOC_QTY+";
                            break;

                        case "FREE_QTY":
                            expressionPCS += "FREE_QTY+";
                            break;

                        case "ALLOC_BOX":
                            expressionBOX += "ALLOC_BOX+";
                            break;

                        case "FREE_BOX":
                            expressionBOX += "FREE_BOX+";
                            break;

                        default:
                            break;
                        }
                    }
                    break;

                case eViewType.CardView:
                    // CardView cView = (CardView)this.grdQrySummary.MainView;

                    break;

                case eViewType.BandedView:
                    BandedGridView bView = (BandedGridView)this.grdQrySummary.MainView;
                    foreach (GridColumn column in bView.VisibleColumns)
                    {
                        switch (column.FieldName)
                        {
                        case "ALLOC_QTY":
                            expressionPCS += "ALLOC_QTY+";
                            break;

                        case "FREE_QTY":
                            expressionPCS += "FREE_QTY+";
                            break;

                        case "ALLOC_BOX":
                            expressionBOX += "ALLOC_BOX+";
                            break;

                        case "FREE_BOX":
                            expressionBOX += "FREE_BOX+";
                            break;

                        default:
                            break;
                        }
                    }
                    break;

                case eViewType.AdvanceView:
                    //AdvBandedGridView aView = (AdvBandedGridView)this.grdQryMainMTL.MainView;
                    break;

                default:
                    break;
                }

                if (!string.IsNullOrEmpty(expressionPCS))
                {
                    expressionPCS = expressionPCS.Substring(0, expressionPCS.LastIndexOf("+"));

                    if (this.dtbStockAsOn.Columns.IndexOf("TOTAL_QTY") == -1)
                    {
                        this.dtbStockAsOn.Columns.Add("TOTAL_QTY", typeof(int), expressionPCS);
                    }
                    else
                    {
                        this.dtbStockAsOn.Columns["TOTAL_QTY"].Expression = expressionPCS;
                    }
                }

                if (!string.IsNullOrEmpty(expressionBOX))
                {
                    expressionBOX = expressionBOX.Substring(0, expressionBOX.LastIndexOf("+"));

                    if (this.dtbStockAsOn.Columns.IndexOf("TOTAL_BOX") == -1)
                    {
                        this.dtbStockAsOn.Columns.Add("TOTAL_BOX", typeof(int), expressionBOX);
                    }
                    else
                    {
                        this.dtbStockAsOn.Columns["TOTAL_BOX"].Expression = expressionBOX;
                    }
                }

                if (dtbStockAsOn != null)
                {
                    dtbStockAsOn.DefaultView.Sort = "WH_ID, PARTY_ID, PRODUCT_NO";
                }

                this.grdQrySummary.DataSource = this.dtbStockAsOn;
                this.dntQryStkAsOn.DataSource = this.dtbStockAsOn;

                base.ExecutionStop();
            }
            catch (Exception ex)
            {
                base.FinishedProcessing();

                this.grdQrySummary.DataSource = null;
                this.dntQryStkAsOn.DataSource = null;

                XtraMessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
            }
            finally
            {
                ((frmMainMenu)this.ParentForm).ExecuteTime.Caption = base.ExecuteTime;
                base.FinishedProcessing();
            }
        }