コード例 #1
0
ファイル: Buyer.xaml.cs プロジェクト: donchayut/e-TaxInvoice
        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();
            }
        }
コード例 #2
0
        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();
            }
        }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
 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);
     }
 }
コード例 #5
0
ファイル: MainForm.cs プロジェクト: s780609/PMSWinForm
 /// <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);
     }
 }
コード例 #6
0
 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();
     }
 }
コード例 #7
0
        /// <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);
        }
コード例 #8
0
        public static bool AddToOrderDetail(string orderID, int goodsID, int goodsNumber)
        {
            int res = BuyerDao.AddToOrderDetail(orderID, goodsID, goodsNumber);

            return(res > 0);
        }
コード例 #9
0
        public static bool AddToCart(int goodsID, int shopID, int goodsNum, int userID)
        {
            int res = BuyerDao.AddToCart(goodsID, shopID, goodsNum, userID);

            return(res > 0);
        }
コード例 #10
0
        public static List <Evaluate> GetEvaluate(int goodsID)
        {
            List <Evaluate> lstEvaluate = BuyerDao.GetEvaluate(goodsID);

            return(lstEvaluate);
        }
コード例 #11
0
        public static List <CartDetail> GetCartGoods(int userID)
        {
            List <CartDetail> lstCart = BuyerDao.GetCartGoods(userID);

            return(lstCart);
        }
コード例 #12
0
        public static int GetCartGoodsNum(int userID)
        {
            int res = BuyerDao.GetCartGoodsNum(userID);

            return(res);
        }
コード例 #13
0
        public static bool AddToCollect(int userID, int collectID, string type)
        {
            int res = BuyerDao.AddToCollect(userID, collectID, type);

            return(res > 0);
        }
コード例 #14
0
        public Buyer GetBuyer()
        {
            BuyerDao dao = new BuyerDao();

            return(dao.FindBuyerByEmployeeID(this.EmployeeID));
        }
コード例 #15
0
        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);
        }
コード例 #16
0
        public static List <IntroductionDetail> GetGoodsByID(int id)
        {
            List <IntroductionDetail> lstInt = BuyerDao.GetGoodsByID(id);

            return(lstInt);
        }
コード例 #17
0
        public static bool DeleteCartGoods(int cartID)
        {
            int res = BuyerDao.DeleteCartGoods(cartID);

            return(res > 0);
        }