예제 #1
0
        private void btnAddressContextMark_Click(object sender, EventArgs e)
        {
            RFMCursorWait.Set(true);
            RFMCursorWait.LockWindowUpdate(FindForm().Handle);

            if (txtAddress.Text.Trim().Length > 0 && dgvCells.Rows.Count > 0)
            {
                string sAddress   = txtAddress.Text.Trim().ToUpper();
                string sCellsList = "";
                foreach (DataRow r in oCell.MainTable.Rows)
                {
                    if (r["Address"].ToString().ToUpper().Contains(sAddress))
                    {
                        sCellsList += r["ID"].ToString() + ",";
                    }
                }
                if (sCellsList.Length > 0)
                {
                    sCellsList = RFMUtilities.NormalizeList(sCellsList);
                    dgvCells.MarkFromList(sCellsList);
                }
            }
            dgvCells.Refresh();

            RFMCursorWait.LockWindowUpdate(IntPtr.Zero);
            RFMCursorWait.Set(false);
        }
예제 #2
0
파일: Good.cs 프로젝트: dmalex619/rfm-wms
        /// <summary>
        /// получение таблицы товарных брендов (TableGoodsBrands)
        /// </summary>
        public bool FillTableGoodsBrands()
        {
            string sqlSelect = "select GB.ID, GB.Name, GB.Actual, " +
                               "GB.HostID, HS.Name as HostName, " +
                               "GB.ERPCode " +
                               "from GoodsBrands GB with (nolock) " +
                               "left join Hosts HS with (nolock) on GB.HostID = HS.ID " +
                               "where 1 = 1 ";

            if (_FilterHostsList != null)
            {
                sqlSelect += " and GB.HostID in (" + RFMUtilities.NormalizeList(_FilterHostsList) + ") ";
            }
            if (_TableGoodsBrands_FilterActual != null)
            {
                sqlSelect = sqlSelect + " where GB.Actual = " + ((bool)_TableGoodsBrands_FilterActual ? "1" : "0");
            }
            if (_TableGoodsBrands_FilterNameContext != null)
            {
                sqlSelect = sqlSelect + " and charindex(upper('" + _TableGoodsBrands_FilterNameContext + "'), upper(GB.Name)) > 0";
            }
            if (_FilterGoodsBrandsList != null)
            {
                sqlSelect = sqlSelect + " and charindex(',' + ltrim(str(GB.ID)) + ',', ',' + '" + _FilterGoodsBrandsList + "' + ',') > 0";
            }
            sqlSelect = sqlSelect + " order by GB.Name";
            SqlCommand _oCommand = new SqlCommand(sqlSelect, _Connect);

            try
            {
                _TableGoodsBrands = FillReadings(new SqlDataAdapter(_oCommand), _TableGoodsBrands, "TableGoodsBrands");

                // primarykey
                DataColumn[] pk = new DataColumn[1];
                pk[0] = _TableGoodsBrands.Columns[0];
                _TableGoodsBrands.PrimaryKey = pk;
            }
            catch (Exception ex)
            {
                _ErrorNumber = -12;
                _ErrorStr    = "Ошибка при получении списка брендов..." + Convert.ToChar(13) + ex.Message;
                RFMMessage.MessageBoxError(_ErrorStr);
            }
            return(_ErrorNumber == 0);
        }
예제 #3
0
        private void SetStartTerms()
        {
            // начальные условия
            if (oOutputDocument != null)
            {
                // даты диапазона можно менять
                if (oOutputDocument.FilterDateBeg != null)
                {
                    dtrDates.dtpBegDate.Value = Convert.ToDateTime(oOutputDocument.FilterDateBeg);
                }
                if (oOutputDocument.FilterDateEnd != null)
                {
                    dtrDates.dtpEndDate.Value = Convert.ToDateTime(oOutputDocument.FilterDateEnd);
                }

                // другие условия менять нельзя
                if (oOutputDocument.FilterDateOutput != null)
                {
                    dtrDates.dtpBegDate.Value     =
                        dtrDates.dtpEndDate.Value =
                            Convert.ToDateTime(oOutputDocument.FilterDateOutput);
                    dtrDates.Enabled = false;
                }

                if (oOutputDocument.FilterDeliveryNeed != null)
                {
                    if ((bool)oOutputDocument.FilterDeliveryNeed)
                    {
                        optDeliveryNeed.Checked = true;
                    }
                    else
                    {
                        optDeliveryNeedNot.Checked = true;
                    }
                    pnlDeliveryNeed.Enabled = false;
                }

                if (oOutputDocument.FilterOwnersList != null)
                {
                    ucSelectRecordID_Owners.LstMarked = oOutputDocument.FilterOwnersList.ToString();
                    ucSelectRecordID_Owners.Enabled   = false;
                }
                if (oOutputDocument.FilterPartnersSourceList != null)
                {
                    ucSelectRecordID_PartnersSource.LstMarked = oOutputDocument.FilterPartnersSourceList.ToString();
                    ucSelectRecordID_PartnersSource.Enabled   = false;
                }
                if (oOutputDocument.FilterPartnersTargetList != null)
                {
                    ucSelectRecordID_PartnersTarget.LstMarked = oOutputDocument.FilterPartnersTargetList.ToString();
                    ucSelectRecordID_PartnersTarget.Enabled   = false;
                }

                if (oOutputDocument.FilterIsBrought != null)
                {
                    if ((bool)oOutputDocument.FilterIsBrought)
                    {
                        optOutputsDocumentsIsBrought.Checked = true;
                    }
                    else
                    {
                        optOutputsDocumentsIsBroughtNot.Checked = true;
                    }
                    pnlOutputsDocumentsIsBrought.Enabled = false;
                }
                if (oOutputDocument.FilterIsConfirmed != null)
                {
                    if ((bool)oOutputDocument.FilterIsConfirmed)
                    {
                        optOutputsDocumentsIsConfirmed.Checked = true;
                    }
                    else
                    {
                        optOutputsDocumentsIsConfirmedNot.Checked = true;
                    }
                    pnlOutputsDocumentsIsConfirmed.Enabled = false;
                }
                if (oOutputDocument.FilterIsOutputExists != null)
                {
                    if ((bool)oOutputDocument.FilterIsOutputExists)
                    {
                        optOutputExists.Checked = true;
                    }
                    else
                    {
                        optOutputExistsNot.Checked = true;
                    }
                    pnlOutputExists.Enabled = false;
                }

                if (oOutputDocument.FilterTripExists != null)
                {
                    if ((bool)oOutputDocument.FilterTripExists)
                    {
                        optTripExists.Checked = true;
                    }
                    else
                    {
                        optTripExistsNot.Checked = true;
                    }
                    pnlTripExists.Enabled = false;
                }

                if (oOutputDocument.FilterTripsList != null)
                {
                    if (RFMUtilities.Occurs(RFMUtilities.NormalizeList(oOutputDocument.FilterTripsList), ",") == 0 &&
                        oOutputDocument.FilterTripsList != "")
                    {
                        try
                        {
                            numTripID.Value = Convert.ToInt32(RFMUtilities.NormalizeList(oOutputDocument.FilterTripsList));
                        }
                        finally { }
                    }
                    numTripID.Enabled           =
                        lblAliasContext.Enabled =
                            false;
                }

                if (oOutputDocument.FilterPackingsList != null)
                {
                    sSelectedPackingsIDList = oOutputDocument.FilterPackingsList.ToString();
                    pnlPackings.Enabled     = false;
                }

                if (oOutputDocument.FilterHostsList != null)
                {
                    ucSelectRecordID_Hosts.LstMarked = oOutputDocument.FilterHostsList.ToString();
                    ucSelectRecordID_Hosts.Enabled   = false;
                }
                if (nUserHostID.HasValue)
                {
                    ucSelectRecordID_Hosts.LstMarked = nUserHostID.ToString();
                }
            }
        }
예제 #4
0
        private void SetStartTerms()
        {
            // начальные условия
            if (oInput != null)
            {
                // даты можно менять
                if (oInput.FilterDateBeg != null)
                {
                    dtrDates.dtpBegDate.Value = Convert.ToDateTime(oInput.FilterDateBeg);
                }
                if (oInput.FilterDateEnd != null)
                {
                    dtrDates.dtpEndDate.Value = Convert.ToDateTime(oInput.FilterDateEnd);
                }

                // остальные условия менять нельзя
                if (oInput.FilterDeliveryNeed != null)
                {
                    if ((bool)oInput.FilterDeliveryNeed)
                    {
                        optDeliveryNeed.Checked = true;
                    }
                    else
                    {
                        optDeliveryNeedNot.Checked = true;
                    }
                    pnlDeliveryNeed.Enabled = false;
                }

                if (oInput.FilterOwnersList != null)
                {
                    ucSelectRecordID_Owners.LstMarked = oInput.FilterOwnersList.ToString();
                    ucSelectRecordID_Owners.Enabled   = false;
                }
                if (oInput.FilterInputsTypesList != null)
                {
                    ucSelectRecordID_InputsTypes.LstMarked = oInput.FilterInputsTypesList.ToString();
                    ucSelectRecordID_InputsTypes.Enabled   = false;
                }
                if (oInput.FilterPartnersList != null)
                {
                    ucSelectRecordID_InputsPartners.LstMarked = oInput.FilterPartnersList.ToString();
                    ucSelectRecordID_InputsPartners.Enabled   = false;
                }

                if (oInput.FilterIsConfirmed != null)
                {
                    if ((bool)oInput.FilterIsConfirmed)
                    {
                        optIsConfirmed.Checked = true;
                    }
                    else
                    {
                        optIsConfirmedNot.Checked = true;
                    }
                    pnlIsConfirmed.Enabled = false;
                }
                if (oInput.FilterReadyForWMS != null)
                {
                    if ((bool)oInput.FilterReadyForWMS)
                    {
                        optReadyForWMS.Checked = true;
                    }
                    else
                    {
                        optReadyForWMSNot.Checked = true;
                    }
                    pnlReadyForWMS.Enabled = false;
                }

                if (oInput.FilterTripExists != null)
                {
                    if ((bool)oInput.FilterTripExists)
                    {
                        optTripExists.Checked = true;
                    }
                    else
                    {
                        optTripExistsNot.Checked = true;
                    }
                    pnlTripExists.Enabled = false;
                }

                if (oInput.FilterTripsList != null)
                {
                    if (RFMUtilities.Occurs(RFMUtilities.NormalizeList(oInput.FilterTripsList), ",") == 0 &&
                        oInput.FilterTripsList != "")
                    {
                        try
                        {
                            numTripID.Value = Convert.ToInt32(RFMUtilities.NormalizeList(oInput.FilterTripsList));
                        }
                        finally { }
                    }
                    numTripID.Enabled           =
                        lblAliasContext.Enabled =
                            false;
                }

                if (oInput.FilterPackingsList != null)
                {
                    sSelectedPackingsIDList = oInput.FilterPackingsList.ToString();
                    pnlPackings.Enabled     = false;
                }

                if (oInput.FilterHostsList != null)
                {
                    ucSelectRecordID_Hosts.LstMarked = oInput.FilterHostsList.ToString();
                    ucSelectRecordID_Hosts.Enabled   = false;
                }
                if (nUserHostID.HasValue)
                {
                    ucSelectRecordID_Hosts.LstMarked = nUserHostID.ToString();
                }
            }
        }
예제 #5
0
        private void PartnersPFCopy()
        {
            if (grdData.CurrentRow == null)
            {
                return;
            }
            if (!oPartnerCur.ID.HasValue)
            {
                return;
            }

            if (!grdData.IsCheckerShow ||
                grdData.MarkedCount == 0)
            {
                RFMMessage.MessageBoxError("Нет отмеченных партнеров...");
                return;
            }

            int nPartnerID = (int)oPartnerCur.ID;

            oPartnerCur.ReFillOne(nPartnerID);
            if ((oPartnerCur.PF_BillName == null || oPartnerCur.PF_BillName.Trim().Length == 0) &&
                oPartnerCur.PF_BillCopiesCount == 0 &&
                (oPartnerCur.PF_FactureName == null || oPartnerCur.PF_FactureName.Trim().Length == 0) &&
                oPartnerCur.PF_FactureCopiesCount == 0 &&
                (oPartnerCur.PF_PayBillName == null || oPartnerCur.PF_PayBillName.Trim().Length == 0) &&
                oPartnerCur.PF_PayBillCopiesCount == 0)
            {
                RFMMessage.MessageBoxError("Для текущего партнера нет данных о специальных печатных формах...");
                return;
            }

            Partner oPartnerForCopy = new Partner();

            PartnerPrepareIDList(oPartnerForCopy, true);
            if (oPartnerForCopy.IDList != null && oPartnerForCopy.IDList.Length > 0)
            {
                string sText = "," + oPartnerForCopy.IDList + ",";
                if (sText.Contains("," + nPartnerID.ToString().Trim() + ","))
                {
                    sText = sText.Replace("," + nPartnerID.ToString().Trim() + ",", ",");
                    oPartnerForCopy.IDList = RFMUtilities.NormalizeList(sText);
                }
                if (!oPartnerForCopy.FillData() ||
                    oPartnerForCopy.MainTable == null || oPartnerForCopy.MainTable.Rows.Count == 0)
                {
                    RFMMessage.MessageBoxError("Нет данных об отмеченных партнерах...");
                    return;
                }

                if (RFMMessage.MessageBoxYesNo("Выполнить копирование данных о специальных печатных формах и нестандартном количестве копий формируемых документов текущего партнера\n" +
                                               "\"" + oPartnerCur.Name + "\"\n" +
                                               "для всех отмеченных партнеров (" + oPartnerForCopy.MainTable.Rows.Count.ToString().Trim() + ")?\n\n" +
                                               "ВНИМАНИЕ!\n" +
                                               "Существующие данные о печатных формах и количестве копий для отмеченных партнеров, если таковые имеются, будут полностью заменены на данные текущего партнера!") == DialogResult.Yes)
                {
                    if (oPartnerForCopy.CopyDataPartnersPF(nPartnerID, oPartnerForCopy.IDList))
                    {
                        grdData_Restore();
                    }
                }
            }
            else
            {
                RFMMessage.MessageBoxError("Нет данных об отмеченных партнерах...");
                return;
            }
        }
예제 #6
0
        private void PartnersGoodsCopy()
        {
            if (grdData.CurrentRow == null)
            {
                return;
            }
            if (!oPartnerCur.ID.HasValue)
            {
                return;
            }

            if (!grdData.IsCheckerShow ||
                grdData.MarkedCount == 0)
            {
                RFMMessage.MessageBoxError("Нет отмеченных партнеров...");
                return;
            }

            int nPartnerID = (int)oPartnerCur.ID;

            if (!oPartnerCur.FillTablePartnersGoods(nPartnerID) ||
                oPartnerCur.TablePartnersGoods == null || oPartnerCur.TablePartnersGoods.Rows.Count == 0)
            {
                RFMMessage.MessageBoxError("Для текущего партнера нет спец.данных о товарах...");
                return;
            }

            Partner oPartnerForCopy = new Partner();

            PartnerPrepareIDList(oPartnerForCopy, true);
            if (oPartnerForCopy.IDList != null && oPartnerForCopy.IDList.Length > 0)
            {
                string sText = "," + oPartnerForCopy.IDList + ",";
                if (sText.Contains("," + nPartnerID.ToString().Trim() + ","))
                {
                    sText = sText.Replace("," + nPartnerID.ToString().Trim() + ",", ",");
                    oPartnerForCopy.IDList = RFMUtilities.NormalizeList(sText);
                }
                if (!oPartnerForCopy.FillData() ||
                    oPartnerForCopy.MainTable == null || oPartnerForCopy.MainTable.Rows.Count == 0)
                {
                    RFMMessage.MessageBoxError("Нет данных об отмеченных партнерах...");
                    return;
                }

                if (RFMMessage.MessageBoxYesNo("Выполнить копирование спец.данных о товарах текущего партнера\n" +
                                               "\"" + oPartnerCur.Name + "\"\n" +
                                               "для всех отмеченных партнеров (" + oPartnerForCopy.MainTable.Rows.Count.ToString().Trim() + ")?\n\n" +
                                               "ВНИМАНИЕ!\n" +
                                               "Существующие спец.данные о товарах для отмеченных партнеров, если таковые имеются, будут удалены и полностью заменены на спец.данные о товарах текущего партнера!") == DialogResult.Yes)
                {
                    if (oPartnerForCopy.CopyTablePartnersGoods(nPartnerID, oPartnerForCopy.IDList))
                    {
                        grdData_Restore();
                    }
                }
            }
            else
            {
                RFMMessage.MessageBoxError("Нет данных об отмеченных партнерах...");
                return;
            }
        }