Exemplo n.º 1
0
        private bool grdData_Restore()
        {
            bool?bPackingsActual = null;
            bool?bGoodsActual    = null;

            if (chkPackingsActual.Checked)
            {
                bPackingsActual = true;
            }
            if (chkGoodsActual.Checked)
            {
                bGoodsActual = true;
            }

            int?nOwnerID = null;

            if (cboOwner.SelectedValue != null && cboOwner.SelectedIndex >= 0)
            {
                nOwnerID = (int)cboOwner.SelectedValue;
            }
            int?nGoodStateID = null;

            if (cboGoodState.SelectedValue != null && cboGoodState.SelectedIndex >= 0)
            {
                nGoodStateID = Convert.ToInt32(cboGoodState.SelectedValue);
            }

            oPacking.ClearError();
            oPacking.FillTablePackingsNotFixed(sPackingsList,
                                               bPackingsActual, bGoodsActual,
                                               sInputsList, sOutputsList,
                                               nGoodStateID, nOwnerID);
            if (oPacking.ErrorNumber != 0 || oPacking.DS.Tables["TablePackingsNotFixed"] == null)
            {
                return(false);
            }

            dt            = oPacking.DS.Tables["TablePackingsNotFixed"];
            dt.PrimaryKey = new DataColumn[] { dt.Columns["PackingID"] };

            dt.Columns.Add("CellID");
            dt.Columns.Add("Address");
            dt.Columns.Add("StoreZoneName");
            grdData.Restore(dt);

            return(oPacking.ErrorNumber == 0);
        }