public IList <POS.BO.Brand> GetBrandList(int?SBID, int?SBGID, int?BrandID) { try { //string SBG = ""; //if (SBGID == 3) //{ // SBG = "1,2"; //} //else //{ // SBG = SBGID.ToString(); //} SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "DCR_SP_GET_BrandByParameter"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; da.SelectCommand.Parameters.Add("@BrandID", System.Data.SqlDbType.Int).Value = BrandID; da.SelectCommand.Parameters.Add("@SBGID", System.Data.SqlDbType.VarChar, 10).Value = SBGID; da.SelectCommand.Parameters.Add("@SBID", System.Data.SqlDbType.Int).Value = SBID; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <POS.BO.Brand> objDoctorList = new List <POS.BO.Brand>(); POS.BO.Brand obj = null; int index = 1; foreach (DataRow row in dt.Rows) { obj = new BO.Brand(); obj.Sln = index++; obj.BrandID = Convert.ToInt32(row["BrandID"]); obj.BrandName = row["BrandName"].ToString(); obj.BrandDescription = row["BrandDescription"].ToString(); //obj.SBGID = Convert.ToInt32(row["SBG"].ToString()); //obj.SBGName = Convert.ToString(row["SBGName"].ToString()); objDoctorList.Add(obj); } return(objDoctorList); } catch (Exception ex) { throw ex; } }
public IList <POS.BO.Brand> GetTerritoryWiseSBGAndBrand(long EmployeeID) { try { SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "DCR_SP_GET_TerritoryWiseSBGAndBrand"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; da.SelectCommand.Parameters.Add("@EmployeeID", System.Data.SqlDbType.BigInt).Value = EmployeeID; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <POS.BO.Brand> objBrandList = new List <POS.BO.Brand>(); POS.BO.Brand obj = null; int index = 1; foreach (DataRow row in dt.Rows) { obj = new BO.Brand(); obj.Sln = index++; obj.BrandID = Convert.ToInt32(row["BrandID"]); //obj.SBGID = Convert.ToInt32(row["SBGID"]); obj.BrandName = row["BrandName"].ToString(); obj.BrandDescription = row["BrandDescription"].ToString(); //obj.SBGName = row["SBGName"].ToString(); objBrandList.Add(obj); } return(objBrandList); } catch (Exception ex) { throw ex; } }
public IList <BO.Brand> GetBrandList() { try { SqlConnection con = CreateCon(); SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.CommandText = "[POS_SP_GET_GETBrand]"; da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Connection = con; if (con.State == ConnectionState.Closed) { con.Open(); } DataSet ds = new DataSet(); da.Fill(ds); if (con.State == ConnectionState.Open) { con.Close(); } DataTable dt = ds.Tables[0]; List <POS.BO.Brand> objBrandList = new List <POS.BO.Brand>(); POS.BO.Brand obj = null; int index = 1; foreach (DataRow row in dt.Rows) { obj = new BO.Brand(); obj.Sln = index++; obj.BrandID = Convert.ToInt32(row["BrandID"]); obj.BrandName = row["BrandName"].ToString(); obj.BrandDescription = row["BrandDescription"].ToString(); objBrandList.Add(obj); } return(objBrandList); } catch (Exception ex) { throw ex; } }