protected void Page_Load(object sender, EventArgs e)
        {


            if (!IsPostBack)
            {
                //if (Session["AdminProfile"] == null)
                //{
                //    Response.Redirect("Default.aspx");
                //}

                if (Request.QueryString["Id"] != null)
                {
                    try
                    {
                        //NewsRepository objNewsRepo = new NewsRepository();
                        //News news = objNewsRepo.getNewsDetailsbyId(Guid.Parse(Request.QueryString["Id"].ToString()));
                        MandrillAccountRepository objMandrillAccountRepository = new MandrillAccountRepository();
                        MandrillAccount objMandrillAccount = new MandrillAccount();
                        objMandrillAccount.Id = (Guid.Parse(Request.QueryString["Id"].ToString()));
                        MandrillAccount lstMandrillAccount = objMandrillAccountRepository.GetMandrillAccountById(objMandrillAccount);


                        txtUsername.Text = lstMandrillAccount.UserName;
                        txtpassword.Text = lstMandrillAccount.Password;
                        ddlStatus.SelectedValue = lstMandrillAccount.Status;
                       
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex.Message);
                    }
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                MandrillAccountRepository objMandrillAccountRepository = new MandrillAccountRepository();
                MandrillAccount objMandrillAccount = new MandrillAccount();

                objMandrillAccount.Id = (Guid.Parse(Request.QueryString["Id"].ToString()));
                objMandrillAccount.UserName = txtUsername.Text;
                objMandrillAccount.Password = txtpassword.Text;
                objMandrillAccount.Status = ddlStatus.SelectedValue;
                objMandrillAccount.Status = ddlStatus.SelectedValue;
                if (objMandrillAccountRepository.GetMandrillAccountByStatus(objMandrillAccount).Count < 1 || objMandrillAccountRepository.GetMandrillAccountByStatus(objMandrillAccount).Count == 0)
                {
                    objMandrillAccountRepository.UpdateMandrillAccount(objMandrillAccount);
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Modified Successfully');", true);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Coupon Already Exist');", true);
                }


            }
            catch (Exception Err)
            {
                logger.Error(Err.Message);
                Response.Write(Err.Message);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                if (Session["AdminProfile"] == null)
                {
                    Response.Redirect("Default.aspx");
                }

                try
                {
                    //NewsRepository objNewsRepo = new NewsRepository();
                    //List<News> lstNews = objNewsRepo.getAllNews();
                    MandrillAccountRepository objMandrillAccountRepository = new MandrillAccountRepository();
                    List<MandrillAccount> lstMandrillAccount = objMandrillAccountRepository.GetAllMandrillAccount();
                    string strNews = string.Empty;

                    foreach (MandrillAccount item in lstMandrillAccount)
                    {
                        strNews = strNews + "<tr class=\"gradeX\"><td><a href=\"EditCoupons.aspx?id=" + item.Id + "\">Edit</a></td><td>" + item.UserName + "</td><td>" + item.Password + "</td><td>" + item.Total + "</td><td class=\"center\">" + item.Status + "</td><td class=\"center\">" + item.EntryDate + "</td></tr>";
                    }
                    divNews.InnerHtml = strNews;
                }
                catch (Exception Err)
                {
                    logger.Error(Err.Message);
                    Response.Write(Err.StackTrace);
                }
            }
        }