public void BindData_skuupc(string I_sku) { SkuLabelDAO skusearch = new SkuLabelDAO(); DataSet dataSet_skuupc = skusearch.SkuSearch(I_sku); RadGrid1.DataSource = dataSet_skuupc.Tables[0]; }
public void BindData_skudtl(string I_sku, Int32 I_area, string I_load) { SkuLabelDAO skusearch = new SkuLabelDAO(); DataSet dataSet_skudtl = skusearch.SkudetailsSearch(I_sku, I_area, I_load); RadGrid2.DataSource = dataSet_skudtl.Tables[0]; }
private void Getdropdown() { SkuLabelDAO skudao = new SkuLabelDAO(); DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds = skudao.Get_trolley_dropdown(); dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { string item_code_str = row["trolley_id"].ToString(); string item_desc = row["trolley_label"].ToString(); DD_trolley.Items.Insert(0, new ListItem(item_desc, item_code_str)); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // first time TBbarcode.Visible = false; TBSku.Visible = false; Lbdropdown.Visible = false; DDSkunumber.Visible = false; LBresult.Visible = false; TBbarcode.Text = string.Empty; TBSku.Text = string.Empty; } if (IsPostBack) { // subsequently // call database to load the drop down string skubarcode = null; string skuno = null; string printstatus = null; SkuLabelDAO skunum = new SkuLabelDAO(); LBresult.Text = string.Empty; LBresult.Visible = false; if (RBBarcode.Checked) { SetFocus(TBbarcode); } else if (RBSku.Checked) { SetFocus(TBSku); } try { if (RBBarcode.Checked) { if (TBbarcode.Text.ToString().Length > 0) { skubarcode = TBbarcode.Text.ToString(); if (skubarcode.Length > 0) { DataSet ds = skunum.Search_sku(skubarcode); DataTable dt = ds.Tables[0]; List <string> skus = new List <string>(); foreach (DataRow row in dt.Rows) { skus.Add(row["skunum"].ToString()); } if (skus.Count > 0) { if (skus.Count == 1) { // initiate print printstatus = Print(Int32.Parse(skus[0])); LBresult.Visible = true; LBresult.Text = "Success"; LBresult.ForeColor = Color.Blue; } } else { LBresult.Visible = true; LBresult.Text = "Error: SKU not found"; LBresult.ForeColor = Color.Red; } TBbarcode.Text = string.Empty; } } } else if (RBSku.Checked) { if (TBSku.Text.ToString().Length > 0) { skuno = TBSku.Text.ToString(); DataSet ds1 = skunum.Get_sku_details(skuno); DataTable dt1 = ds1.Tables[0]; List <string> skualias = new List <string>(); foreach (DataRow row in dt1.Rows) { skualias.Add(row["skualias"].ToString()); } if (skualias.Count > 0) { if (skualias.Count == 1) { // initiate print printstatus = Print(Int32.Parse(skuno)); LBresult.Visible = true; LBresult.Text = "Success"; LBresult.ForeColor = Color.Blue; } else { foreach (DataRow row in dt1.Rows) { DDSkunumber.Items.Add(row["skualias"].ToString()); DDSkunumber.Visible = true; Lbdropdown.Visible = true; } } } else { LBresult.Visible = true; LBresult.Text = "Error: SKU not found"; LBresult.ForeColor = Color.Red; } TBSku.Text = string.Empty; } } } catch (Exception ex) { LBresult.Visible = true; LBresult.Text = "Error: " + ex.Message; LBresult.ForeColor = Color.Red; } } }
protected void Page_Load(object sender, EventArgs e) { Initialise(); if (!IsPostBack) { SkuLabelDAO skudao = new SkuLabelDAO(); DataSet areaCodesDs = new DataSet(); DataTable areaCodesDt = new DataTable(); areaCodesDs = skudao.Get_area_dropdown(); areaCodesDt = areaCodesDs.Tables[0]; foreach (DataRow row in areaCodesDt.Rows) { string areaCodeStr = row["area_id"].ToString(); string areaDesc = row["area_descr"].ToString(); DD_area.Items.Insert(0, new ListItem(areaDesc, areaCodeStr)); } // restore session values if they exist if (Session["skuid"] != null) { skuid = (string)Session["skuid"]; TB_sku.Text = skuid; } if (Session["loadid"] != null) { loadid = (string)Session["loadid"]; TB_load.Text = loadid; } if (Session["areaid"] != null) { areaid = (Int32)Session["areaid"]; string area_id = areaid.ToString(); if (areaid == 0) { area_id = String.Empty; } DD_area.SelectedValue = area_id; } } else { try { if (TB_sku.Text != "") { skuid = TB_sku.Text.ToString(); string area_id = DD_area.SelectedItem.Value; //Int32 item_code = 0; if (area_id != string.Empty) { areaid = Int32.Parse(area_id); } loadid = TB_load.Text.ToString(); this.BindData_skuupc(skuid); this.BindData_skudtl(skuid, areaid, loadid); // TB_sku.Text = string.Empty; // TB_load.Text = string.Empty; } else { Label4.Text = "Enter Sku or Scan SKU UPC"; Label4.ForeColor = Color.Red; } } catch (Exception Ex) { Label4.Text = "Error Fetching Records"; Label4.ForeColor = Color.Red; } } }
protected void Button1_Click(object sender, EventArgs e) { string loadnum = null; string chute_id = null; string trolley_id = null; string printstatus = null; SkuLabelDAO skudao = new SkuLabelDAO(); LBresult.Text = string.Empty; LBresult.Visible = false; if (RBChute.Checked) { SetFocus(TBChute); } else if (RBLoad.Checked) { SetFocus(TBLoad); } try { if (RBLoad.Checked) { if (TBLoad.Text.ToString().Length > 0) { loadnum = TBLoad.Text.ToString(); if (loadnum.Length > 0) { DataSet ds = skudao.SkuForLoad(loadnum); if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { LBresult.Visible = true; LBresult.Text = "Error: SKUs not found for Load: " + loadnum; LBresult.ForeColor = Color.Red; } else { DataTable dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { string sku_id_str = (row["sku"].ToString()); printstatus = Print(Int32.Parse(sku_id_str)); } LBresult.Visible = true; LBresult.Text = "SKU Labels sent to printer"; LBresult.ForeColor = Color.Blue; } TBLoad.Text = string.Empty; } } } else if (RBChute.Checked) { if (TBChute.Text.ToString().Length > 0) { chute_id = TBChute.Text.ToString(); if (chute_id.Length > 0) { DataSet ds = skudao.SkuForChute(Int32.Parse(chute_id)); if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { LBresult.Visible = true; LBresult.Text = "Error: SKUs not found for Chute: " + chute_id; LBresult.ForeColor = Color.Red; } else { DataTable dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { string sku_id_str = (row["sku"].ToString()); printstatus = Print(Int32.Parse(sku_id_str)); } LBresult.Visible = true; LBresult.Text = "SKU Labels sent to printer"; LBresult.ForeColor = Color.Blue; } TBChute.Text = string.Empty; } } } //else if trolley else if (RBTrolley.Checked) { trolley_id = DD_trolley.SelectedValue.ToString(); if (trolley_id.Length > 0) { DataSet ds = skudao.SkuFortrolley(Int32.Parse(trolley_id)); if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0) { LBresult.Visible = true; LBresult.Text = "Error: SKUs not found for Load: " + trolley_id; LBresult.ForeColor = Color.Red; } else { DataTable dt = ds.Tables[0]; foreach (DataRow row in dt.Rows) { string sku_id_str = (row["sku"].ToString()); printstatus = Print(Int32.Parse(sku_id_str)); } LBresult.Visible = true; LBresult.Text = "SKU Labels sent to printer"; LBresult.ForeColor = Color.Blue; } } } } catch (Exception ex) { LBresult.Visible = true; LBresult.Text = "Error: " + ex.Message; LBresult.ForeColor = Color.Red; } }