Exemplo n.º 1
0
        public ClsDealerData getSingleDealerData(int dealerId)
        {
            ClsDealerData dealer = new ClsDealerData();
            DataTable     dt     = new DataTable();

            try
            {
                string querry = "SELECT * FROM tbl_dealers WHERE dealerId = '" + dealerId + "';";
                dt = CONN.getDataTable(querry);

                if (dt.Rows.Count > 0)
                {
                    dealer._dealerId    = Convert.ToInt32(dt.Rows[0]["dealerId"]);
                    dealer._dealerName  = dt.Rows[0]["dealerName"].ToString();
                    dealer._companyName = dt.Rows[0]["companyName"].ToString();
                    dealer._address     = dt.Rows[0]["address"].ToString();
                    dealer._phoneNo     = dt.Rows[0]["phoneNo"].ToString();
                    dealer._mobile      = dt.Rows[0]["mobile"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dealer);
        }
Exemplo n.º 2
0
        public bool updateData_dealer(ClsDealerData dealer)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += "UPDATE tbl_dealers SET ";
                querry += "dealerName = '" + dealer._dealerName + "', ";
                querry += "companyName = '" + dealer._companyName + "', ";
                querry += "address = '" + dealer._address + "',";
                querry += "phoneNo ='" + dealer._phoneNo + "', ";
                querry += "mobile ='" + dealer._mobile + "' ";
                querry += "WHERE dealerId = '" + dealer._dealerId + "'";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }
Exemplo n.º 3
0
        public bool insertData_dealer(ClsDealerData dealer)
        {
            bool   isOK   = false;
            string querry = string.Empty;

            try
            {
                querry += "INSERT INTO tbl_dealers (dealerId, dealerName, companyName, address, phoneNo, mobile) VALUES (";
                querry += "'" + dealer._dealerId + "',";
                querry += "'" + dealer._dealerName + "',";
                querry += "'" + dealer._companyName + "',";
                querry += "'" + dealer._address + "',";
                querry += "'" + dealer._phoneNo + "',";
                querry += "'" + dealer._mobile + "'";
                querry += ");";

                isOK = CONN.update(querry);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isOK);
        }