private void showList(int page) { try { // calculate page this.currentPage = page; int listSize = new BuyerDao().count(); totalPage = (int)Math.Ceiling((double)listSize / (double)this.pageSize); if (totalPage == 0) { this.currentPage = 0; } pageLb.Content = string.Format("หน้า {0} จาก {1}", this.currentPage, this.totalPage); // เช็คการ enable ปุ่ม prev/next delete checkPagination(); // add item list //listView.ItemsSource = new BuyerDao().listView(page, this.pageSize); listView.ItemsSource = new BuyerDao().listView(page, this.pageSize, this.sortingProperty, this.sortingDirection); } catch (Exception ex) { new AlertBox(ex.Message).ShowDialog(); } }
private void init() { try { refList = new List <ReferenceObj>(); List <BuyerObj> buyerList = new BuyerDao().list(); nameCbb.DisplayMemberPath = "name"; nameCbb.ItemsSource = buyerList; seller = new SellerDao().select(); vatTb.Text = seller.vat.ToString("N"); //this.invoiceID = seller.running_prefix + seller.running_number; this.invoiceID = PREFIX + seller.inv_no; List <CauseCodeListObj> list = new CauseCodeListDao().list("ยกเลิกและออกใบกำกับภาษี ฉบับใหม่แทนฉบับเดิม"); purposeCbb.DisplayMemberPath = "description"; purposeCbb.SelectedValuePath = "code"; purposeCbb.ItemsSource = list; purposeCbb.SelectedIndex = 0; setProvinceList(); } catch (Exception ex) { new AlertBox(ex.Message).ShowDialog(); } }
private void init() { try { refList = new List <ReferenceObj>(); List <BuyerObj> buyerList = new BuyerDao().list(); nameCbb.DisplayMemberPath = "name"; nameCbb.ItemsSource = buyerList; seller = new SellerDao().select(); vatTb.Text = seller.vat.ToString("N"); this.invoiceID = PREFIX + seller.dbn_no; List <CauseCodeListObj> list = new CauseCodeListDao().list("ใบเพิ่มหนี้"); purposeCbb.DisplayMemberPath = "description"; purposeCbb.SelectedValuePath = "code"; purposeCbb.ItemsSource = list; purposeCbb.SelectedIndex = 0; otherPurposeTb.IsEnabled = false; setProvinceList(); is_main.IsChecked = true; taxIdType.SelectedIndex = 0; taxIdTypeControl(0); } catch (Exception ex) { new AlertBox(ex.Message).ShowDialog(); } }
private bool isChange() { if (this.id == 0) { return(nameTb.Text != "" || address1Tb.Text != "" || houseNoTb.Text != "" || zipcodeTb.Text != "" || taxIdTb.Text != "" || taxIdTb.Text != "" || is_branch.IsChecked != false || branchNoTb.Text != "" || emailTb.Text != "" || contactTb.Text != "" || phoneNoTb.Text != "" || phoneExtTb.Text != ""); } else { BuyerObj obj = new BuyerDao().select(this.id); bool chkBranchNo = false; if (is_branch.IsChecked.Value) { chkBranchNo = obj.branchId != branchNoTb.Text; } else { chkBranchNo = false; } return(nameTb.Text != obj.name || address1Tb.Text != obj.address1 || houseNoTb.Text != obj.houseNo || zipcodeTb.Text != obj.zipCode || taxIdTb.Text != obj.taxId || taxIdTb.Text != obj.taxId || obj.isBranch != is_branch.IsChecked || chkBranchNo || emailTb.Text != obj.email || contactTb.Text != obj.contactPerson || phoneNoTb.Text != obj.phoneNo || phoneExtTb.Text != obj.phoneExt); } }
/// <summary> /// 設定測試帳號 /// </summary> /// <param name="ID">員工編號P000000002或供應商帳號S000000001</param> void SetTestAccount(string ID) { ID = ID.Trim().ToUpper(); if (ID.StartsWith("P")) { BuyerDao bDao = new BuyerDao(); this.BuyerLoginAccount = bDao.FindBuyerByEmployeeID(ID); } else if (ID.StartsWith("S")) { SupplierAccountDao saDao = new SupplierAccountDao(); this.SupplierLoginAccount = saDao.FindSupplierAccountBySupplierAccountID(ID); } }
private void showData() { try { BuyerObj obj = new BuyerDao().select(this.id); taxIdType.SelectedIndex = getTaxTypeSchemaIndex(obj.taxType); nameTb.Text = obj.name; address1Tb.Text = obj.address1; houseNoTb.Text = obj.houseNo; zipcodeTb.Text = obj.zipCode; taxIdTb.Text = obj.taxId; if (obj.isBranch == true) { is_branch.IsChecked = true; branchNoTb.Text = obj.branchId; } if (obj.isBranch == false && obj.taxType == "TXID") { is_main.IsChecked = true; } emailTb.Text = obj.email; contactTb.Text = obj.contactPerson; phoneNoTb.Text = obj.phoneNo; phoneExtTb.Text = obj.phoneExt; if (obj.provinceCode != null && obj.provinceCode != "") { provinceCbb.SelectedValue = obj.provinceCode + "000000"; if (obj.districtCode != null && obj.districtCode != "") { districtCbb.SelectedValue = obj.districtCode + "0000"; if (obj.subdistrcitCode != null && obj.subdistrcitCode != "") { subDistrictCbb.SelectedValue = obj.subdistrcitCode + "00"; } } } } catch (Exception ex) { new AlertBox(ex.Message).ShowDialog(); } }
/// <summary> /// 驗證帳號密碼 /// </summary> /// <param name="id">帳號</param> /// <param name="password">密碼</param> /// <returns>使用者物件</returns> internal Buyer CheckPassword(string id, string password) { if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(password)) { return(null); } //查詢Buyer資料 BuyerDao dao = new BuyerDao(); Buyer buyer = dao.FindBuyerByEmployeeID(id); if (buyer == null) { return(null); } string hashPassword = Util.GetHash(password + buyer.PasswordSalt); if (hashPassword.Equals(buyer.PasswordHash)) { return(buyer); } return(null); }
public static bool AddToOrderDetail(string orderID, int goodsID, int goodsNumber) { int res = BuyerDao.AddToOrderDetail(orderID, goodsID, goodsNumber); return(res > 0); }
public static bool AddToCart(int goodsID, int shopID, int goodsNum, int userID) { int res = BuyerDao.AddToCart(goodsID, shopID, goodsNum, userID); return(res > 0); }
public static List <Evaluate> GetEvaluate(int goodsID) { List <Evaluate> lstEvaluate = BuyerDao.GetEvaluate(goodsID); return(lstEvaluate); }
public static List <CartDetail> GetCartGoods(int userID) { List <CartDetail> lstCart = BuyerDao.GetCartGoods(userID); return(lstCart); }
public static int GetCartGoodsNum(int userID) { int res = BuyerDao.GetCartGoodsNum(userID); return(res); }
public static bool AddToCollect(int userID, int collectID, string type) { int res = BuyerDao.AddToCollect(userID, collectID, type); return(res > 0); }
public Buyer GetBuyer() { BuyerDao dao = new BuyerDao(); return(dao.FindBuyerByEmployeeID(this.EmployeeID)); }
public static bool AddToOrder(int userID, int shopID, int orderID, double price, string orderState) { int res = BuyerDao.AddToOrder(userID, shopID, orderID, price, orderState); return(res > 0); }
public static List <IntroductionDetail> GetGoodsByID(int id) { List <IntroductionDetail> lstInt = BuyerDao.GetGoodsByID(id); return(lstInt); }
public static bool DeleteCartGoods(int cartID) { int res = BuyerDao.DeleteCartGoods(cartID); return(res > 0); }