private void TextBox_CardID_LostFocus(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(this.TextBox_CardID.Text))
     {
         return;
     }
     else
     {
         if (this.TextBox_CardID.Text.Length == 9)
         {
             if (IsNumber(this.TextBox_CardID.Text))
             {
                 if (CustomerDAO.Instance.CheckCardIDexist(this.TextBox_CardID.Text))
                 {
                     return;
                 }
                 else
                 {
                     MessageBoxCustom.setContent("Số CMND đã tồn tại. Vui lòng nhập lại").ShowDialog();
                     this.TextBox_CardID.Clear();
                     return;
                 }
             }
         }
         MessageBoxCustom.setContent("Số CMND chưa đúng, Vui lòng nhập lại").ShowDialog();
         this.TextBox_CardID.Clear();
     }
 }
        protected void GrdInvoiceSelection_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdInvoiceSelection_RowCommand";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Checks that the command name is return invoice
                if (e.CommandName == "returnInvoice")
                {
                    var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                    nameValues.Set("invoice", e.CommandArgument.ToString());
                    //Changes to Returns cart
                    Response.Redirect("ReturnsCart.aspx?" + nameValues, false);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void GrdCurrentOpenSales_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdCurrentOpenSales_RowCommand";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                //Still need to get the cust on the Invoice
                int index = ((GridViewRow)(((LinkButton)e.CommandSource).NamingContainer)).RowIndex;
                nameValues.Set("customer", ((Label)GrdCurrentOpenSales.Rows[index].Cells[11].FindControl("lblCustID")).Text);
                int invoiceID = Convert.ToInt32(e.CommandArgument);
                nameValues.Set("invoice", invoiceID.ToString());
                Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
                //Changes page to Sales Cart
                Response.Redirect("SalesCart.aspx?" + nameValues, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void DdlTax_SelectedIndexChanged(object sender, EventArgs e)
        {
            string method = "DdlTax_SelectedIndexChanged";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                List <Tax> taxes = TM.ReturnTaxListBasedOnDate(Convert.ToDateTime(lblCurrentDate.Text), Convert.ToInt32(DdlProvince.SelectedValue), objPageDetails);
                foreach (var tax in taxes)
                {
                    if (tax.intTaxID == Convert.ToInt32(DdlTax.SelectedValue))
                    {
                        lblCurrentDisplay.Text = tax.fltTaxRate.ToString("#0.00");
                    }
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string method = "Page_Load";

            Session["currPage"] = "TradeINEntry.aspx";
            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                CU = (CurrentUser)Session["currentUser"];
                if (!IsPostBack)
                {
                    invoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];

                    string[] inventoryInfo = ItM.CallReserveTradeInSKU(CU, objPageDetails);
                    inventoryID = Convert.ToInt32(inventoryInfo[1]);

                    lblSKUDisplay.Text  = inventoryInfo[0].ToString();
                    ddlBrand.DataSource = ItM.CallReturnDropDownForBrand(objPageDetails);
                    ddlBrand.DataBind();

                    ddlModel.DataSource = ItM.CallReturnDropDownForModel(objPageDetails);
                    ddlModel.DataBind();
                    ddlModel.SelectedValue = "2624"; //"2426"; // is the testing value for 'Customer Trade'
                }
            }
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //string prevPage = Convert.ToString(Session["prevPage"]);
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 6
0
        protected void GrdStats_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdStats_RowDataBound";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    pmPrice    += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltOverallPrice"));
                    pmCost     += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "fltOverallCost"));
                    pmQuantity += Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "intOverallQuantity"));
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    e.Row.Cells[3].Text = String.Format("{0:N0}", pmQuantity);
                    e.Row.Cells[4].Text = String.Format("{0:C}", pmCost / pmQuantity);
                    e.Row.Cells[5].Text = String.Format("{0:C}", pmPrice / pmQuantity);
                    e.Row.Cells[6].Text = String.Format("{0:C}", pmCost);
                    e.Row.Cells[7].Text = String.Format("{0:P2}", (pmPrice - pmCost) / pmPrice);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnEmployeeSearch_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnEmployeeSearch_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                GrdEmployeesSearched.Visible = true;
                //Binds the employee list to grid view
                GrdEmployeesSearched.DataSource = EM.CallReturnEmployeeBasedOnText(txtSearch.Text, objPageDetails);
                GrdEmployeesSearched.DataBind();
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 8
0
        protected void GrdCustomersSearched_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "GrdCustomersSearched_RowCommand";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice receipt = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"]), CU.location.intProvinceID, objPageDetails)[0];
                //grabs the command argument for the command pressed
                if (e.CommandName == "SwitchCustomer")
                {
                    //if command argument is SwitchCustomer, set the new key
                    receipt          = IM.CallReturnCurrentInvoice(receipt.intInvoiceID, CU.location.intProvinceID, objPageDetails)[0];
                    receipt.customer = CM.CallReturnCustomer(Convert.ToInt32(e.CommandArgument.ToString()), objPageDetails)[0];
                    IM.CallUpdateCurrentInvoice(receipt, objPageDetails);
                    var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                    nameValues.Set("customer", receipt.customer.intCustomerID.ToString());
                    nameValues.Set("receipt", receipt.intInvoiceID.ToString());
                    Response.Redirect(Request.Url.AbsolutePath + "?" + nameValues, false);
                }
                BtnCustomerSelect.Text = "Change Customer";
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 9
0
        //Currently used for cancelling the edit
        protected void OnRowCanceling(object sender, GridViewCancelEditEventArgs e)
        {
            //Collects current method for error tracking
            string method = "ORowCanceling";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice receipt = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"]), CU.location.intProvinceID, objPageDetails)[0];
                //Clears the indexed row
                grdPurchasedItems.EditIndex = -1;
                //Binds gridview to Session items in cart
                grdPurchasedItems.DataSource = receipt.invoiceItems;
                grdPurchasedItems.DataBind();
                //Recalcluate subtotal
                //lblPurchaseAmountDisplay.Text = "$ " + scm.returnPurchaseAmount((List<Cart>)Session["ItemsInCart"]).ToString("#0.00");
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 10
0
        //Displays the total cost of currently stocked inventory
        //only fixed download
        protected void BtnCostOfInventory_Click(object sender, EventArgs e)
        {
            //Collects current method and page for error tracking
            string method = "btnCostOfInventory_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                object[] reportLog = { 12, CU.employee.intEmployeeID, CU.location.intLocationID };
                R.CallReportLogger(reportLog, objPageDetails);
                Response.Redirect("ReportsCostOfInventory.aspx", false);
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //string prevPage = Convert.ToString(Session["prevPage"]);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
                //Server.Transfer(prevPage, false);
            }
        }
Exemplo n.º 11
0
        protected void BtnExportInvoices_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnExportInvoices_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                string     pathUser     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string     pathDownload = (pathUser + "\\Downloads\\");
                DateTime[] dtm          = GetDateRange();
                DateTime   startDate    = dtm[0];
                DateTime   endDate      = dtm[1];

                string   filename = "Invoices-" + startDate.ToString("dd.MM.yyyy") + " To " + endDate.ToString("dd.MM.yyyy") + ".xlsx";
                FileInfo newFile  = new FileInfo(pathDownload + filename);

                R.CallExportInvoiceDateRange(dtm, newFile, filename);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 12
0
        //Displays taxes charged
        protected void BtnTaxReport_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnTesting_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                object[] reportLog = { 3, CU.employee.intEmployeeID, CU.location.intLocationID };
                R.CallReportLogger(reportLog, objPageDetails);
                DateTime[] dtm       = GetDateRange();
                object[]   repInfo   = new object[] { dtm, Convert.ToInt32(ddlLocation.SelectedValue) };
                int        indicator = R.VerifyTaxesCharged(repInfo, objPageDetails);
                if (indicator == 0)
                {
                    Session["reportInfo"] = repInfo;
                    Response.Redirect("ReportsTaxes.aspx", false);
                }
                else if (indicator == 1)
                {
                    MessageBoxCustom.ShowMessage("Taxes have not been charged for selected dates.", this);
                }
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 13
0
 private void BtnSMoney_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(this.Money.Text))
     {
         MessageBoxCustom.setContent("Người dùng nhập thiếu dữ liệu").ShowDialog();
         return;
     }
     else
     {
         if (CollectBillDAO.Instance.CheckCollectMoney(long.Parse(this.Money.Text.ToString()), (this.Cb_TypePassbook.SelectedItem as TypePassbook).Typename))
         {
             MessageBoxCustom.setContent("Số tiên gởi không hợp lê").ShowDialog();
             Clearall();
             return;
         }
         if (CollectBillDAO.Instance.CheckCollectdate(this.DatePicker_Time.SelectedDate, int.Parse(Txt_PassbookID.Text.ToString())))
         {
             MessageBoxCustom.setContent("Chưa đến ngày đáo hạn sổ, Ngày đáo hạn là: " + (PassbookDAO.Instance.GetWithdrawday(int.Parse(this.Txt_PassbookID.Text.ToString()))).Value.ToString("dd/MM/yyyy")).ShowDialog();
             return;
         }
         CollectBill bill = new CollectBill
         {
             Id = 1.ToString().Trim(),
             Collect_passbook = int.Parse(Txt_PassbookID.Text),
             Collect_money    = long.Parse(Money.Text),
             Collectdate      = this.DatePicker_Time.SelectedDate ?? DateTime.Now
         };
         CollectBillDAO.Instance.InsertCollectBill(bill);
         MessageBoxCustom.setContent("Thêm phiếu gởi thành công").ShowDialog();
         Clearall();
     }
 }
Exemplo n.º 14
0
        private void Txt_CustomerID_LostFocus(object sender, RoutedEventArgs e)
        {
            int customerID;

            if (int.TryParse(this.Txt_CustomerID.Text, out customerID) == true)
            {
                customerID = int.Parse(this.Txt_CustomerID.Text);
                bool exist_ID = CustomerDAO.Instance.CheckExistID(customerID);
                if (exist_ID)
                {
                    this.TextBox_warning_1.Visibility = Visibility.Collapsed;
                    this.Txt_CustomerName.Text        = CustomerDAO.Instance.GetCustomerName(customerID);
                    this.Txt_CustomerCard.Text        = CustomerDAO.Instance.GetCustomerCardNumber(customerID);
                    this.Txt_CustomerAddress.Text     = CustomerDAO.Instance.GetCustomerAddress(customerID);
                    this.Money.Clear();
                    this.Txt_PassbookID.Clear();
                    this.Cb_TypePassbook.ItemsSource = null;
                    this.Cb_TypePassbook.Items.Clear();
                    this.Cb_TypePassbook.ItemsSource       = TypePassbookDAO.Instance.GetListTypeByCusID(customerID);
                    this.Cb_TypePassbook.DisplayMemberPath = "Typename";
                }
                else
                {
                    this.TextBox_warning_1.Visibility = Visibility.Visible;
                    MessageBoxCustom.setContent("Mã khách hàng này không tồn tại!").ShowDialog();
                    this.Txt_CustomerID.Clear();
                }
            }
        }
Exemplo n.º 15
0
        protected void OnRowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Collects current method for error tracking
            string method = "OnRowDeleting";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Retrieves index of selected row
                int receiptPaymentID   = Convert.ToInt32(((Label)gvCurrentMOPs.Rows[e.RowIndex].Cells[3].FindControl("lblTableID")).Text);
                InvoiceMOPsManager IMM = new InvoiceMOPsManager();
                IMM.CallRemoveMopFromPurchaseList(receiptPaymentID, Convert.ToInt32(Request.QueryString["receipt"]), objPageDetails);
                gvCurrentMOPs.EditIndex = -1;
                UpdatePageTotals();
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 16
0
        protected void UpdateReceiptTotal()
        {
            string method = "UpdateReceiptTotal";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                IM.CalculateNewReceiptTotalsToUpdate(IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"].ToString()), CU.location.intProvinceID, objPageDetails)[0], objPageDetails);
                Invoice receipt = IM.CallReturnCurrentPurchaseInvoice(Convert.ToInt32(Request.QueryString["receipt"].ToString()), CU.location.intProvinceID, objPageDetails)[0];
                grdPurchasedItems.DataSource = receipt.invoiceItems;
                grdPurchasedItems.DataBind();
                //Recalculates the new subtotal
                lblPurchaseAmountDisplay.Text = "$ " + receipt.fltSubTotal.ToString("#0.00");
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 17
0
        //Cheque
        protected void MopCheque_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "MopCheque_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Checks that string is not empty
                if (txtPurchaseAmount.Text != "")
                {
                    //Calls procedure to add it to a grid view
                    PopulateGridviewMOP(Convert.ToDouble(txtPurchaseAmount.Text), 8, Convert.ToInt32(txtChequeNumber.Text));
                    txtChequeNumber.Text = "0000";
                }
            }
            //Exception catch
            catch (ThreadAbortException) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void LbtnInvoiceNumber_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "LbtnInvoiceNumber_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Text of the linkbutton
                LinkButton btn     = sender as LinkButton;
                string     invoice = btn.Text;
                //Changes page to display a printable invoice
                Server.Transfer("PrintableInvoice.aspx?inv=" + invoice, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void GrdEmployeesSearched_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdEmployeesSearched_RowCommand";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Checks if the string is view profile
                if (e.CommandName == "ViewProfile")
                {
                    //Changes page to Employee Add New
                    Response.Redirect("EmployeeAddNew.aspx?employee=" + e.CommandArgument.ToString(), false);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        private void Update_Transaction(object sender, RoutedEventArgs e)
        {
            //cap nhat giao dich
            if (!string.IsNullOrEmpty(TextBox_SavingBookID.Text.Trim()))
            {
                string idBill = TextBox_SavingBookID.Text.Trim();

                if (CollectBillDAO.Instance.CheckIfExistBillID(idBill) == true)
                {
                    //update
                }
                else if (WithdrawBillDAO.Instance.CheckIfExistBillID(idBill) == true)
                {
                    //update
                }
            }
            //cap nhat khach hang
            if (!string.IsNullOrEmpty(this.TextBox_CustomerID.Text.Trim()))
            {
                try
                {
                    Customer cus = new Customer
                    {
                        Id          = int.Parse(this.TextBox_CustomerID.Text),
                        Cus_name    = this.TextBox_CustomerName.Text.Trim(),
                        Cmnd        = this.TextBox_CustomerIDcard.Text.Trim(),
                        Cus_address = this.TextBox_CustomerAddress.Text.Trim()
                    };
                    CustomerDAO.Instance.UpdateCustomer(cus);
                    MessageBoxCustom.setContent("Sửa thông tin khách hàng thành công").ShowDialog();
                }
                catch { MessageBoxCustom.setContent("Trùng số CMND hoặc số CMND quá 9 kí tự").ShowDialog(); }
            }
        }
        protected void BtnExportAccessories_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnExportAccessories_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Sets path and file name to save the export to
                string   pathUser     = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
                string   pathDownload = (pathUser + "\\Downloads\\");
                string   filename     = "AllAccessories - " + DateTime.Now.ToString("dd.MM.yyyy") + ".xlsx";
                FileInfo newFile      = new FileInfo(pathDownload + filename);
                //With the craeted file do all intenal code
                R.CallItemExports("accessories", newFile, filename, objPageDetails);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 22
0
        protected void PopulateGridview(List <InvoiceItems> list)
        {
            string method = "populateGridview";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                GrdInventorySearched.Visible = true;
                //Binds returned items to gridview for display
                GrdInventorySearched.DataSource = list;
                GrdInventorySearched.DataBind();
                //grdInventorySearched.PageIndex = 0;
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 23
0
        private void BtnPrint_Click(object sender, RoutedEventArgs e)
        {
            string name = "Bill" + WithdrawBillDAO.Instance.GetLastBillID() + ".png";

            CaptureUIElement.Instance.SaveFrameworkElementToPng(Panel_Bill, (int)Panel_Bill.ActualWidth, (int)Panel_Bill.ActualHeight, name);
            MessageBoxCustom.setContent("phiếu lưu tại: " + System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)).ShowDialog();
        }
Exemplo n.º 24
0
        protected void UpdateButtonText(string[] headers)
        {
            string method = "UpdateButtonText";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                (GrdInventorySearched.HeaderRow.FindControl("btnSKU") as Button).Text         = headers[0];
                (GrdInventorySearched.HeaderRow.FindControl("btnDescription") as Button).Text = headers[1];
                (GrdInventorySearched.HeaderRow.FindControl("btnStore") as Button).Text       = headers[2];
                (GrdInventorySearched.HeaderRow.FindControl("btnQuantity") as Button).Text    = headers[3];
                (GrdInventorySearched.HeaderRow.FindControl("btnPrice") as Button).Text       = headers[4];
                (GrdInventorySearched.HeaderRow.FindControl("btnCost") as Button).Text        = headers[5];
                (GrdInventorySearched.HeaderRow.FindControl("btnComments") as Button).Text    = headers[6];
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 25
0
        //Clearing the entered amounts
        protected void BtnClear_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnClear_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Blanking the textboxes
                txtCash.Text       = "0.00";
                txtDebit.Text      = "0.00";
                txtGiftCard.Text   = "0.00";
                txtMasterCard.Text = "0.00";
                txtTradeIn.Text    = "0.00";
                txtVisa.Text       = "0.00";
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnProceedToReturnCheckout_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnProceedToCheckout_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice returnInvoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];
                if (returnInvoice.invoiceItems.Count > 0)
//                if (IIM.CheckForItemsInTransaction(returnInvoice))
                {
                    lblInvalidQty.Visible = false;
                    //Changes page to the returns checkout page
                    var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                    nameValues.Set("invoice", returnInvoice.intInvoiceID.ToString());
                    Response.Redirect("ReturnsCheckout.aspx?" + nameValues, false);
                }
                else
                {
                    MessageBoxCustom.ShowMessage("There are no items on this transaction.", this);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
Exemplo n.º 27
0
        protected void GrdTradeInsByDate_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            string method = "GrdTradeInsByDate_RowDataBound";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                if (e.Row.RowType == DataControlRowType.DataRow)
                {
                    tradeInDollars += Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "totalTradeIns"));
                }
                else if (e.Row.RowType == DataControlRowType.Footer)
                {
                    e.Row.Cells[1].Text = String.Format("{0:C}", tradeInDollars);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]), method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnCancelReturn_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "BtnCancelSale_Click";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                Invoice returnInvoice = IM.CallReturnCurrentInvoice(Convert.ToInt32(Request.QueryString["invoice"]), CU.location.intProvinceID, objPageDetails)[0];
                lblInvalidQty.Visible = false;
                IIM.LoopThroughTheItemsToReturnToInventory(returnInvoice.intInvoiceID, returnInvoice.dtmInvoiceDate, CU.location.intProvinceID, objPageDetails);
                IIM.CallRemoveInitialTotalsForTable(returnInvoice.intInvoiceID, objPageDetails);
                Response.Redirect("HomePage.aspx", false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void BtnQuickSale_Click(object sender, EventArgs e)
        {
            //Collects current method for error tracking
            string method = "btnQuickSale_Click";

            //object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                var nameValues = HttpUtility.ParseQueryString(Request.QueryString.ToString());
                nameValues.Set("customer", "1");
                string invoice = "-10";
                nameValues.Set("invoice", invoice);
                //Changes page to Sales Cart
                Response.Redirect("SalesCart.aspx?" + nameValues, false);
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }
        protected void GrdInvoiceSelection_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //Collects current method for error tracking
            string method = "GrdInvoiceSelection_RowCommand";

            object[] objPageDetails = { Session["currPage"].ToString(), method };
            try
            {
                //Sets the string of the command argument(invoice number
                int            invoiceID = Convert.ToInt32(e.CommandArgument.ToString());
                InvoiceManager IM        = new InvoiceManager();
                if (IM.InvoiceIsReturn(invoiceID, objPageDetails))
                {
                    //Changes page to display a printable invoice
                    Response.Redirect("PrintableInvoiceReturn.aspx?invoice=" + invoiceID.ToString(), false);
                }
                else
                {
                    //Changes page to display a printable invoice
                    Response.Redirect("PrintableInvoice.aspx?invoice=" + invoiceID.ToString(), false);
                }
            }
            //Exception catch
            catch (ThreadAbortException tae) { }
            catch (Exception ex)
            {
                //Log all info into error table
                ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this);
                //Display message box
                MessageBoxCustom.ShowMessage("An Error has occurred and been logged. "
                                             + "If you continue to receive this message please contact "
                                             + "your system administrator.", this);
            }
        }