Esempio n. 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                objUserplantype = new Userplantype();
                lstUserplantype = new List <Userplantype>();

                if (Request.QueryString["PlantypId"] != null)
                {
                    objUserplantype = new Userplantype();
                    lstUserplantype = new List <Userplantype>();
                    objBL_PlanType  = new BL_PlanType();
                    lstUserplantype = objBL_PlanType.SelectUserplantypeforcampid(Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["PlantypId"]).ToString()));

                    if (lstUserplantype.Count > 0)
                    {
                        objBL_Common.AccessUpdateAllCampaign("EC_PlanType", "PlanName= '" + txtCampaignName.Value + "', IsSingleUser= "******", Planrate= " + txtPlanRate.Value + ", NOC= " + txtnosubscribers.Value + ", AllowedMails = " + txtnomails.Value + ", UpdatedBy = " + Convert.ToInt32(Session["UserID"].ToString()) + ", UpdatedOn = '" + DateTime.Now + "' ", "PK_PlanID =" + Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["PlantypId"]).ToString()) + "");
                    }
                    lstUserplantype = null;
                    objUserplantype = null;
                    objBL_PlanType  = null;
                }
                else
                {
                    objUserplantype.PlanName = txtCampaignName.Value;

                    if (Convert.ToInt32(rbuserselect.SelectedValue) == 1)
                    {
                        objUserplantype.IsSingleUser = true;
                    }
                    else
                    {
                        objUserplantype.IsSingleUser = false;
                    }

                    objUserplantype.Planrate     = Convert.ToInt32(txtPlanRate.Value);
                    objUserplantype.NOC          = Convert.ToInt32(txtnosubscribers.Value);
                    objUserplantype.AllowedMails = Convert.ToInt32(txtnomails.Value);

                    if (chkactive.Checked == true)
                    {
                        objUserplantype.IsActive = true;
                    }
                    else
                    {
                        objUserplantype.IsActive = false;
                    }

                    objUserplantype.Plandate  = DateTime.Now;
                    objUserplantype.CreatedOn = DateTime.Now;
                    objUserplantype.CreatedBy = Convert.ToInt32(Session["UserID"].ToString());
                    objBL_PlanType.AccessInsertUserplantype(objUserplantype);
                }
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "Clearuserinput2();", true);
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("UserPlanType.aspx:btnSubmit_Click() - " + ex.Message);
            }
        }
        protected void btngridsubmit_Click(object sender, EventArgs e)
        {
            try
            {
                objBL_Common = new BL_Common();
                string columnname = string.Empty;

                if (ddlcolumn.SelectedValue == "1")
                {
                    columnname = "Designation";
                }
                else if (ddlcolumn.SelectedValue == "2")
                {
                    columnname = "City1";
                }
                else if (ddlcolumn.SelectedValue == "3")
                {
                    columnname = "State1";
                }
                else if (ddlcolumn.SelectedValue == "4")
                {
                    columnname = "Country1";
                }
                else if (ddlcolumn.SelectedValue == "5")
                {
                    columnname = "Addressline1";
                }

                objBL_Common.AccessUpdateAllCampaign("EC_UserContacts", "" + columnname + " = '" + txtCampName.Value.Trim() + "' ", "PK_ContactID  in (" + Session["massupdatecontid"].ToString() + ")");
                lblcontact.Text             = "Your contact details are updated successfully.";
                lblcontact.CssClass         = "labelsuccess";
                ddlcolumn.SelectedValue     = "0";
                txtCampName.Value           = "";
                Session["massupdatecontid"] = null;
                Session.Remove("massupdatecontid");
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("MassUpdateContact.aspx:btngridsubmit_Click() - " + ex.Message);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            try
            {
                Boolean AllowMail = ValidateAllowedMails();

                if (AllowMail == false)
                    return;

                string body = txta9.Value;
                if (body != "")
                {
                    objBL_Common.AccessUpdateAllCampaign("EC_Campaign", "mailcontent = '" + body + "'", "PK_CampaignID =" + Convert.ToInt32(Session["CampgnID"].ToString()) + "");
                    string destcc = "*****@*****.**";
                    string fromEmailID = System.Configuration.ConfigurationSettings.AppSettings["AryvartAdminEmailID"].ToString();
                    string fromPassword = System.Configuration.ConfigurationSettings.AppSettings["AryvartAdminEmailPassword"].ToString();

                    for (int i = 0; i < gvAddContacts.Rows.Count; i++)
                    {
                        string tomailid = gvAddContacts.Rows[i].Cells[5].Text.ToString();
                        int contactid = 0;
                        Label lblEmpID = (Label)gvAddContacts.Rows[i].Cells[0].FindControl("lblThirdPartyId");

                        if (gvAddContacts.Rows[i].Cells[0].Text.ToString() != null)
                            contactid = Convert.ToInt32(lblEmpID.Text.ToString());

                        string CQIID = CampaignQueueInsert(false, contactid);
                        int PKID = 0;

                        if (CQIID != null)
                        {
                            PKID = Convert.ToInt32(CQIID);
                            var deliveryProcessor = "http://*****:*****@"<img src=""{0}?msg_id={1}""  width=""0"" height=""0"" 
                           style=""width: 0px; height: 0px; border:0px;"" alt=""""/>",
                                       deliveryProcessor, PKID);
                            body += imgTag;
                        }

                        objMailTemplate.fnSendMailToRecipients(fromEmailID, fromPassword, body, destcc, txtTitle.Value.ToString(), tomailid, EmailID.Value.ToString().Trim(), PKID);
                        objBL_Common.AccessUpdateAllCampaign("EC_CampaignQueue", "IsMailSent = " + 1 + ", SentOn = '" + DateTime.Now + "', UpdatedBy = " + Convert.ToInt64(Session["UserID"].ToString()) + ", UpdatedOn = '" + DateTime.Now + "'", "PK_CampaignQueueID =" + Convert.ToInt32(PKID) + "");
                    }

                    objBL_Common = new BL_Common();
                    objBL_Common.AccessUpdateAllCampaign("EC_Campaign", "CampaignStatus = " + 1 + ", SchduleDateTime='" + DateTime.Now + "'", "PK_CampaignID =" + Convert.ToInt32(Session["CampgnID"].ToString()) + "");
                    //ClientScript.RegisterStartupScript(Page.GetType(), "mykey32", "alert('Mail sent successfully to all the recepients.');", true);
                    Session["SelectContactID"] = null;
                    Session.Remove("SelectContactID");
                    Session["CampgnID"] = null;
                    Session.Remove("CampgnID");
                    Response.Redirect("MailSentSuccess.aspx", false);
                }
                else
                {
                    ClientScript.RegisterStartupScript(Page.GetType(), "mykey25", "alert('Enter your mail content text message to send a mail!');", true);
                }
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("CreateCampign.aspx:Button1_Click() - " + ex.Message);
            }
        }
        protected void btngridsubmit_Click(object sender, EventArgs e)
        {
            Boolean AllowMail = ValidateAllowedMails();

            if (AllowMail == false)
                return;
            string CampTimezone = ddlTimeZone.SelectedValue;
            string dttime = dtScheduledatetime.Value;
            string[] dateString = dttime.Split('/');
            DateTime enter_date = Convert.ToDateTime
            (dateString[1] + "/" + dateString[0] + "/" + dateString[2]);
            DateTime indtime;
            DateTime utcTime = enter_date.ToUniversalTime();            

            if (ddlTimeZone.SelectedIndex > 0)
            {
                indtime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(Convert.ToDateTime(enter_date.ToString()), ddlTimeZone.SelectedValue, TimeZoneInfo.Local.Id);
                utcTime = new DateTime();
                utcTime = indtime.ToUniversalTime();
                objCampaign.Utctime = utcTime;
            }
            //else
            //    objCampaign.Utctime = utcTime;


            //objCampaign.SchduleDateTime = enter_date;
            string body = txta9.Value;

            if (body != "" && gvAddContacts.Rows.Count > 0)
            {
                objBL_Common = new BL_Common();

                objBL_Common.AccessUpdateAllCampaign("EC_Campaign", "Utctime = '" + utcTime + "', CampTimezone = '" + ddlTimeZone.SelectedValue + "', mailcontent = '" + body + "', CampaignStatus = " + 0 + ", SchduleDateTime = '" + enter_date + "' ", "PK_CampaignID =" + Convert.ToInt32(Session["CampgnID"].ToString()) + "");

                for (int i = 0; i < gvAddContacts.Rows.Count; i++)
                {
                    string tomailid = gvAddContacts.Rows[i].Cells[5].Text.ToString();
                    int contactid = 0;
                    Label lblEmpID = (Label)gvAddContacts.Rows[i].Cells[0].FindControl("lblThirdPartyId");

                    if (gvAddContacts.Rows[i].Cells[0].Text.ToString() != null)
                        contactid = Convert.ToInt32(lblEmpID.Text.ToString());
                    CampaignQueueInsert(false, contactid);
                }
                //objBL_Common = new BL_Common();
                //objBL_Common.AccessUpdateAllCampaign("EC_Campaign", "CampaignStatus = " + 0 + "", "PK_CampaignID =" + Convert.ToInt32(Session["CampgnID"].ToString()) + "");
                objBL_ScheduleMailDetails = new BL_ScheduleMailDetails();
                objScheduleMailDetails = new ScheduleMailDetails();
                Label lblEmpID1 = (Label)gvAddContacts.Rows[0].Cells[0].FindControl("lblThirdPartyId");
                objScheduleMailDetails.FK_ContactID = Convert.ToInt32(lblEmpID1.Text.ToString());
                objScheduleMailDetails.Scheduledatetime = utcTime;
                objScheduleMailDetails.FK_Scheduleby = Convert.ToInt32(Session["UserID"].ToString());
                objScheduleMailDetails.QueueStatus = false;
                objScheduleMailDetails.CreatedBy = Convert.ToInt32(Session["UserID"].ToString());
                objScheduleMailDetails.CreatedOn = DateTime.Now;
                objScheduleMailDetails.FK_CampaignID = Convert.ToInt32(Session["CampgnID"].ToString());
                objBL_ScheduleMailDetails.AccessInsertScheduleMailDetails(objScheduleMailDetails);
                objScheduleMailDetails = null;
                objBL_ScheduleMailDetails = null;
                Session["SelectContactID"] = null;
                Session.Remove("SelectContactID");
                Session["CampgnID"] = null;
                Session.Remove("CampgnID");
                //ClientScript.RegisterStartupScript(Page.GetType(), "mykey26", "alert('Your schedule mail content text message or Choose Recipients to send a mail!');", true);
                Response.Redirect("MailScheduleSuccess.aspx", false);
            }
            else
            {
                ClientScript.RegisterStartupScript(Page.GetType(), "mykey25", "alert('Enter your mail content text message or Choose time zone and Recipients to send a mail!');", true);
            }

        }
Esempio n. 5
0
        /// <summary>
        /// Created By :: Sakthivel.R
        /// Created On :: 25-6-2015
        /// Comments :: Inserting all values of InviteUser form.
        /// </summary>
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                objInviteUser = new InviteUser();
                lstInviteUser = new List <InviteUser>();

                objInviteUser.FK_RoleID = Convert.ToInt32(ddlrole.SelectedValue);


                if (Request.QueryString["CampInvtusrId"] != null)
                {
                    objUserDetails         = new UserDetails();
                    lstUserDetails         = new List <UserDetails>();
                    objBL_UserLoginDetails = new BL_UserLoginDetails();
                    lstUserDetails         = objBL_UserLoginDetails.SelectUserDetailsList(Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["CampInvtusrId"]).ToString()));

                    if (lstUserDetails.Count > 0)
                    {
                        if (ddlrole.SelectedValue != "0")
                        {
                            objBL_Common.AccessUpdateAllCampaign("EC_UserLogin", "FK_RoleID= " + Convert.ToInt32(ddlrole.SelectedValue) + ", UpdatedBy = " + Convert.ToInt32(Session["UserID"].ToString()) + ", UpdatedOn = '" + DateTime.Now + "' ", "PK_UserID =" + Convert.ToInt32(HttpUtility.UrlDecode(Request.QueryString["CampInvtusrId"]).ToString()) + "");
                        }
                    }
                    lstUserDetails         = null;
                    objUserDetails         = null;
                    objBL_UserLoginDetails = null;
                    ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "Clearuserinput2();", true);
                }
                else
                {
                    int status = objBL_UserLoginDetails.AccessVerifyUserEmailidExist(EmailID.Value.ToString().Trim());

                    if (status == 0)
                    {
                        objInviteUser.Emailid      = EmailID.Value;
                        objInviteUser.Invitedate   = DateTime.Now;
                        objInviteUser.Message      = txtmessage.Value;
                        objInviteUser.FK_CompanyID = Convert.ToInt32(Session["CompanyID"].ToString());
                        objInviteUser.CreatedOn    = DateTime.Now;
                        objInviteUser.CreatedBy    = Convert.ToInt32(Session["UserID"].ToString());
                        string pkcqid = objBL_InviteUser.AccessInsertInviteUser(objInviteUser);

                        //------Sending confirmtion Email of account created to client.-----
                        string sEmailId = "*****@*****.**";
                        //subject
                        string sSubject = "Join my Email Campaign account";

                        ////sending emails to client
                        string strReceiverName = "ADMIN";
                        string EncryptQry      = "signid=" + objCryptographicHashCode.EncryptPlainTextToCipherText(pkcqid) + "'";
                        lstCompany = objBL_CompanyDetails.SelectCompanyListbasedonid(Convert.ToInt32(Session["CompanyID"].ToString()));
                        string companyname = "";
                        string emailid     = "";

                        if (lstCompany.Count > 0)
                        {
                            if (lstCompany[0].Company_Name != null)
                            {
                                companyname = lstCompany[0].Company_Name;
                            }
                        }

                        if (Session["AdminEmilid"] != null)
                        {
                            emailid = Session["AdminEmilid"].ToString();
                        }

                        string body = MailTemplate.MailInviteUser(companyname, emailid, EncryptQry);
                        objMailTemplate.fnSendMailToClientForCoUpld(body, sEmailId, sSubject, EmailID.Value.ToString().Trim());
                        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "Clearuserinput1();", true);
                    }
                    else if (status == 1)
                    {
                        lblerrormsg.Text = "<span style='color:#c85305;font-size:12px;'>Emailid already exist use some other emailid.</span>";
                    }
                    //---------End---------------------
                }
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("InvitieUser.aspx:btnSubmit_Click() - " + ex.Message);
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                objRole = new Role();
                lstRole = new List <Role>();

                if (Chkcmpcreate.Checked == true)
                {
                    objRole.CampaignCreate = true;
                }
                else
                {
                    objRole.CampaignCreate = false;
                }

                if (Chksendcmp.Checked == true)
                {
                    objRole.MailSend = true;
                }
                else
                {
                    objRole.MailSend = false;
                }

                if (Chkusr.Checked == true)
                {
                    objRole.CreateUser = true;
                }
                else
                {
                    objRole.CreateUser = false;
                }

                if (Chkcmpdelete.Checked == true)
                {
                    objRole.CampaignDelete = true;
                }
                else
                {
                    objRole.CampaignDelete = false;
                }

                if (Chkvwreports.Checked == true)
                {
                    objRole.ViewingReports = true;
                }
                else
                {
                    objRole.ViewingReports = false;
                }

                //objRole.TemplateView
                if (Chklstexports.Checked == true)
                {
                    objRole.ListExports = true;
                }
                else
                {
                    objRole.ListExports = false;
                }

                objBL_Common.AccessUpdateAllCampaign("EC_Role", "CampaignCreate= '" + objRole.CampaignCreate + "', MailSend = '" + objRole.MailSend + "', CreateUser = '******', CampaignDelete = '" + objRole.CampaignDelete + "', ViewingReports = '" + objRole.ViewingReports + "',ListExports = '" + objRole.ListExports + "' ", "PK_RoleID =" + Convert.ToInt32(ddlrole.SelectedValue) + "");
                Label1.Text     = "Information Successfully Saved.";
                Label1.CssClass = "alert alert-success";
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("RoleSettings.aspx:btnSubmit_Click() - " + ex.Message);
                Label1.Text     = "Failed while saving the information.";
                Label1.CssClass = "alert alert-danger";
            }
        }
Esempio n. 7
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                HttpCookie myCookie   = new HttpCookie("myCookie");
                bool       IsRemember = chkRememberme.Checked;
                lstUserDetails = new List <UserDetails>();
                lstUserDetails = objBL_UserLoginDetails.SelectUserDetailsforLogin(txtUsername.Value.ToString(), txtpassword.Value.ToString());

                if (lstUserDetails.Count > 0)
                {
                    if (lstUserDetails[0].AccountActivated == true)
                    {
                        if (IsRemember)
                        {
                            myCookie.Values.Add("username", txtUsername.Value);
                            myCookie.Values.Add("password", objCryptographicHashCode.EncryptPlainTextToCipherText(txtpassword.Value));
                            myCookie.Expires = DateTime.Now.AddDays(15);
                            Response.Cookies.Add(myCookie);
                        }
                        else
                        {
                            myCookie.Values.Add("username", string.Empty);
                            myCookie.Values.Add("password", string.Empty);
                            myCookie.Expires = DateTime.Now.AddMinutes(5);
                            Response.Cookies.Add(myCookie);
                        }

                        Session["UserID"]    = lstUserDetails[0].PK_UserID;
                        Session["Usertype"]  = lstUserDetails[0].UserType;
                        Session["CompanyID"] = lstUserDetails[0].FK_CompanyID;

                        if (lstUserDetails[0].FirstName == "" && lstUserDetails[0].LastName == "")
                        {
                            Session["UserName"] = lstUserDetails[0].UserName;
                        }
                        else
                        {
                            Session["UserName"] = lstUserDetails[0].FirstName + " " + lstUserDetails[0].LastName;
                        }

                        if (Session["CompanyID"].ToString() != "")
                        {
                            Session["CompanyName"] = objBL_Common.IsValidUser("Company_Name", "EC_Company", "PK_CompanyID =" + Convert.ToInt32(Session["CompanyID"].ToString()) + "");
                        }
                        else
                        {
                            Session["CompanyName"] = "-";
                        }

                        if (Convert.ToInt64(Session["Usertype"].ToString()) == 10)
                        {
                            Response.Redirect("UserPlanTypeDetails.aspx", false);
                            return;
                        }

                        if (lstUserDetails[0].FK_RoleID != null)
                        {
                            Session["RoleID"] = lstUserDetails[0].FK_RoleID;
                        }

                        if (lstUserDetails[0].UserType == 1)
                        {
                            if (lstUserDetails[0].FK_RoleID == null)
                            {
                                objRole                = new Role();
                                objRole.RoleName       = "Admin";
                                objRole.CampaignCreate = true;
                                objRole.FK_CompanyID   = Convert.ToInt32(Session["CompanyID"].ToString());
                                objRole.MailSend       = true;
                                objRole.CreateUser     = true;
                                objRole.CampaignDelete = true;
                                objRole.ViewingReports = true;
                                objRole.TemplateView   = true;
                                objRole.ListExports    = true;
                                objRole.CreatedOn      = DateTime.Now;
                                objRole.CreatedBy      = Convert.ToInt32(Session["UserID"].ToString());
                                string pkcqid = objBL_Role.AccessInsertRole(objRole);

                                if (pkcqid != "")
                                {
                                    Session["RoleID"] = Convert.ToInt32(pkcqid);
                                    objBL_Common      = new BL_Common();
                                    objBL_Common.AccessUpdateAllCampaign("EC_UserLogin", "FK_RoleID = '" + Convert.ToInt32(pkcqid) + "'", "PK_UserID =" + Convert.ToInt32(Session["UserID"].ToString()) + "");
                                    objBL_Common = null;
                                }
                            }
                        }
                        objBL_UserPlan = new BL_UserPlan();
                        lstUserPlan    = new List <UserPlan>();
                        lstUserPlan    = objBL_UserPlan.GetUserPlanBasedonCompanyID(Convert.ToInt32(Session["CompanyID"].ToString()));

                        if (lstUserPlan.Count <= 0)
                        {
                            InsertUserPlan(Convert.ToInt32(Session["UserID"].ToString()));
                            Response.Redirect("Dashboard.aspx", false);
                        }
                        else
                        {
                            Response.Redirect("Dashboard.aspx", false);
                            DataTable dtplantype = new DataTable();
                            objBL_Common = new BL_Common();
                            dtplantype   = objBL_Common.plantypedetails("*", "EC_PlanType", "PK_PlanID = " + Convert.ToInt32(lstUserPlan[0].FK_PlanID.ToString()) + " and IsActive = 1 order by plandate desc");

                            string[] UPtype = new string[3];
                            UPtype[0] = Convert.ToString(dtplantype.Rows[0]["IsSingleUser"]);
                            UPtype[1] = Convert.ToString(dtplantype.Rows[0]["NOC"]);
                            UPtype[2] = Convert.ToString(dtplantype.Rows[0]["AllowedMails"]);
                            Session["lstUserPlanType"] = UPtype;
                        }

                        if (lstUserDetails[0].Email_id != null)
                        {
                            Session["AdminEmilid"] = lstUserDetails[0].Email_id;
                        }

                        if (lstUserDetails[0].FK_RoleID != 0)
                        {
                            roledetails();
                        }
                    }
                    else
                    {
                        lblerrormsg.Text = "<span style='color:#c85305;font-size:11.5px;'>You have to activate your account from mail sent. Then only you can access your account.</span>";
                    }
                }
                else
                {
                    lblerrormsg.Text = "<span style='color:#c85305;font-size:11.5px;'>That account doesn't exist. Enter a different account detail or </span> <a href='FreeAccountSignUp.aspx' style='font-size:11.5px; color: #00acec;'>get a new account</a>";
                }
            }
            catch (Exception ex)
            {
                New_EmailCampaign.App_Code.GlobalFunction.StoreLog("UserLogin.aspx:btnSubmit_Click() - " + ex.Message);
            }
        }