Esempio n. 1
0
        public Agent(int iRepNo)
        {
            if (iRepNo == -1)
            {
                _sCompany   = "All Agents";
                _iRepNo     = -1;
                _sAgentCode = "All Agents";
            }
            else
            {
                _iRepNo = iRepNo;
                _ds     = DataLink.Select("select * from Agents where RepNo = " + iRepNo, DataLinkCon.bpss);

                if (_ds.Tables.Count > 0)
                {
                    IEnumerable <DataRow> rows = _ds.Tables[0].AsEnumerable();

                    _sAgentCode          = rows.Select(r => r["AgentCode"].ToString()).First();
                    _sCompany            = rows.Select(r => r["Company"].ToString()).First();
                    _sAddressCity        = rows.Select(r => r["AddressCity"].ToString()).First();
                    _sAddressState       = rows.Select(r => r["AddressState"].ToString()).First();
                    _sAddressStreet      = rows.Select(r => r["AddressStreet"].ToString()).First();
                    _sAddressZip         = rows.Select(r => r["AddressZip"].ToString()).First();
                    _sCompanyEMail       = rows.Select(r => r["CompanyEmail"].ToString()).First();
                    _sDefaultContactName = rows.Select(r => r["DefaultContactName"].ToString()).First();
                    _sPhone = rows.Select(r => r["Phone"].ToString()).First();
                }
            }
        }
        static public List <StockInventoryItem> GetAllItems()
        {
            _ssSQL = "select CatalogNumber from Stock";
            _sds   = DataLink.Select(_ssSQL, DataLinkCon.mgmuser);

            return(_sds.Tables[0].AsEnumerable().Select(r => new StockInventoryItem(r["CatalogNumber"].ToString(),
                                                                                    InventoryDescType.CatalogNumber)).Cast <StockInventoryItem>().ToList());
        }
        static public List <string> GetAltNumber(string sWindings, string sStockVoltageDisplay, string sKVA)
        {
            _ssSQL = "select s.AltNumber from Stock s join StockVoltages sv on s.Configuration = sv.StockVoltage where s.Windings = '" +
                     sWindings + "' and s.KVA = " + sKVA + " and sv.StockVoltageDisplay = '" + sStockVoltageDisplay + "'";

            _sds = DataLink.Select(_ssSQL, DataLinkCon.mgmuser);

            return(_sds.Tables[0].AsEnumerable().Select(r => r["AltNumber"].ToString()).ToList());
        }
Esempio n. 4
0
        static public string GetCategory(string sStockVoltageDisplay, string sWindings)
        {
            if (sStockVoltageDisplay == "ALL")
            {
                return("ALL");
            }

            _sds = DataLink.Select("select VoltageCategory from StockVoltages where StockVoltageDisplay = '" + sStockVoltageDisplay + "' and Windings = '" + sWindings + "'",
                                   DataLinkCon.mgmuser);
            return(_sds.Tables[0].AsEnumerable().Select(r => r["VoltageCategory"].ToString()).First());
        }
Esempio n. 5
0
        static public List <StockVoltages> GetAllItems()
        {
            List <StockVoltages> retLst;

            _ssSQL = "select * from StockVoltages";
            _sds   = DataLink.Select(_ssSQL, DataLinkCon.mgmuser);

            retLst = _sds.Tables[0].AsEnumerable().Select(r => new StockVoltages(r["StockVoltageDisplay"].ToString(),
                                                                                 StockVoltagesType.StockVoltageDisplay)).Cast <StockVoltages>().ToList();

            return(retLst);
        }
Esempio n. 6
0
        public StockVoltages(string sDesc, StockVoltagesType svt)
        {
            if (svt == StockVoltagesType.StockVoltageDisplay)
            {
                _sSQL = "select * from StockVoltages where StockVoltageDisplay = '" + sDesc + "'";
            }


            _ds = DataLink.Select(_sSQL, DataLinkCon.mgmuser);

            _sStockVoltage        = _ds.Tables[0].AsEnumerable().Select(r => r["StockVoltage"].ToString()).First();
            _sStockVoltageDisplay = _ds.Tables[0].AsEnumerable().Select(r => r["StockVoltageDisplay"].ToString()).First();
            _sVoltageCategory     = _ds.Tables[0].AsEnumerable().Select(r => r["VoltageCategory"].ToString()).First();
            _sWindings            = _ds.Tables[0].AsEnumerable().Select(r => r["Windings"].ToString()).First();
        }
Esempio n. 7
0
        static public int GetAgentNoFromRepID(int iRepID)
        {
            int     iRetVal = -1;
            DataSet dsAgentNo;

            dsAgentNo = DataLink.Select("select MGMAgentNo from Rep where RepID = " + iRepID, DataLinkCon.mgmuser);

            if (dsAgentNo.Tables.Count > 0)
            {
                if (dsAgentNo.Tables[0].Rows.Count > 0)
                {
                    iRetVal = Convert.ToInt32(dsAgentNo.Tables[0].Rows[0]["MGMAgentNo"]);
                }
            }

            return(iRetVal);
        }
Esempio n. 8
0
        static public int GetQuoteEmailID(int iQuoteID)
        {
            int iQuoteEmailID = -1;

            DataSet dsQuote = DataLink.Select("select max(QuoteEmailID) as QuoteEmailID from QuoteEmails where QuoteID = " + iQuoteID, DataLinkCon.mgmuser);

            if (dsQuote.Tables.Count > 0)
            {
                if (dsQuote.Tables[0].Rows.Count > 0)
                {
                    if (!DBNull.Value.Equals(dsQuote.Tables[0].Rows[0]["QuoteEmailID"]))
                    {
                        iQuoteEmailID = Convert.ToInt32(dsQuote.Tables[0].Rows[0]["QuoteEmailID"]);
                    }
                }
            }

            return(iQuoteEmailID);
        }
Esempio n. 9
0
        public static int GetMGMAgentNo(string sRepName)
        {
            int iRetValue = -1;

            DataSet ds = DataLink.Select("select MGMAgentNo from Rep where Display_Name = '" + sRepName + "'", DataLinkCon.mgmuser);

            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        iRetValue = ds.Tables[0].AsEnumerable().Select(r => Convert.ToInt32(r["MGMAgentNo"])).First();
                    }
                }
            }


            return(iRetValue);
        }
        public StockInventoryItem(string sDesc, InventoryDescType descType)
        {
            if (descType == InventoryDescType.AltNumber)
            {
                _sSQL = "select s.CatalogNumber,s.AltNumber,s.Height,s.Width,s.Depth,s.PrimaryVoltageDW,s.SecondaryVoltageDW,s.Hertz,s.Temperature,s.Enclosure," +
                        "s.PrimaryVoltage,s.SecondaryVoltage,s.TP1,s.SoundLevel,s.KVA,s.Weight,s.Windings,s.Configuration,sv.StockVoltageDisplay,sv.VoltageCategory " +
                        "from Stock s join StockVoltages sv on " +
                        "s.Configuration = sv.StockVoltage and s.Windings = sv.Windings where AltNumber = '" + sDesc + "'";
            }
            if (descType == InventoryDescType.CatalogNumber)
            {
                _sSQL = "select s.CatalogNumber,s.AltNumber,s.Height,s.Width,s.Depth,s.PrimaryVoltageDW,s.SecondaryVoltageDW,s.Hertz,s.Temperature,s.Enclosure," +
                        "s.PrimaryVoltage,s.SecondaryVoltage,s.TP1,s.SoundLevel,s.KVA,s.Weight,s.Windings,s.Configuration,sv.StockVoltageDisplay,sv.VoltageCategory " +
                        "from Stock s join StockVoltages sv on " +
                        "s.Configuration = sv.StockVoltage and s.Windings = sv.Windings where CatalogNumber = '" + sDesc + "'";
            }

            _ds                   = DataLink.Select(_sSQL, DataLinkCon.mgmuser);
            _sCatalogNumber       = _ds.Tables[0].AsEnumerable().Select(r => r["CatalogNumber"].ToString()).First();
            _sAltNumber           = _ds.Tables[0].AsEnumerable().Select(r => r["AltNumber"].ToString()).First();
            _dHeight              = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToDecimal(r["Height"])).First();
            _dWidth               = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToDecimal(r["Width"])).First();
            _dDepth               = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToDecimal(r["Depth"])).First();
            _sPrimaryVoltageDW    = _ds.Tables[0].AsEnumerable().Select(r => r["PrimaryVoltageDW"].ToString()).First();
            _sSecondaryVoltageDW  = _ds.Tables[0].AsEnumerable().Select(r => r["SecondaryVoltageDW"].ToString()).First();
            _iHertz               = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToInt32(r["Hertz"])).First();
            _iTemperature         = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToInt32(r["Temperature"])).First();
            _sEnclosure           = _ds.Tables[0].AsEnumerable().Select(r => r["Enclosure"].ToString()).First();
            _sPrimaryVoltage      = _ds.Tables[0].AsEnumerable().Select(r => r["PrimaryVoltage"].ToString()).First();
            _sSecondaryVoltage    = _ds.Tables[0].AsEnumerable().Select(r => r["SecondaryVoltage"].ToString()).First();
            _sTP1                 = _ds.Tables[0].AsEnumerable().Select(r => r["TP1"].ToString()).First();
            _sSoundLevel          = _ds.Tables[0].AsEnumerable().Select(r => r["SoundLevel"].ToString()).First();
            _dKVA                 = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToDouble(r["KVA"])).First();
            _iWeight              = _ds.Tables[0].AsEnumerable().Select(r => Convert.ToInt32(r["Weight"])).First();
            _sWindings            = _ds.Tables[0].AsEnumerable().Select(r => r["Windings"].ToString()).First();
            _sConfiguration       = _ds.Tables[0].AsEnumerable().Select(r => r["Configuration"].ToString()).First();
            _sStockVoltageDisplay = _ds.Tables[0].AsEnumerable().Select(r => r["StockVoltageDisplay"].ToString()).First();
            _sVoltageCat          = _ds.Tables[0].AsEnumerable().Select(r => r["VoltageCategory"].ToString()).First();
            _bUseSelectString     = false;
        }
Esempio n. 11
0
        public static string GetAgentCode(int iMGMAgentNo, string sDisplayName)
        {
            int    iRepID     = -1;
            string sAgentCode = "";

            DataSet ds = DataLink.Select("select RepID from Rep where MGMAgentNo = " +
                                         iMGMAgentNo + " and Display_Name = '" + sDisplayName + "'", DataLinkCon.mgmuser);

            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        iRepID = ds.Tables[0].AsEnumerable().Select(r => Convert.ToInt32(r["RepID"])).First();
                    }
                }
            }


            if (iRepID != -1)
            {
                ds = DataLink.Select("select AgentCode from Agents where RepIDWeb = " + iRepID, DataLinkCon.bpss);
                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        if (ds.Tables[0].Rows.Count > 0)
                        {
                            sAgentCode = ds.Tables[0].AsEnumerable().Select(r => r["AgentCode"].ToString()).First();
                        }
                    }
                }
            }

            return(sAgentCode);
        }