protected void btnVoid_Click(object sender, EventArgs e)
        {
            try
            {
                if (ConfirmationLetterService.HasInvoiceOrPayment(txtConfirmationLetterNo.Text))
                {
                    WebFormHelper.SetLabelTextWithCssClass(lblStatus,
                                                           String.Format("Confirmation Letter {0} has active either invoice or payment. Please void invoice and payment first.", txtConfirmationLetterNo.Text),
                                                           LabelStyleNames.ErrorMessage);
                    return;
                }

                ConfirmationLetterService.VoidConfirmationLetter(txtConfirmationLetterNo.Text, txtReason.Text);

                WebFormHelper.SetLabelTextWithCssClass(lblStatus,
                                                       String.Format("Confirmation Letter {0} has been marked as void.", txtConfirmationLetterNo.Text),
                                                       LabelStyleNames.InfoMessage);

                btnVoid.Enabled    = btnCancel.Enabled = false;
                txtReason.Enabled  = false;
                btnRefresh.Enabled = false;
                hypCLRef.Visible   = false;
            }
            catch (Exception ex)
            {
                WebFormHelper.SetLabelTextWithCssClass(lblStatus, ex.InnerException.Message, LabelStyleNames.ErrorMessage);
            }
        }
        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            Page.Validate("Search");
            if (Page.IsValid)
            {
                var letter = ConfirmationLetterService.GetConfirmationLetter(txtConfirmationLetterNo.Text);
                if (letter == null)
                {
                    WebFormHelper.SetLabelTextWithCssClass(lblStatus,
                                                           String.Format("Cannot find Confirmation Letter {0}", txtConfirmationLetterNo.Text),
                                                           LabelStyleNames.ErrorMessage);
                    return;
                }
                else
                {
                    if (letter.VoidDate.HasValue)
                    {
                        WebFormHelper.SetLabelTextWithCssClass(lblStatus,
                                                               String.Format("Confirmation Letter {0} has been marked as void.",
                                                                             txtConfirmationLetterNo.Text),
                                                               LabelStyleNames.ErrorMessage);
                        return;
                    }
                }

                txtConfirmationLetterNo.ReadOnly = true;
                ConfirmationLetterDetail1.LoadConfirmationLetter(txtConfirmationLetterNo.Text);
                pnlReceiveDate.Visible = true;
                txtReason.Focus();
            }
        }
        protected void sdsMaster_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
        {
            var letter = ConfirmationLetterService.GetConfirmationLetter(Convert.ToInt32(Request["LetterID"]));

            e.Command.Parameters["@Customer"].Value     = txtFindName.Text;
            e.Command.Parameters["@CustomerType"].Value = ddlFindCustomerType.SelectedValue;
            e.Command.Parameters["@Gender"].Value       = ddlFindGender.SelectedValue;
            e.Command.Parameters["@LetterNo"].Value     = letter.LetterNo;
        }
Ejemplo n.º 4
0
 protected void RadGridParticipants_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName == "DeleteParticipant")
     {
         string customerCode = Convert.ToString(e.CommandArgument);
         ConfirmationLetterService.RemoveParticipant(RowID, customerCode);
         RadGridParticipants.DataBind();
     }
 }
Ejemplo n.º 5
0
 protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
 {
     if (e.CommandName == "EditRow")
     {
         mvwForm.SetActiveView(viwAddEdit);
         RowID             = Convert.ToInt32(e.CommandArgument);
         hidLetterID.Value = Convert.ToString(RowID);
         var letter = ConfirmationLetterService.GetConfirmationLetter(RowID);
         ViewState["LetterNo"] = letter.LetterNo;
         ConfirmationLetterDetail1.LoadConfirmationLetter(letter.LetterNo);
         FillDropDown();
     }
 }
        protected void btnSelect_Click(object sender, EventArgs e)
        {
            //Session["Participants"] = "test";
            int[] customerIDs = RadHelper.GetRowIdForDeletion(RadGrid1);

            Array.ForEach(customerIDs,
                          customerID =>
            {
                int letterID = Convert.ToInt32(Request["LetterID"]);
                ConfirmationLetterService.AddParticipant(letterID, customerID);
            });

            string script = "window.opener.document.getElementById('" + Request["Refresh"] + "').click(); window.close();";

            ClientScript.RegisterStartupScript(this.GetType(), "select", script, true);
        }
Ejemplo n.º 7
0
        protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                mvwForm.SetActiveView(viwAddEdit);
                FillDropDown();
                RowID = Convert.ToInt32(e.CommandArgument);

                var letter    = ConfirmationLetterService.GetConfirmationLetter(RowID);
                var customer  = letter.Customer;
                var refLetter = letter.ConfirmationLetter2;

                lblConfirmationLetterNo.Text    = letter.LetterNo;
                cboAccountManager.SelectedValue = letter.AccountManagerID.ToString();
                txtCustomerName.Text            = customer.Name;
                hidCustomerCode.Value           = customer.Code;
                txtTrainingLocation.Text        = letter.TrainingLocation;
                txtDescription.Text             = letter.Description;
                ddlClassType.SelectedValue      = letter.ClassTypeID.ToString();
                ddlTopic.SelectedValue          = letter.TopicID.ToString();
                txtCLRef.Text                  = refLetter == null ? String.Empty : refLetter.LetterNo;
                ntbPrice.Value                 = Convert.ToDouble(letter.Price);
                ntbTax.Value                   = Convert.ToDouble(letter.Tax);
                ntbPPH.Value                   = Convert.ToDouble(letter.PPH);
                ntbDiscount.Value              = Convert.ToDouble(letter.Discount);
                ntbTotalPrice.Value            = Convert.ToDouble(letter.TotalPrice);
                ddlBank.SelectedValue          = Convert.ToString(letter.TransferToBankID.GetValueOrDefault());
                dtpPaymentDueDate.SelectedDate = letter.PaymentDueDate;
                ntbTotalParticipants.Value     = letter.TotalParticipants;
                letter.Modules.ForEach(module => cblModule.Items.Cast <ListItem>().SingleOrDefault(item => item.Value == module.ID.ToString(CultureInfo.InvariantCulture)).Selected = true);

                hypCLRef.Attributes.Add("onclick", "window.open('PromptConfirmationLetter.aspx?CLNo=ctl00_cphMainContent_txtCLRef&CurrentCLNo=" + letter.LetterNo + "', null, 550, 1000);");

                cboAccountManager.Focus();

                if (letter.VoidDate.HasValue)
                {
                    btnSave.Enabled = false;
                    WebFormHelper.SetLabelTextWithCssClass(lblStatusAddEdit, "This letter has been marked as void", LabelStyleNames.ErrorMessage);
                }

                TrainingDates = ConfirmationLetterService.GetTrainingDates(RowID).Select(date => date.Date).ToList();
                LoadTrainingDates();
                //txtName.Focus();
            }
        }
Ejemplo n.º 8
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate(WebFormHelper.AddEditValidationGroup);

            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                if (TrainingDates.Count == 0)
                {
                    WebFormHelper.SetLabelTextWithCssClass(lblStatusAddEdit, "One or more Training Date must be specified", LabelStyleNames.ErrorMessage);
                    return;
                }
                ConfirmationLetterService.AddOrUpdateConfirmationLetter(RowID, DateTime.Today,
                                                                        Convert.ToInt32(cboAccountManager.SelectedValue),
                                                                        hidCustomerCode.Value,
                                                                        TrainingDates,
                                                                        txtTrainingLocation.Text,
                                                                        txtDescription.Text,
                                                                        Convert.ToInt32(ddlClassType.SelectedValue),
                                                                        Convert.ToInt32(ddlTopic.SelectedValue),
                                                                        Convert.ToDecimal(ntbPrice.Value.GetValueOrDefault()),
                                                                        Convert.ToDecimal(ntbTax.Value.GetValueOrDefault()),
                                                                        Convert.ToDecimal(ntbPPH.Value.GetValueOrDefault()),
                                                                        Convert.ToDecimal(ntbDiscount.Value.GetValueOrDefault()),
                                                                        Convert.ToInt32(ddlBank.SelectedValue),
                                                                        dtpPaymentDueDate.SelectedDate.GetValueOrDefault(),
                                                                        txtCLRef.Text,
                                                                        Convert.ToInt32(ntbTotalParticipants.Value),
                                                                        cblModule.Items.Cast <ListItem>().Where(item => item.Selected).Select(item => Convert.ToInt32(item.Value)).ToArray()
                                                                        );
                btnCancel_Click(sender, e);
            }
            catch (Exception ex)
            {
                WebFormHelper.SetLabelTextWithCssClass(lblStatusAddEdit, ex.Message, LabelStyleNames.ErrorMessage);
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ConfirmationLetterService.ReceiveConfirmationLetter(txtConfirmationLetterNo.Text,
                                                                    dtpReceiveDate.SelectedDate.GetValueOrDefault(DateTime.Today));

                WebFormHelper.SetLabelTextWithCssClass(lblStatus,
                                                       String.Format("Confirmation Letter {0} has been received.", txtConfirmationLetterNo.Text),
                                                       LabelStyleNames.InfoMessage);

                btnSave.Enabled        = btnCancel.Enabled = false;
                dtpReceiveDate.Enabled = false;
                btnRefresh.Enabled     = false;
                dtpReceiveDate.DataBind();
            }
            catch (Exception ex)
            {
                WebFormHelper.SetLabelTextWithCssClass(lblStatus, ex.InnerException.Message, LabelStyleNames.ErrorMessage);
            }
        }