protected void btnGenerate_Click(object sender, EventArgs e)
    {
        try
        {
            for (var i = 0; i < lbSygmaCenterNo.Items.Count; i++)
            {
                string centerValue;
                if (lbSygmaCenterNo.Items[0].Value == "0" && lbSygmaCenterNo.Items[0].Selected && i < (lbSygmaCenterNo.Items.Count - 1))
                {
                    centerValue = lbSygmaCenterNo.Items[i + 1].Value;
                    GetSelectedCenters(centerValue);
                }
                else if (lbSygmaCenterNo.Items[i].Selected)
                {
                    centerValue = lbSygmaCenterNo.Items[i].Value;
                    GetSelectedCenters(centerValue);
                }
            }

            var reportHasRecords = BuildExcelReport("7", Convert.ToDateTime(txtStartDate.Text), Convert.ToDateTime(txtEndDate.Text),
                                                    SygmaCenterNo); // 7 – Report Id, Startdate, Enddate
            if (!reportHasRecords)
            {
                Javascript.Notify("No Records available for the selected input!!!");
            }
        }
        catch (ThreadAbortException) { }
        catch (Exception exp)
        {
            throw new Exception("Error generating report", exp);
        }
    }
Пример #2
0
    protected override void LoadATMPage()
    {
        if (IsPostBack)
        {
            return;
        }

        var dsCenter = ATMDB.GetDataSet("up_p_getFormCriteria", UserName);

        ddSygmaCenterNo.DataSource = dsCenter.Tables[2].DefaultView;
        ddSygmaCenterNo.DataBind();

        if (dsCenter.Tables[2].Rows.Count > 0)
        {
            var ds = ATMDB.GetDataSet("up_p_getweekending", dsCenter.Tables[2].Rows[0][0].ToString());


            var dt = new DataTable();
            dt.Columns.Add("FiscalWeekending");
            dt.Columns.Add("FieldValue");
            var count = ds.Tables[0].Rows.Count;

            if (count != 0)
            {
                for (var i = 0; i < count; i++)
                {
                    dt.Rows.Add();
                    dt.Rows[i][0] = Convert.ToDateTime(ds.Tables[0].Rows[i][0]).ToShortDateString();
                    dt.Rows[i][1] = Convert.ToDateTime(ds.Tables[0].Rows[i][1]).ToShortDateString();
                }
            }

            ddlWeekending.DataSource = dt;
            ddlWeekending.DataBind();
            btnSend.Enabled = dt.Rows.Count > 0;

            ds.Clear();
        }
        if (Session["AdpSuccess"] == null)
        {
            return;
        }

        if (Convert.ToBoolean(Session["AdpSuccess"].ToString()))
        {
            Javascript.Notify("ADP report has been sent to ADP successfully");
        }

        Session.Remove("AdpSuccess");
    }
 protected void btnGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         var reportHasRecords = BuildExcelReport("15", txtEmplID.Text);
         if (!reportHasRecords)
         {
             Javascript.Notify("No Records available for the selected input!!!");
         }
     }
     catch (ThreadAbortException) { }
     catch (Exception exp)
     {
         throw new Exception("Error generating Employee's points history report", exp);
     }
 }
Пример #4
0
 protected void btnGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         if (tcWeeklyQuaterly.ActiveTab.Equals(tabWeekly) == true)
         {
             List <string> selectedReasonCodesList = new List <string>();
             foreach (ListItem item in lbWkyReasonCodes.Items)
             {
                 if (item.Selected)
                 {
                     selectedReasonCodesList.Add(item.Value);
                 }
             }
             string strSelectedReasonCodes = string.Join(",", selectedReasonCodesList.ToArray());
             var    reportHasRecords       = BuildExcelReport("13", Convert.ToDateTime(txtWkyStartDate.Text),
                                                              Convert.ToDateTime(txtWkyEndDate.Text), ddSygmaCenterNo.SelectedValue, strSelectedReasonCodes);
             if (!reportHasRecords)
             {
                 Javascript.Notify("No Records available for the selected input!!!");
             }
         }
         else if (tcWeeklyQuaterly.ActiveTab.Equals(tabQuaterly) == true)
         {
             List <string> selectedQReasonCodesList = new List <string>();
             foreach (ListItem item in lbQtyReasonCodes.Items)
             {
                 if (item.Selected)
                 {
                     selectedQReasonCodesList.Add(item.Value);
                 }
             }
             string strQSelectedReasonCodes = string.Join(",", selectedQReasonCodesList.ToArray());
             var    reportHasRecords        = BuildExcelReport("13", Convert.ToDateTime(txtQtystartDate.Text),
                                                               Convert.ToDateTime(txtQtyEndDate.Text), ddSygmaCenterNo.SelectedValue, strQSelectedReasonCodes);
             if (!reportHasRecords)
             {
                 Javascript.Notify("No Records available for the selected input!!!");
             }
         }
     }
     catch (ThreadAbortException) { }
     catch (Exception exp)
     {
         throw new Exception("Error generating report", exp);
     }
 }
 protected void btnGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         var reportHasRecords = BuildExcelReport("13", Convert.ToDateTime(txtStartDate.Text),
                                                 Convert.ToDateTime(txtEndDate.Text), ddSygmaCenterNo.SelectedValue, cbValid.Checked);
         if (!reportHasRecords)
         {
             Javascript.Notify("No Records available for the selected input!!!");
         }
     }
     catch (ThreadAbortException) { }
     catch (Exception exp)
     {
         throw new Exception("Error generating report", exp);
     }
 }
Пример #6
0
    /// <summary>
    /// Method for emailing the ADP report
    /// </summary>
    private void sendEmail()
    {
        try
        {
            var from      = AppSettings.GetAppSetting("adp", "emails", "from");
            var dsEmail   = ATMDB.GetDataSet("up_p_getAdpToEmail", ddSygmaCenterNo.SelectedValue);
            var toEmail   = dsEmail.Tables[0].Rows[0][0].ToString();
            var subject   = "ADP Report - Center" + ddSygmaCenterNo.SelectedValue;
            var bccEmails = AppSettings.GetAppSetting("ADP", "emails", "bcc");

            var body = new StringBuilder();
            body.AppendFormat("Attached is the Sygma ADP Report {0}", Environment.NewLine);
            body.AppendFormat("Center: {0} ({1}) {2}", ddSygmaCenterNo.SelectedItem, ddSygmaCenterNo.SelectedValue,
                              Environment.NewLine);
            body.AppendFormat("Weekending Date: {0} {1}", ddlWeekending.SelectedItem, Environment.NewLine);

            Email.AddEmails(_email.To, toEmail);
            _email.From = new MailAddress(from);
            if (bccEmails != string.Empty)
            {
                Email.AddEmails(_email.Bcc, bccEmails);
            }

            _email.Priority   = MailPriority.High;
            _email.Subject    = subject;
            _email.IsBodyHtml = false;
            _email.Body       = body.ToString();
            buildCSVs();

            Email.Send(_email);
            ATMDB.GetDataSet("up_p_addAdpLog", Convert.ToInt32(ddSygmaCenterNo.SelectedValue),
                             Convert.ToDateTime(ddlWeekending.SelectedItem.ToString()), UserName);
            Session["AdpSuccess"] = true;

            Javascript.Notify("ADP report has been sent to ADP successfully");
        }
        catch (Exception exp)
        {
            throw new Exception("Error Sending ADP Report", exp);
        }
    }
        protected void btnGenerate_Click(object sender, EventArgs e)
        {
            try
            {
                for (var i = 0; i < lbSygmaCenterNo.Items.Count; i++)
                {
                    string centerValue;
                    if (lbSygmaCenterNo.Items[0].Value == "0" &&
                        lbSygmaCenterNo.Items[0].Selected &&
                        i < (lbSygmaCenterNo.Items.Count - 1))
                    {
                        centerValue = lbSygmaCenterNo.Items[i + 1].Value;
                        GetSelectedCenters(centerValue);
                    }
                    else if (lbSygmaCenterNo.Items[i].Selected)
                    {
                        centerValue = lbSygmaCenterNo.Items[i].Value;
                        GetSelectedCenters(centerValue);
                    }
                }

                var employeeStatusSubmitValue = (ddlEmployeeStatus.SelectedValue == "2") ? "0,1" : ddlEmployeeStatus.SelectedValue.ToString();

                //Get the FunctionId value for all pages
                var selectedPageIds = RetrievePageNamesSelectedValues();

                var reportHasRecords = BuildExcelReport("14", SygmaCenterNo,
                                                        employeeStatusSubmitValue, selectedPageIds); // Report Id, CenterNumber, EmployeeStatus, FunctionId
                if (!reportHasRecords)
                {
                    Javascript.Notify("No Records available for the selected input!!!");
                }
            }
            catch (ThreadAbortException) { }
            catch (Exception exp)
            {
                throw new Exception("Error generating report", exp);
            }
        }
Пример #8
0
    public void RegisterValidationSummaryMessageBox(ValidationSummary vs)
    {
        System.Reflection.FieldInfo fi = typeof(Page).GetField("_validated", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
        if (fi != null)
        {
            if ((bool)fi.GetValue(Page))
            {
                if (!Page.IsValid)
                {
                    if (vs.ShowMessageBox)
                    {
                        System.Text.StringBuilder sb = new System.Text.StringBuilder(vs.HeaderText);
                        string sep = " ";
                        switch (vs.DisplayMode)
                        {
                        case ValidationSummaryDisplayMode.BulletList:
                            sep = "\\n-";
                            break;

                        case ValidationSummaryDisplayMode.List:
                            sep = "\\n";
                            break;
                        }
                        foreach (IValidator val in Validators)
                        {
                            if (!val.IsValid)
                            {
                                sb.Append(sep);
                                sb.Append(val.ErrorMessage.Replace("\'", "\\'"));
                            }
                        }
                        Javascript.Notify(sb.ToString(), true);
                    }
                }
            }
        }
    }
 protected void btnGenerate_Click(object sender, EventArgs e)
 {
     try
     {
         //if (Convert.ToInt32(ddReportFormat.SelectedValue) == 1)
         //{
         var reportHasRecords = BuildExcelReport("14", Convert.ToDateTime(txtStartDate.Text),
                                                 Convert.ToDateTime(txtEndDate.Text), txtEmplID.Text);
         if (!reportHasRecords)
         {
             Javascript.Notify("No Records available for the selected input!!!");
         }
         //}
         //else if (Convert.ToInt32(ddReportFormat.SelectedValue) == 2)
         //{
         //    Javascript.Notify("No Screen Records implemented!!!");
         //}
     }
     catch (ThreadAbortException) { }
     catch (Exception exp)
     {
         throw new Exception("Error generating Employee's individual points report", exp);
     }
 }