Exemplo n.º 1
0
    protected void btnSendMail_Click(object sender, EventArgs e)
    {
        if (!Page.IsValid)
        {
            return;
        }
        try
        {
            IncentiveBusiness b       = new IncentiveBusiness();
            EmailDetails      details = new EmailDetails();
            SendMailObject    obj     = new SendMailObject();
            details.FromEmail = ConfigurationManager.AppSettings["FromAddress"].ToString();
            string finance_emailid = Session["emailId"].ToString();

            string employeeid  = Session["MemberId"].ToString();
            string referenceid = Session["referenceid"].ToString();
            string toemail     = txtTo.Text;
            string ccmail      = txtCC.Text;
            details.ToEmail = toemail.ToString();
            details.CCEmail = ccmail.ToString();
            details.Type    = referenceid;
            details.Id      = "";
            details.Module  = Session["transctiontype"].ToString();

            string FooterText = ConfigurationManager.AppSettings["FooterText"].ToString();
            details.EmailSubject = txtSubject.Text;
            details.MsgBody      = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"> <br>" +
                                   "<b> '" + txtMsgContent.Text + "' <br> " +
                                   "<br>" + "<br>" + "<br>" + "<br>" + FooterText +
                                   " </b><br><b> </b></span>";

            bool resultv = obj.InsertIntoEmailQueue(details);
            if (resultv == true)
            {
                bool flag = b.UpdateUtilizationMailFlag(employeeid, referenceid, Session["transctiontype"].ToString());
                Gridview.DataBind();
                Gridview.Visible      = true;
                PanelSendMail.Visible = false;
                txtTo.Text            = "";
                txtCC.Text            = "";
                txtSubject.Text       = "";
                txtMsgContent.Text    = "";
                string CloseWindow1 = "alert('Mail Sent successfully')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            }
            else
            {
                PanelSendMail.Visible = true;
                string CloseWindow1 = "alert('Problem while sending mail')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            }
        }


        catch (Exception ex)
        {
            log.Error(ex.StackTrace);
            log.Error(ex.Message);
        }
    }
Exemplo n.º 2
0
    private void SendMail()
    {
        EmailDetails details = new EmailDetails();

        try
        {
            bool resultv = false;

            IncentiveBusiness b   = new IncentiveBusiness();
            SendMailObject    obj = new SendMailObject();

            string memberid = txtMemberId.Text.Trim();
            string emailid  = b.SelectAuthorEmailId(memberid);
            string point    = txtPointsAwarded.Text;
            string year     = DdlYear.SelectedValue;

            details.FromEmail = ConfigurationManager.AppSettings["FromAddress"].ToString();

            details.ToEmail      = emailid;
            details.Module       = "APA";
            details.EmailSubject = "Additional Point Award";
            details.Type         = "";
            details.Id           = "";
            string FooterText = ConfigurationManager.AppSettings["FooterText"].ToString();
            details.MsgBody = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"><h4>Dear Sir/Madam,</h4> <br>" +
                              "<p>An additional incentive point for the year '" + year + "' is awarded '" + point + "' for more than 6 publication.</p>" + "<br>" + "<br>" + FooterText +
                              " </b><br><b> </b></span>";


            resultv = obj.InsertIntoEmailQueue(details);



            if (resultv == true)
            {
                string CloseWindow1 = "alert('Mail Sent successfully')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);

                btnSave.Enabled = false;
            }
            else
            {
                string CloseWindow1 = "alert('Problem while sending mail')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);

                btnSave.Enabled = false;
            }
        }
        catch (Exception ex)
        {
            string CloseWindow1 = "alert('Problem while sending mail')";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            log.Error(ex.Message);
            log.Error(ex.StackTrace);

            btnSave.Enabled = false;
        }
    }
Exemplo n.º 3
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (!Page.IsValid)
     {
         return;
     }
     try
     {
         obj.MemberId        = txtboxMemberId.Text.Trim();
         obj.CurrentBalance  = Convert.ToDouble(txtcurbal.Text.Trim());
         obj.TotalPoint      = Convert.ToDouble(txtadjustment.Text.Trim());
         obj.Remarks         = txtRemarks.Text.Trim();
         obj.CurrentBalance  = obj.CurrentBalance + Convert.ToDouble(obj.TotalPoint);
         obj.TransactionType = "ADJ";
         if (obj.TotalPoint > 0)
         {
             obj.NumberType = "Added";
         }
         else
         {
             obj.NumberType = "Removed";
         }
         bool result1 = B.UpdateCurBal(obj); //Business layer
         if (result1 == true)
         {
             string CloseWindow1 = "alert('Incentive Point Saved successfully')";
             //ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
             btnUpdate.Enabled = false;
             EmailDetails details = new EmailDetails();
             details = SendMail(txtboxMemberId.Text, txtcurbal.Text, txtadjustment.Text, txtRemarks.Text, obj.CurrentBalance, obj.NumberType);
             SendMailObject obj1    = new SendMailObject();
             bool           resultv = obj1.InsertIntoEmailQueue(details);
         }
         else
         {
             string CloseWindow1 = "alert('Incentive Point Saved successfully')";
             ScriptManager.RegisterStartupScript(EditUpdatePanel, EditUpdatePanel.GetType(), "alert", CloseWindow1, true);
             btnUpdate.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         log.Error(ex.StackTrace);
         log.Error(ex.Message);
         ClientScript.RegisterStartupScript(Page.GetType(), "validation1", "<script language='javascript'>alert('Error!!!!!!!!!!')</script>");
     }
 }
    private void SendMail()
    {
        EmailDetails      details = new EmailDetails();
        IncentiveBusiness b       = new IncentiveBusiness();

        SendMailObject obj = new SendMailObject();
        Business       e   = new Business();

        try
        {
            bool   resultv  = false;
            int    rowIndex = 0;
            string emailid  = null;
            details.Module = "IPE";
            string AuthorName = null;
            string Isstudent  = null;
            details.EmailSubject = "Incentive Point Adjustment";
            string empcode = txtboxMemberId.Text;
            string type    = e.selectMemberType(empcode, txtReferenceId.Text);
            if (type == "M")
            {
                //Isstudent = "N";
                emailid               = b.SelectAuthorEmailId(empcode);
                AuthorName            = b.SelectAuthorName(empcode);
                Session["AuthorName"] = AuthorName;
                if (emailid == "")
                {
                    int result;
                    //string AuthorName;
                    AuthorName = b.SelectAuthorName(empcode);
                    result     = e.insertEmailtrackerIncentive(AuthorName, details, txtReferenceId.Text);
                }
            }
            else
            {
                //Isstudent = "S";
                emailid               = b.SelectStudentEmailId(empcode, txtReferenceId.Text);
                AuthorName            = b.SelectStudentAuthorName(empcode, txtReferenceId.Text);
                Session["AuthorName"] = AuthorName;
                if (emailid == "")
                {
                    int result;

                    AuthorName = b.SelectStudentAuthorName(empcode, txtReferenceId.Text);
                    result     = e.insertEmailtrackerIncentive(AuthorName, details, txtReferenceId.Text);
                    //Session["AuthorName"] = AuthorName;
                }
            }

            details.FromEmail = ConfigurationManager.AppSettings["FromAddress"].ToString();

            if (emailid != "")
            {
                details.ToEmail = emailid;
            }
            string hremailid = b.SelectHRMailID(empcode, type, txtReferenceId.Text);

            string InstWiseHRMailid = b.SelectInstwiseHRMailid(empcode, type, txtReferenceId.Text);
            if (details.ToEmail != null && details.ToEmail != "")
            {
                if (InstWiseHRMailid != null)
                {
                    if (InstWiseHRMailid != "")
                    {
                        if (details.ToEmail != null)
                        {
                            details.ToEmail = details.ToEmail + "," + InstWiseHRMailid;
                        }
                        else
                        {
                            details.ToEmail = InstWiseHRMailid;
                        }
                    }
                    else
                    {
                        // details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    // details.ToEmail = details.ToEmail;
                }
            }
            else
            {
                if (InstWiseHRMailid != null)
                {
                    if (InstWiseHRMailid != "")
                    {
                        if (details.ToEmail != null)
                        {
                            details.ToEmail = InstWiseHRMailid;
                        }
                        else
                        {
                            details.ToEmail = InstWiseHRMailid;
                        }
                    }
                    else
                    {
                        // details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    // details.ToEmail = details.ToEmail;
                }
            }
            ArrayList list = new ArrayList();
            list = b.SelectHODMailid(empcode, type, txtReferenceId.Text);
            for (int j = 0; j < list.Count; j++)
            {
                if (j == 0)
                {
                    if (list[j].ToString() != "")
                    {
                        details.HODmailid = list[j].ToString();
                    }
                }
                else
                {
                    if (list[j].ToString() != "")
                    {
                        details.HODmailid = details.HODmailid + ',' + list[j].ToString();
                    }
                }
            }
            if (details.ToEmail != null && details.ToEmail != "")
            {
                if (hremailid != null)
                {
                    if (hremailid != "")
                    {
                        details.ToEmail = details.ToEmail + "," + hremailid;
                    }
                    else
                    {
                        // details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    // details.ToEmail = details.ToEmail;
                }
            }
            else
            {
                if (hremailid != null)
                {
                    if (hremailid != "")
                    {
                        details.ToEmail = hremailid;
                    }
                    else
                    {
                        // details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    // details.ToEmail = details.ToEmail;
                }
            }
            if (details.ToEmail != null && details.ToEmail != "")
            {
                if (details.HODmailid != null)
                {
                    if (details.HODmailid != "")
                    {
                        details.ToEmail = details.ToEmail + "," + details.HODmailid;
                        //details.ToEmail = details.ToEmail + "," + hremailid + "," + details.HODmailid;
                    }
                    else
                    {
                        //details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    //details.ToEmail = details.ToEmail;
                }
            }
            else
            {
                if (details.HODmailid != null)
                {
                    if (details.HODmailid != "")
                    {
                        details.ToEmail = details.HODmailid;
                        //details.ToEmail = details.ToEmail + "," + hremailid + "," + details.HODmailid;
                    }
                    else
                    {
                        //details.ToEmail = details.ToEmail;
                    }
                }
                else
                {
                    //details.ToEmail = details.ToEmail;
                }
            }
            // details.CCEmail = hremailid;
            // details.CCEmail = Session["emailId"].ToString();
            details.Module       = "IPE";
            details.EmailSubject = "Incentive Point Adjustment";
            //details.Type = DropDownListPublicationEntry.SelectedValue;
            details.Id = txtReferenceId.Text;
            string FooterText = ConfigurationManager.AppSettings["FooterText"].ToString();
            string isStudent  = Session["IsStudent"].ToString();

            if (isStudent == "Y")
            {
                if (type == "S")
                {
                    details.MsgBody = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"><h4>Dear Sir/Madam,</h4> <br>" +
                                      "<p>For Certificate of Appreciation and encashment of research incentive points, request you to contact student research section of your institution/department along with the Bank detail form available in RMS Portal.</p>" + "<b>Incentive points with the rating  : " + txtTotalPoint.Text + "" + Session["Numbertype"].ToString() + "<br>" +
                                      "<br>" +
                                      "Author Name : " + Session["AuthorName"].ToString() + "<br>" +
                                      "Publication Id : " + txtReferenceId.Text + "<br>" +
                                      "Article Name :" + Session["Title"].ToString() + "<br>" + "<br>" + FooterText +
                                      " </b><br><b> </b></span>";
                }
                else
                {
                    details.MsgBody = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"><h4>Dear Sir/Madam,</h4> <br>" +
                                      //"<b> Incentive points with the rating '" + total.Text + "' added. <br> " +
                                      "<b>Incentive points with the rating  : " + txtTotalPoint.Text + " " + Session["Numbertype"].ToString() + "<br>" +
                                      "<br>" +
                                      "Author Name : " + Session["AuthorName"].ToString() + "<br>" +
                                      "Publication Id : " + txtReferenceId.Text + "<br>" +
                                      "Article Name :" + Session["Title"].ToString() + "<br>" + "<br>" + FooterText +
                                      " </b><br><b> </b></span>";
                }
            }

            else
            {
                if (type == "S")
                {
                    details.MsgBody = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"><h4>Dear Sir/Madam,</h4> <br>" +
                                      "<p>For encashment of research incentive points, request you to contact student research section of your institution/department along with the Bank detail form available in RMS Portal.</p>" + "<b>Incentive points with the rating  : " + txtTotalPoint.Text + " " + Session["Numbertype"].ToString() + "<br>" +
                                      //"<b> Incentive points with the rating '" + total.Text + "' added. <br> " +
                                      "<br>" +
                                      "Author Name : " + Session["AuthorName"].ToString() + "<br>" +
                                      "Publication Id : " + txtReferenceId.Text + "<br>" +
                                      "Article Name :" + Session["Title"].ToString() + "<br>" + "<br>" + FooterText +
                                      " </b><br><b> </b></span>";
                }
                else
                {
                    details.MsgBody = "<span style=\"font-size: 10pt; color: #3300cc; font-family: Verdana\"><h4>Dear Sir/Madam,</h4> <br>" +
                                      //"<b> Incentive points with the rating '" + total.Text + "' added. <br> " +
                                      "<b>Incentive points with the rating  : " + txtTotalPoint.Text + " " + Session["Numbertype"].ToString() + "<br>" +
                                      "<br>" +
                                      "Author Name : " + Session["AuthorName"].ToString() + "<br>" +
                                      "Publication Id : " + txtReferenceId.Text + "<br>" +
                                      "Article Name :" + Session["Title"].ToString() + "<br>" + "<br>" + FooterText +
                                      " </b><br><b> </b></span>";
                }
            }

            if (details.ToEmail != "" && details.ToEmail != null)
            {
                resultv = obj.InsertIntoEmailQueue(details);
            }
            IncentiveData     obj3 = new IncentiveData();
            IncentiveBusiness C    = new IncentiveBusiness();


            if (emailid == "")
            {
                string AuthorName1 = Session["AuthorName"].ToString();
                obj3 = C.CheckUniqueIdIncentive(txtReferenceId.Text, "JA", details);
                int data = C.updateEmailtrackerIncentive(txtReferenceId.Text, "JA", details, obj3, AuthorName1);
            }

            if (resultv == true)
            {
                string CloseWindow1 = "alert('Mail Sent successfully')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            }
            else
            {
                string CloseWindow1 = "alert('Problem while sending mail')";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            }
        }


        catch (Exception ex)
        {
            string CloseWindow1 = "alert('Problem while sending mail')";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "newWindow", CloseWindow1, true);
            log.Error(ex.Message);
            log.Error(ex.StackTrace);
        }
    }