public static string LoadHead1() { //string str = "select * from STP_Employee where IsDelete=0 order by FirstName"; string str = "select '0' AS PackingTypeID,' - - Select Multiplier Name ' AS PackingTypeDesc from ITEM_Packing union select PackingTypeID,PackingTypeDesc from ITEM_Packing where IsDelete=0 order by PackingTypeID "; SqlConnection Con = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); SqlDataAdapter da = new SqlDataAdapter(str, Con); DataTable dt = new DataTable(); da.Fill(dt); List <GetRegionClassLCK> RegionList = new List <GetRegionClassLCK>(); RegionList.Clear(); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { GetRegionClassLCK dbdc = new GetRegionClassLCK(); dbdc.ID = dt.Rows[i]["PackingTypeID"].ToString(); dbdc.Name = dt.Rows[i]["PackingTypeDesc"].ToString(); RegionList.Insert(i, dbdc); } } JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }
public static string LoadRegion() { SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString); DataSet ds = AACommon.ReturnDatasetBySPWithoutParameter("ITM_ITEM_GET", Conn); List <GetRegionClassLCK> RegionList = new List <GetRegionClassLCK>(); RegionList.Clear(); //if (ds.Tables[0].Rows.Count > 0) //{ for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { GetRegionClassLCK dbdc = new GetRegionClassLCK(); dbdc.ITEMID = ds.Tables[0].Rows[i]["ITEMID"].ToString(); dbdc.ITEMName = ds.Tables[0].Rows[i]["ITEMName"].ToString(); dbdc.ItemCode = ds.Tables[0].Rows[i]["ItemCode"].ToString(); dbdc.BarCode = ds.Tables[0].Rows[i]["BarCode"].ToString(); dbdc.Discription = ds.Tables[0].Rows[i]["Discription"].ToString(); dbdc.UnitTypeID = ds.Tables[0].Rows[i]["UnitTypeID"].ToString(); dbdc.DistPercentage = ds.Tables[0].Rows[i]["DistPercentage"].ToString(); dbdc.TradePrice = ds.Tables[0].Rows[i]["TradePrice"].ToString(); dbdc.RetailPrice = ds.Tables[0].Rows[i]["RetailPrice"].ToString(); dbdc.PackingTypeID = ds.Tables[0].Rows[i]["PackingTypeID"].ToString(); dbdc.Wt = ds.Tables[0].Rows[i]["Wt"].ToString(); RegionList.Insert(i, dbdc); } //} JavaScriptSerializer jser = new JavaScriptSerializer(); return(jser.Serialize(RegionList)); }