Esempio 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);
        }
Esempio n. 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string   sCustomNumber = txtCustomNumber.Text.Trim();
            DateTime?dDateBeg;

            // проверки
            if (sCustomNumber.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указан № ГТД...");
                txtCustomNumber.Select();
                return;
            }
            if (dtpDateBeg.IsEmpty)
            {
                RFMMessage.MessageBoxError("Не указана дата начала действия ГТД...");
                txtCustomNumber.Select();
                return;
            }
            else
            {
                dDateBeg = dtpDateBeg.Value.Date;
            }

            if (dgvData.Rows.Count == 0)
            {
                RFMMessage.MessageBoxError("Не выбрано ни одного товара...");
                return;
            }
            RFMCursorWait.Set(true);
            oGood.ClearError();
            oGood.SaveGoodCustom(sCustomNumber, dDateBeg, tGoodsCustoms);
            RFMCursorWait.Set(false);
            if (oGood.ErrorNumber == 0)
            {
                MotherForm.GotParam = new object[] { sCustomNumber };
                DialogResult        = DialogResult.Yes;
                Dispose();
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sVeterinaryLicence = txtVeterinaryLicence.Text.Trim();
            string sVeterinaryName    = txtVeterinaryName.Text.Trim();

            // проверки
            if (sVeterinaryLicence.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указан номер свидетельства...");
                txtVeterinaryLicence.Select();
                return;
            }

            if (dtpVeterinaryDateBeg.IsEmpty)
            {
                RFMMessage.MessageBoxError("Не указана дата начала действия свидетельства...");
                txtVeterinaryProducer.Select();
                return;
            }

            /*if (sExportXML.Length == 0)
             * {
             *  if (RFMMessage.MessageBoxYesNo("Не заполнены данные для экспорта...\n" +
             *      "Все-таки сохранить?") != DialogResult.Yes)
             *      return;
             * }*/

            if (grdData.Rows.Count == 0)
            {
                if (RFMMessage.MessageBoxYesNo("Не выбрано ни одного товара...\n" +
                                               "Все-таки сохранить?") != DialogResult.Yes)
                {
                    return;
                }
            }

            // уникальность номера
            RFMCursorWait.Set(true);

            Good oGoodTemp = new Good();

            oGoodTemp.FillTableGoodsVeterinaries(null, null);
            foreach (DataRow dr in oGoodTemp.TableGoodsVeterinaries.Rows)
            {
                if (dr["VeterinaryLicence"].ToString().Trim().ToUpper() == sVeterinaryLicence.ToUpper() &&
                    dr["VeterinaryName"].ToString().Trim().ToUpper() == sVeterinaryName.ToUpper() &&
                    (!nGoodVeterinaryID.HasValue || (int)nGoodVeterinaryID != (int)dr["ID"]))
                {
                    RFMCursorWait.Set(false);
                    RFMMessage.MessageBoxError("Такой номер свидетельства с таким же наименованием товара уже есть...");
                    txtVeterinaryLicence.Select();
                    return;
                }
            }
            RFMCursorWait.Set(false);

            // собственно сохранение
            oGood.ClearError();
            oGood.SaveGoodVeterinary(ref nGoodVeterinaryID, sVeterinaryLicence, txtVeterinaryProducer.Text.Trim(),
                                     txtVeterinaryName.Text.Trim(), txtVeterinaryNote.Text.Trim(),
                                     txtVeterinaryMark.Text.Trim(), txtVeterinaryLaboratory.Text.Trim(),
                                     txtVeterinaryDateOfProducing.Text.Trim(),
                                     dtpVeterinaryDateBeg.Value.Date, sExportXML,
                                     tGoodsVeterinaries);
            if (oGood.ErrorNumber == 0)
            {
                // код добавленной записи
                if (nGoodVeterinaryID.HasValue)
                {
                    MotherForm.GotParam = new object[] { (int)nGoodVeterinaryID };
                    DialogResult        = DialogResult.Yes;
                    Dispose();
                }
            }
        }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            WaitOn(this);

            oGoods.ClearError();
            oGoods.ClearFilters();

            // собираем услови¤
            if (ucSelectRecordID_GoodsGroups.IsSelectedExist)
            {
                oGoods.FilterGoodsGroupsList = ucSelectRecordID_GoodsGroups.GetIdString();
            }
            if (ucSelectRecordID_GoodsBrands.IsSelectedExist)
            {
                oGoods.FilterGoodsBrandsList = ucSelectRecordID_GoodsBrands.GetIdString();
            }

            if (txtGoodBarCode.Text.Trim().Length > 0)
            {
                oGoods.FilterGoodBarCode = txtGoodBarCode.Text.Trim();
            }
            if (txtName.Text.Trim().Length > 0)
            {
                oGoods.FilterGoodNameContext = txtName.Text.Trim();
            }

            if (chkGoodsActual.Checked)
            {
                oGoods.FilterGoodsActual = true;
            }
            if (chkPackingsActual.Checked)
            {
                oGoods.FilterPackingsActual = true;
            }

            if (nHostID.HasValue || nUserHostID.HasValue)
            {
                if (nHostID.HasValue)
                {
                    oGoods.FilterHostsList = nHostID.ToString();
                }
                if (nUserHostID.HasValue)
                {
                    oGoods.FilterHostsList = nUserHostID.ToString();
                }
            }
            else
            {
                if (ucSelectRecordID_Hosts.IsSelectedExist)
                {
                    oGoods.FilterHostsList = ucSelectRecordID_Hosts.GetIdString();
                }
            }

            if (tvwGoods.Visible && tvwGoods.TreeSource != null && tvwGoods.GetMarkedNodes() > 0)
            {
                tvwGoods.TreeSource.Filter = "IsMarked";
                tvwGoods.TreeSource.MoveFirst();
                for (int i = 0; i < tvwGoods.TreeSource.Count; i++)
                {
                    oGoods.GoodsIDList = oGoods.GoodsIDList + "," + ((DataRowView)tvwGoods.TreeSource.Current)["ID"];
                    tvwGoods.TreeSource.MoveNext();
                }
                tvwGoods.TreeSource.RemoveFilter();
            }

            grdData.DataSource = null;

            oGoods.FillData();

            if ((chkWeightNot.Checked) || (chkWeight.Checked))
            {
                DataTable dt = CopyTable(oGoods.MainTable, "dt", ((chkWeightNot.Checked) ? "not " : "") + "Weighting", "GoodAlias, GoodID, PackingID");
                oGoods.MainTable.Clear();
                oGoods.MainTable.Merge(dt);
            }

            grdData.Restore(oGoods.MainTable);

            WaitOff(this);

            /* // восстановить отмеченные записи
             * if (ucSelect != null)
             * {
             *      if (ucSelect.IsSaveMark)
             *              ucSelect.RestoreMarks(grdData);
             * }
             */

            grdData.Select();
        }
Esempio n. 5
0
        private void grdData_Restore()
        {
            oGoods.ClearError();
            oGoods.ClearFilters();

            // собираем условия
            if (ucSelectRecordID_GoodsGroups.IsSelectedExist)
            {
                oGoods.FilterGoodsGroupsList = ucSelectRecordID_GoodsGroups.GetIdString();
            }
            if (ucSelectRecordID_GoodsBrands.IsSelectedExist)
            {
                oGoods.FilterGoodsBrandsList = ucSelectRecordID_GoodsBrands.GetIdString();
            }

            if (txtGoodBarCode.Text.Trim().Length > 0)
            {
                oGoods.FilterGoodBarCode = txtGoodBarCode.Text.Trim();
            }
            if (txtName.Text.Trim().Length > 0)
            {
                oGoods.FilterGoodNameContext = txtName.Text.Trim();
            }

            if (chkGoodsActual.Checked)
            {
                oGoods.FilterGoodsActual = true;
            }
            if (chkPackingsActual.Checked)
            {
                oGoods.FilterPackingsActual = true;
            }

            if (nHostID.HasValue || nUserHostID.HasValue)
            {
                if (nHostID.HasValue)
                {
                    oGoods.FilterHostsList = nHostID.ToString();
                }
                if (nUserHostID.HasValue)
                {
                    oGoods.FilterHostsList = nUserHostID.ToString();
                }
            }
            else
            {
                if (ucSelectRecordID_Hosts.IsSelectedExist)
                {
                    oGoods.FilterHostsList = ucSelectRecordID_Hosts.GetIdString();
                }
            }

            if (tvwGoods.Visible && tvwGoods.TreeSource != null && tvwGoods.GetMarkedNodes() > 0)
            {
                tvwGoods.TreeSource.Filter = "IsMarked";
                tvwGoods.TreeSource.MoveFirst();
                for (int i = 0; i < tvwGoods.TreeSource.Count; i++)
                {
                    oGoods.FilterGoodsIDList = oGoods.FilterGoodsIDList + "," + ((DataRowView)tvwGoods.TreeSource.Current)["ID"];
                    tvwGoods.TreeSource.MoveNext();
                }
                tvwGoods.TreeSource.RemoveFilter();
            }

            oGoods.FillData();

            // артикул
            if (txtArticul.Text.Trim().Length > 0)
            {
                tTable = CopyTable(oGoods.MainTable, "tTable", "Articul LIKE '*" + txtArticul.Text.Trim().ToUpper() + "*'", "");
            }
            else
            {
                tTable = oGoods.MainTable;
            }

            grdData.Restore(tTable);
        }
Esempio n. 6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sQualityLicence = txtQualityLicence.Text.Trim();
            string sQualityIssuer  = txtQualityIssuer.Text.Trim();
            string sQualityHolder  = txtQualityHolder.Text.Trim();

            // проверки
            if (sQualityLicence.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указан номер декларации...");
                txtQualityLicence.Select();
                return;
            }
            if (sQualityIssuer.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указано, кем выдана декларация...");
                txtQualityIssuer.Select();
                return;
            }
            if (sQualityHolder.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указано лицо, принявшее декларацию...");
                txtQualityHolder.Select();
                return;
            }
            if (grdData.Rows.Count == 0)
            {
                if (RFMMessage.MessageBoxYesNo("Не выбрано ни одного товара...\n" +
                                               "Все-таки сохранить?") != DialogResult.Yes)
                {
                    return;
                }
            }

            // уникальность номера
            RFMCursorWait.Set(true);

            Good oGoodTemp = new Good();

            oGoodTemp.FillTableGoodsQualities(null, null);
            foreach (DataRow dr in oGoodTemp.TableGoodsQualities.Rows)
            {
                if (dr["QualityLicence"].ToString().Trim().ToUpper() == sQualityLicence.ToUpper() &&
                    (!nGoodQualityID.HasValue || (int)nGoodQualityID != (int)dr["ID"]))
                {
                    RFMCursorWait.Set(false);
                    RFMMessage.MessageBoxError("Такая декларация уже есть...");
                    txtQualityLicence.Select();
                    return;
                }
            }
            RFMCursorWait.Set(false);

            DateTime?dDateBeg = null, dDateEnd = null;

            if (!dtrDates.dtpBegDate.IsEmpty)
            {
                dDateBeg = dtrDates.dtpBegDate.Value;
            }
            if (!dtrDates.dtpEndDate.IsEmpty)
            {
                dDateEnd = dtrDates.dtpEndDate.Value;
            }

            // собственно сохранение
            oGood.ClearError();
            oGood.SaveGoodQuality(ref nGoodQualityID, sQualityLicence, sQualityIssuer, sQualityHolder, dDateBeg, dDateEnd, tGoodsQualities);
            if (oGood.ErrorNumber == 0)
            {
                // код добавленной записи
                if (nGoodQualityID.HasValue)
                {
                    MotherForm.GotParam = new object[] { (int)nGoodQualityID };
                    DialogResult        = DialogResult.Yes;
                    Dispose();
                }
            }
        }