private void get下拉式選單內容(string p_str) { CKGPartFactory l_factory = _context.CFactoryManager.CKGPartFactory; CKGPart[] l_codes = null; ListBox l_lbx = new ListBox(); if ("get種類ListBox".Equals(p_str)) { l_codes = l_factory.get種類By類別(_lbx類別名稱.SelectedValue); for (int i = 0; i < l_codes.Length; i++) { _lbx種類名稱.Items.Add(new ListItem(l_codes[i].f_CategoryID種類編號 + " > " + l_codes[i].f_CategoryName種類名稱, l_codes[i].f_CategoryID種類編號)); } _lbx百貨商品.Items.Clear(); } else if ("get百貨ListBox".Equals(p_str)) { string l_str廠商 = _rbl廠商.SelectedValue; if ("".Equals(l_str廠商)) { iv_lblErrorMsg.Text = "請先挑選廠商"; return; } CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser; if (l_user.f_lvl等級 == 4) { l_codes = l_factory.get百貨商品By種類(_lbx種類名稱.SelectedValue, l_str廠商); } else { l_codes = l_factory.get百貨商品By種類By營業所(_lbx種類名稱.SelectedValue, l_str廠商); } if (l_codes != null) { _lbx百貨商品.Enabled = true; for (int i = 0; i < l_codes.Length; i++) { _lbx百貨商品.Items.Add(new ListItem(l_codes[i].f_ProductID產品編號 + " > " + l_codes[i].f_ProductName產品名稱, l_codes[i].f_ProductID產品編號)); } } else { _lbx百貨商品.Items.Add(new ListItem("無產品")); _lbx百貨商品.Enabled = false; } } else { _lbx類別名稱.Items.Clear(); l_codes = l_factory.getCKGPart所有類別不含洗車(); for (int i = 0; i < l_codes.Length; i++) { _lbx類別名稱.Items.Add(new ListItem(l_codes[i].f_TypeID類別編號 + " > " + l_codes[i].f_TypeName類別名稱, l_codes[i].f_TypeID類別編號)); } } }
protected void _lbx百貨商品_SelectedIndexChanged(object sender, EventArgs e) { CKGPartFactory l_factory = _context.CFactoryManager.CKGPartFactory; CKGPart l_code = l_factory.get百貨商品ByProductID(_lbx百貨商品.SelectedValue); Session.Add("CKGPart", l_code); 顯示產品資訊(l_code, "1"); }
private void 顯示資訊(string p_strId) { CKGPartFactory l_factory = iv_context.CFactoryManager.CKGPartFactory; CKGPart l_code = l_factory.getCKGPartById(p_strId); iv_txt類別編號.Text = l_code.f_TypeID類別編號; iv_txt類別名稱.Text = l_code.f_TypeName類別名稱; iv_txt種類編號.Text = l_code.f_CategoryID種類編號; iv_txt種類名稱.Text = l_code.f_CategoryName種類名稱; iv_txt產品編號.Text = l_code.f_ProductID產品編號; iv_txt產品名稱.Text = l_code.f_ProductName產品名稱; iv_txt產品單位.Text = l_code.f_Qty單位; iv_txt成本價.Text = l_code.f_Cost成本價.ToString(); iv_txt業代價.Text = l_code.f_SalePrice業代價.ToString(); iv_txt建議售價.Text = l_code.f_ListPrice售價.ToString(); }
protected void iv_cbo類別名稱_SelectedIndexChanged(object sender, EventArgs e) { CKGPartFactory l_factory = _context.CFactoryManager.CKGPartFactory; CKGPart[] l_codes = l_factory.get種類By類別(iv_cbo類別名稱.SelectedValue); iv_cbo種類名稱.Items.Clear(); iv_cbo種類名稱.Items.Insert(0, ""); if (l_codes != null) { for (int i = 0; i < l_codes.Length; i++) { iv_cbo種類名稱.Items.Add(new ListItem(l_codes[i].f_CategoryID種類編號 + " " + l_codes[i].f_CategoryName種類名稱, l_codes[i].f_CategoryID種類編號)); } } }
private void 修改產品檔(string p_strId) { CKGPartFactory l_factory = iv_context.CFactoryManager.CKGPartFactory; CKGPart l_code產品檔 = l_factory.createCKGPart(); l_code產品檔.f_id = Convert.ToInt32(p_strId); l_code產品檔.f_ProductName產品名稱 = iv_txt產品名稱.Text.Trim(); l_code產品檔.f_Qty單位 = iv_txt產品單位.Text.Trim(); l_code產品檔.f_Cost成本價 = Convert.ToInt32("0" + iv_txt成本價.Text.Trim()); l_code產品檔.f_SalePrice業代價 = Convert.ToInt32("0" + iv_txt業代價.Text.Trim()); l_code產品檔.f_ListPrice售價 = Convert.ToInt32("0" + iv_txt建議售價.Text.Trim()); l_factory.updateCKGPart單位and價位(l_code產品檔); string l_strShow = "alert('修改成功');"; ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", l_strShow, true); }
private void 查詢資料(string p_strType) { CKGPartFactory l_factory = _context.CFactoryManager.CKGPartFactory; CKGPart l_code產品檔 = l_factory.createCKGPart(); l_code產品檔.f_TypeID類別編號 = iv_cbo類別名稱.SelectedValue; l_code產品檔.f_CategoryID種類編號 = iv_cbo種類名稱.SelectedValue; l_code產品檔.f_ProductID產品編號 = iv_txt產品編號.Text.Trim(); l_code產品檔.f_ProductName產品名稱 = iv_txt產品名稱.Text.Trim(); CKGPart[] l_codes查詢 = l_factory.get產品By查詢(l_code產品檔); if ("按查詢".Equals(p_strType) && l_codes查詢 == null) { GridView1.DataSource = null; GridView1.DataBind(); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", "alert('查無資料');", true); return; } display(l_codes查詢); }