public static ProductSetList SelectedPrintSparePartSet(string id) { var data = new ProductSetList(); var dsSaleProductSet = new DataSet(); using (SqlConnection conn = new SqlConnection(SPlanetUtil.GetConnectionString())) { //Create array of Parameters List <SqlParameter> arrParm = new List <SqlParameter> { new SqlParameter("@product_set_id", SqlDbType.Int) { Value = Convert.ToInt32(id) }, }; conn.Open(); dsSaleProductSet = SqlHelper.ExecuteDataset(conn, "sp_report_product_set", arrParm.ToArray()); conn.Close(); if (dsSaleProductSet.Tables.Count > 0) { if (dsSaleProductSet.Tables[0].Rows.Count > 0) { var row = (from t in dsSaleProductSet.Tables[0].AsEnumerable() select t).FirstOrDefault(); if (row != null) { data.product_set_id = Convert.IsDBNull(row["product_set_id"]) ? 0 : Convert.ToInt32(row["product_set_id"]); } } } } return(data); }
public static ProductSetList EditProduct(string id) { try { var productSetMapping = (List <ProductSetList>)HttpContext.Current.Session["SESSION_PART_MAPPING_SPARE_PART_SET"]; var productRow = new ProductSetList(); if (productSetMapping != null) { var row = (from t in productSetMapping where t.id == Convert.ToInt32(id) select t).FirstOrDefault(); if (row != null) { productRow = row; } } return(productRow); } catch (Exception ex) { throw ex; } }