private void 顯示產品資訊(CKGPart p_code, string p_str數量) { _lbl商品編號.Text = p_code.f_ProductID產品編號; _lbl商品名稱.Text = p_code.f_ProductName產品名稱; _lbl單位個數.Text = p_code.f_Qty單位; _lbl售價.Text = p_code.f_ListPrice售價.ToString(); _lbl產品成本價.Text = p_code.f_Cost成本價.ToString(); _lbl業代價.Text = p_code.f_SalePrice業代價.ToString(); CUser l_user = Session[SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA] as CUser; if (l_user == null) { Session.Remove(SealedGlobalPage.SESSIONKEY_LOGIN_USER_DATA); Response.Redirect("../FrmLogin.aspx"); } if (l_user.f_lvl等級 == 4) { _txt業代價.Text = p_code.f_ListPrice售價.ToString(); } else { _txt業代價.Text = p_code.f_SalePrice業代價.ToString(); } _txt數量.Text = p_str數量; }
protected void _btn新增_Click(object sender, EventArgs e) { try { if (使用者輸入()) { CKGPart l_part = _context.CFactoryManager.CKGPartFactory.createCKGPart(); l_part.f_TypeID類別編號 = _txt類別編號.Text.Trim(); l_part.f_TypeName類別名稱 = _txt類別名稱.Text.Trim(); l_part.f_CategoryID種類編號 = _txt種類編號.Text.Trim(); l_part.f_CategoryName種類名稱 = _txt種類名稱.Text.Trim(); l_part.f_ProductID產品編號 = _txt產品編號.Text.Trim(); l_part.f_ProductName產品名稱 = _txt產品名稱.Text.Trim(); l_part.f_Qty單位 = _txt單位.Text.Trim(); l_part.f_SalePrice業代價 = Convert.ToInt32(_txt業代價.Text.Trim()); l_part.f_ListPrice售價 = Convert.ToInt32(_txt售價.Text.Trim()); l_part.f_Cost成本價 = Convert.ToInt32(_txt成本.Text.Trim()); _context.CFactoryManager.CKGPartFactory.insertCKGPart(l_part); clearUI(); ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", "alert('新增成功');", true); } } catch { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, typeof(UpdatePanel), "OK", "alert('新增失敗!請檢察網路是否正常');", true); return; } }
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 把請購的資料加入DataTable() { string l_strSmid = _lblSmid.Text; CKGPart l_code產品資料 = (CKGPart)Session["CKGPart"]; DataTable l_table = (DataTable)Session[SealedGlobalPage.SESSIONKEY_KGPARTORDER_TEMPTABLE]; int l_int數量 = Convert.ToInt32(_txt數量.Text); string l_strProductID = l_code產品資料.f_ProductID產品編號; //先判別是否點選產品已經在l_table裡面,有的話直接加上數量 for (int i = 0; i < l_table.Rows.Count; i++) { if (l_strProductID.Equals(l_table.Rows[i]["產品編號"].ToString())) { //string l_str = "alert('提醒:所選擇的產品已在清單內,系統將直接加上數量')"; //ScriptManager.RegisterClientScriptBlock(UpdatePanel2, typeof(UpdatePanel), "OK", l_str, true); l_int數量 += Convert.ToInt32(l_table.Rows[i]["數量"].ToString()); l_table.Rows.RemoveAt(i); } } DataRow l_row = l_table.NewRow(); l_row["產品編號"] = l_code產品資料.f_ProductID產品編號; l_row["產品名稱"] = l_code產品資料.f_ProductName產品名稱; l_row["數量"] = l_int數量; l_row["單位"] = l_code產品資料.f_Qty單位; l_row["建議售價"] = l_code產品資料.f_ListPrice售價; int l_int業代價 = Convert.ToInt32(_lbl業代價.Text); int l_int販賣價 = Convert.ToInt32(_txt業代價.Text); l_row["業代價"] = l_int業代價.ToString(); l_row["販賣價"] = l_int販賣價.ToString(); int l_int總計 = 0; l_int總計 = l_int數量 * l_int業代價; l_row["成本"] = l_code產品資料.f_Cost成本價; l_row["總計"] = l_int總計; l_row["總販賣"] = l_int數量 * l_int販賣價; l_table.Rows.InsertAt(l_row, 0); 計算總金額(l_table); GridView1.DataSource = l_table; GridView1.DataBind(); }
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(); }
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查詢); }