Exemplo n.º 1
0
        /// <summary>
        /// 驗證帳號密碼
        /// </summary>
        /// <param name="id">帳號</param>
        /// <param name="password">密碼</param>
        /// <returns>使用者物件</returns>
        internal Model.SupplierAccount CheckPassword(string id, string password)
        {
            if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(password))
            {
                return(null);
            }

            //查詢SupplierAccount資料
            SupplierAccountDao dao = new SupplierAccountDao();

            Model.SupplierAccount supplier = dao.FindSupplierAccountBySupplierAccountID(id);

            if (supplier == null)
            {
                return(null);
            }

            string hashPassword = Util.GetHash(password + supplier.PasswordSalt);

            if (hashPassword.Equals(supplier.PasswordHash))
            {
                return(supplier);
            }
            return(null);
        }
Exemplo n.º 2
0
 /// <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);
     }
 }
Exemplo n.º 3
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (dtpDateRequired.Value < DateTime.Now)
            {
                MessageBox.Show("請輸入大於本日的日期");
                return;
            }

            if (MessageBox.Show("您確定要將訂單送出嗎?\n確認無誤後,系統會產生訂單編號,請填寫收貨人資訊", "訂單確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                //Order
                OrderDao    dao = new OrderDao();
                Model.Order o   = new Model.Order();
                o.PurchasingOrderID = PurchasingOrderID;
                o.SupplierCode      = this.SupplierCode;
                SupplierAccountDao saDao = new SupplierAccountDao();
                o.SupplierAccountID = saDao.FindSupplierAccountBySupplierCode(o.SupplierCode).SupplierAccountID;
                o.EmployeeID        = Common.ContainerForm.BuyerLoginAccount.EmployeeID;
                o.DateRequired      = this.dtpDateRequired.Value;

                //OrderChanged
                Model.OrderChanged oc = new Model.OrderChanged();
                oc.OrderChangedCategoryCode = "N";
                oc.RequestDate   = DateTime.Now;
                oc.RequesterRole = "P";
                oc.RequesterID   = o.EmployeeID;

                //OrderPartList
                List <Model.OrderPart> opList = new List <Model.OrderPart>();
                foreach (DataRow dr in this.PodData.Rows)
                {
                    Model.OrderPart op = new Model.OrderPart();
                    op.PartNumber   = dr["料件編號"].ToString();
                    op.PartName     = dr["料件品名"].ToString();
                    op.PartSpec     = dr["PartSpec"].ToString();
                    op.PartUnitName = dr["PartUnitName"].ToString();
                    op.UnitPrice    = Convert.ToInt32(dr["批量單價"]);
                    opList.Add(op);
                }

                //SourceOrderList
                List <Model.SourceOrderList> soList = new List <Model.SourceOrderList>();
                foreach (DataRow dr in this.PodData.Rows)
                {
                    Model.SourceOrderList sol = new Model.SourceOrderList();
                    sol.Batch    = Convert.ToInt32(dr["批量"]);
                    sol.Discount = Convert.ToDecimal(dr["Discount"]);
                    sol.Qty      = Convert.ToInt32(dr["採購數量"]);
                    sol.PurchasingOrderDetailListOID = Convert.ToInt32(dr["採購單明細識別碼"]);
                    soList.Add(sol);
                }

                string OrderID = dao.InsertNewOrder(o, oc, opList, soList);

                if (string.IsNullOrEmpty(OrderID))
                {
                    MessageBox.Show("訂單新增失敗");
                    return;
                }

                SendOrderForm frm = new SendOrderForm(OrderID);
                Common.ContainerForm.NextForm(frm);
            }
        }