protected void BtnFinish_Click(object sender, EventArgs e)
        {
            ViewState["S_Name"] = txtSupplier_Name.Text;
            SupplierCheque supplierCheque = new SupplierCheque();

            supplierCheque.SupplierName = txtSupplier_Name.Text;
            supplierCheque.Notes        = txtNotes.Text;
            supplierCheque.DueDate      = Convert.ToDateTime(DueDate.Text);
            supplierCheque.Value        = Convert.ToDecimal(txtboxChequeValue.Text);
            supplierCheque.PaidOff      = false;
            supplierCheque.ChequeNumber = txtChequeNumber.Text;
            supplierCheque.AlertBefore  = Convert.ToInt32(txtboxAlertBefore.Text);
            if (!supplierCheque.Create())
            {
                lblFinishMsg.Text      = "هناك مشكلة في الحفظ برجاء اعادة المحاولة";
                lblFinishMsg.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                lblFinishMsg.Text      = "تم بنجاح";
                lblFinishMsg.ForeColor = System.Drawing.Color.Green;
                txtSupplier_Name.Text  = string.Empty;
                txtNotes.Text          = string.Empty;
                txtboxChequeValue.Text = string.Empty;
                txtChequeNumber.Text   = string.Empty;
                DueDate.Text           = string.Empty;
                RefreshChequeNotifications();
            }
        }
 protected void ImageButtonSearch_Click(object sender, ImageClickEventArgs e)
 {
     if (TextBoxSearch.Visible)
     {
         SupplierCheque SupplierCheque = new SupplierCheque();
         SupplierCheque.SupplierName = TextBoxSearch.Text;
         if (string.IsNullOrWhiteSpace(TextBoxSearch.Text))
         {
             PanelSupplierCheques.Visible = false;
             PanelErrorMessage.Visible    = true;
         }
         else
         {
             PanelSupplierCheques.Visible                   = true;
             PanelErrorMessage.Visible                      = false;
             PanelPaidSupplierCheques.Visible               = false;
             PanelUnPaidSupplierCheques.Visible             = false;
             PanelUpcomingPayableSupplierCheques.Visible    = true;
             lnkBtnPaidSupplierCheques.ForeColor            = System.Drawing.Color.Black;
             lnkBtnUnpaidSupplierCheques.ForeColor          = System.Drawing.Color.Black;
             lnkBtnUpcomingPayableSupplierCheques.ForeColor = System.Drawing.Color.White;
             GridViewPaidSupplierCheques.PageIndex          = 0;
         }
     }
 }
        protected void ImageButtonConfirmEdit_Click(object sender, ImageClickEventArgs e)
        {
            int            row_index       = ((GridViewRow)((ImageButton)sender).NamingContainer).RowIndex;
            GridView       SupplierCheques = (GridView)((GridViewRow)((ImageButton)sender).NamingContainer).NamingContainer;
            SupplierCheque SupplierCheque  = new SupplierCheque();
            int            Id = (int)GridViewUnPaidSupplierCheques.DataKeys[row_index].Value;

            if (!SupplierCheque.Update_UnPaidSupplierCheques_By_Id(Id))
            {
                lblFinishMsg.Text      = "هناك مشكلة في التحديث برجاء اعادة المحاولة";
                lblFinishMsg.ForeColor = System.Drawing.Color.Red;
            }
            else
            {
                lblFinishMsg.Text      = "تم بنجاح";
                lblFinishMsg.ForeColor = System.Drawing.Color.Green;
                GridViewPaidSupplierCheques.DataBind();
                GridViewUnPaidSupplierCheques.DataBind();
                GridViewUpcomingPayableSupplierCheques.DataBind();
            }
        }
Exemplo n.º 4
0
        public void UpdateChequeMenuItemsNotifications()
        {
            var supplierChequesCount = Session["SupplierChequesCount"] != null
                                        ? Convert.ToInt32(Session["SupplierChequesCount"])
                                        : SupplierCheque.GetUpcomingPayableSupplierChequesCount();

            var clientChequesCount = Session["ClientChequesCount"] != null
            ? Convert.ToInt32(Session["ClientChequesCount"])
            : ClientCheque.GetUpcomingPayableClientChequesCount();

            var total = supplierChequesCount + clientChequesCount;

            if (total > 0)
            {
                var chequesMenuItem = BarMenu.FindItem("Cheques");
                chequesMenuItem.Text = chequesMenuItem.Text.Substring(0, chequesMenuItem.Text.IndexOf("<span") > 0
                    ? chequesMenuItem.Text.IndexOf("<span")
                    : chequesMenuItem.Text.Length) + "<span class='dot'>" + total + "</span>";
            }

            if (clientChequesCount > 0)
            {
                var clientChequesMenuItem = BarMenu.FindItem("Cheques/ClientCheques");
                clientChequesMenuItem.Text = clientChequesMenuItem.Text.Substring(0, clientChequesMenuItem.Text.IndexOf("<span") > 0
                ? clientChequesMenuItem.Text.IndexOf("<span")
                : clientChequesMenuItem.Text.Length) + "<span class='dot'>" + clientChequesCount + "</span>";
            }

            if (supplierChequesCount > 0)
            {
                var supplierChequesMenuItem = BarMenu.FindItem("Cheques/SupplierCheques");
                supplierChequesMenuItem.Text = supplierChequesMenuItem.Text.Substring(0, supplierChequesMenuItem.Text.IndexOf("<span") > 0
                    ? supplierChequesMenuItem.Text.IndexOf("<span")
                    : supplierChequesMenuItem.Text.Length) + "<span class='dot'>" + supplierChequesCount + "</span>";
            }
        }
 private void RefreshChequeNotifications()
 {
     Session["SupplierChequesCount"] = SupplierCheque.GetUpcomingPayableSupplierChequesCount();
     ((Master)Master).UpdateChequeMenuItemsNotifications();
 }