Пример #1
0
    public void SaveForm()
    {
        if (ValidateForm())
        {
            Gen_GeneralUseValueList genValueUpdateProfileLst = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("UpdateProfileDate");
            Gen_GeneralUseValue     genValueUpdateProfile    = Gen_GeneralUseValue.GetGen_GeneralUseValue(genValueUpdateProfileLst[0].Id);

            if (genValueUpdateProfile != null)
            {
                DateTime updateProfile = (DateTime)radUpdateProfileDate.SelectedDate;
                genValueUpdateProfile.Value = updateProfile.AddDays(1).AddSeconds(-1).ToString();
                genValueUpdateProfile.DateModifiedString = DateTime.Now.ToString();
                genValueUpdateProfile.Save();
            }

            Gen_GeneralUseValueList genValueInvitationLst    = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("InvitationDeadline");
            Gen_GeneralUseValue     genValueUpdateInvitation = Gen_GeneralUseValue.GetGen_GeneralUseValue(genValueInvitationLst[0].Id);

            if (genValueUpdateInvitation != null)
            {
                DateTime invitation = (DateTime)radInvitationDate.SelectedDate;
                genValueUpdateInvitation.Value = invitation.AddDays(1).AddSeconds(-1).ToString();
                genValueUpdateInvitation.DateModifiedString = DateTime.Now.ToString();
                genValueUpdateInvitation.Save();
            }

            Gen_GeneralUseValueList genValueEventCodeLst    = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode");
            Gen_GeneralUseValue     genValueUpdateEventCode = Gen_GeneralUseValue.GetGen_GeneralUseValue(genValueEventCodeLst[0].Id);
            genValueUpdateEventCode.Value = txtEventCode.Text;
            genValueUpdateEventCode.Save();

            lbError.Text = "Setting saved successfully.";
        }
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            //jury = Jury.GetJury(new Guid(Request.QueryString["juryId"]));
            if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "")
            {
                jury = Jury.GetJury(IptechLib.Validation.GetValueGuid(Request.QueryString["juryId"], true));
            }
        }
        catch { }

        if (jury == null)
        {
            Security.RedirectToAccessDeniedPage();
        }

        itemsToShow = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value);

        if (!IsPostBack)
        {
            LoadForm();
            PopulateForm();
        }

        if (GeneralFunction.IsProfileUpdateDateCutOff())
        {
            Response.Redirect("../Jury/Thankyou.aspx");
        }
    }
Пример #3
0
    public void BindCompanyHistory(bool needRebind, int itemsToShow)
    {
        int itemstoDisplay = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value);

        CompanyHistoryList companyHistryList = CompanyHistoryList.GetCompanyHistoryList(jury.Id);

        if (itemsToShow > itemstoDisplay)
        {
            radCompanyList.DataSource = companyHistryList.Take(itemsToShow);
        }
        else
        {
            radCompanyList.DataSource = companyHistryList.Take(itemstoDisplay);
        }

        if (needRebind)
        {
            radCompanyList.Rebind();
        }



        lnkSHowMore.Visible = companyHistryList.Count > itemstoDisplay && companyHistryList.Count > itemsToShow;
        lnkSHowLess.Visible = radCompanyList.Items.Count > itemstoDisplay;
    }
Пример #4
0
    public void PopulateForm()
    {
        radUpdateProfileDate.SelectedDate = Convert.ToDateTime(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("UpdateProfileDate")[0].Value);
        radInvitationDate.SelectedDate    = Convert.ToDateTime(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("InvitationDeadline")[0].Value);
        txtEventCode.Text = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;

        if (Security.IsRoleReadOnlyAdmin())
        {
            btnSubmit.Visible = false;
        }
    }
Пример #5
0
 protected void btnSave_OnClick(object sender, EventArgs e)
 {
     if (!ValidateForm())
     {
         return;
     }
     else
     {
         var MasterKey = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("MasterKeyUser")[0];
         MasterKey.Value = GeneralFunction.CreateMD5(txtPassword.Text);
         if (MasterKey.IsValid)
         {
             MasterKey.Save();
             Response.Redirect("EntryList.aspx");
         }
     }
 }
Пример #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["juryId"] != null && Request.QueryString["juryId"] != "")
        {
            jury = Jury.GetJury(new Guid(Request.QueryString["juryId"]));
        }
        else
        {
            jury = Jury.NewJury();
        }

        itemsToShow = Convert.ToInt32(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultListToShow")[0].Value);

        if (!IsPostBack)
        {
            LoadForm();
            PopulateForm();
        }

        // view mode
        if (Request.QueryString["v"] != null && Request.QueryString["v"] == "1")
        {
            IptechLib.Forms.ChangeStateControls(this, false);

            filePhoto.Enabled = false;

            btnSubmit.Visible = false;
            btnEdit.Visible   = true;

            btnEdit.Enabled = true;
            btnBack.Enabled = true;
        }
        else
        {
            btnEdit.Enabled           = true;
            lnkChangePassword.Visible = Security.IsRoleSuperAdmin() && !jury.IsNew;
        }

        if (Security.IsRoleReadOnlyAdmin())
        {
            GeneralFunction.DisableAllAction(this, false);
            btnSubmit.Visible            = false;
            btnJurySubmitRemarks.Visible = false;
            filePhoto.Enabled            = false;
        }
    }
Пример #7
0
    public void GenerateEmails(Guid templateId)
    {
        string evetnYear = string.Empty;

        try
        {
            evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
        }
        catch { }

        lblError.Text = string.Empty;
        int counter = 0;

        foreach (GridDataItem item in radGridEntry.Items)
        {
            CheckBox    chkbox = (CheckBox)item.FindControl("chkboxSelect");
            HiddenField hdfId  = (HiddenField)item.FindControl("hdfId");

            if (chkbox.Checked)
            {
                EffieJuryManagementApp.Jury jury = EffieJuryManagementApp.Jury.GetJury(new Guid(hdfId.Value.ToString()));
                Email.SendTemplateEmailJury(jury, templateId);
                GeneralFunction.SaveEmailSentLogJury(jury, templateId, evetnYear);

                chkbox.Checked = false;
                counter++;
            }
        }

        if (counter == 0)
        {
            lblError.Text = "Please select at least one jury to send email.<br/>";
        }
        else
        {
            phSelectTemplate.Visible = false;
            lblError.Text            = "Email sent to " + (counter).ToString() + " Jury(s).<br/>";
        }
    }
Пример #8
0
    public void GenerateEmails(Guid templateId)
    {
        string evetnYear = string.Empty;

        try
        {
            evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
        }
        catch { }

        lblError.Text = string.Empty;
        int counter = 0;

        foreach (GridDataItem item in radGridJury.Items)
        {
            CheckBox chkbox = (CheckBox)item.FindControl("chkbox");

            if (chkbox.Checked)
            {
                Jury jury = Jury.GetJury(new Guid(item["Id"].Text));
                Email.SendTemplateEmail(jury, templateId);
                GeneralFunction.SaveEmailSentLog(jury, templateId, evetnYear);

                chkbox.Checked = false;
                counter++;
            }
        }

        if (counter == 0)
        {
            lblError.Text = "Please select atleat one jury to send email.<br/>";
        }
        else
        {
            lblError.Text = "Email sent to " + (counter).ToString() + " Jury(s).<br/>";
        }
    }
Пример #9
0
    public void PopulateTemplatePanel(Button pressedButton)
    {
        lblTempError.Text = string.Empty;
        lblError.Text     = string.Empty;

        IptechLib.Forms.RemoveHighlightControls(phSelectTemplate);

        ddlRounds.Items.Clear();
        ddlRounds.Items.Add(new ListItem("Round 1", RoundsType.Round1));
        ddlRounds.Items.Add(new ListItem("Round 2", RoundsType.Round2));
        ddlRounds.Items.Add(new ListItem("Round 1 & 2", RoundsType.BothRounds));

        if (!pressedButton.CommandName.Equals("add"))
        {
            ddlRounds.Items.Add(new ListItem("N/A", RoundsType.NotApplicable));
        }

        ddlRounds.Items.Insert(0, new ListItem("Please Select", string.Empty.ToString()));

        List <EmailTemplate> defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(Guid.Empty).Where(m => m.TemplateId != new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value) &&
                                                                                                                 m.IsActive && m.UserData2.Equals(EmailCategory.Invitation) && !m.IsDelete).ToList();

        if (defaultEmailTempalteList.Count == 0)
        {
            lblError.Text = "No Email Template found.<br/>";
        }

        roundRow.Visible    = pressedButton.CommandName.Equals("add");
        templateRow.Visible = !pressedButton.CommandName.Equals("add");

        phSelectTemplate.Visible = (defaultEmailTempalteList.Count != 0);

        if (defaultEmailTempalteList.Count != 0)
        {
            ddlTemplateList.DataSource     = defaultEmailTempalteList;
            ddlTemplateList.DataTextField  = "Title";
            ddlTemplateList.DataValueField = "Id";
            ddlTemplateList.DataBind();

            ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));

            hlkPreview.Visible = !ddlTemplateList.SelectedValue.Equals(Guid.Empty.ToString());

            lblTitle.Text = pressedButton.Text;
        }
    }
Пример #10
0
    private void PopulateForm(Jury jury)
    {
        if (jury != null)
        {
            InvitationList inv = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);

            if (inv.Count > 0)
            {
                if (!inv[0].IsLocked)
                {
                    string[] roundsArray = null;
                    try
                    {
                        roundsArray = GeneralFunction.StringDecryption(rounds).ToString().Trim().Split('|').ToArray();
                    }
                    catch
                    {
                    }

                    string evetnYear = string.Empty;
                    try
                    {
                        evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
                    }
                    catch { }

                    if (roundsArray != null)
                    {
                        if (GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("yes"))
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = true;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = true;
                                    }
                                }
                            }

                            EmailTemplate updateProfileTemplate = EmailTemplate.GetEmailTemplate(new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultUpdateProfileTemplateId")[0].Value));
                            if (updateProfileTemplate != null)
                            {
                                Email.SendTemplateEmail(jury, updateProfileTemplate.Id);
                                GeneralFunction.SaveEmailSentLog(jury, updateProfileTemplate.Id, evetnYear);
                            }

                            pnlSuccess.Visible = true;
                        }
                        else
                        {
                            foreach (string round in roundsArray)
                            {
                                if (!String.IsNullOrEmpty(round))
                                {
                                    if (Convert.ToInt32(round) == 1)
                                    {
                                        inv[0].IsRound1Accepted = false;
                                    }
                                    if (Convert.ToInt32(round) == 2)
                                    {
                                        inv[0].IsRound2Accepted = false;
                                    }
                                }
                            }

                            pnlReject.Visible = true;
                        }

                        inv[0].IsLocked   = true; //Only one time Jury can give his response
                        inv[0].IsDeclined = GeneralFunction.StringDecryption(requestString).Trim().ToLower().Equals("no");

                        inv[0].Save();
                    }
                }
                else
                {
                    pnlLock.Visible = true;
                }
            }
        }
    }
Пример #11
0
    public void GenerateEmails(Guid templateId)
    {
        string evetnYear = string.Empty;

        try
        {
            evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
        }
        catch { }

        lblError.Text = string.Empty;
        List <RegEntry> regentrylist = new List <RegEntry>();

        foreach (GridDataItem item in radGridUser.Items)
        {
            CheckBox chkbox = (CheckBox)item.FindControl("chkbox");
            if (chkbox.Checked)
            {
                List <Entry> entryList = EntryList.GetEntryList(Guid.Empty, new Guid(item["Id"].Text), "").ToList();
                Registration reg       = Registration.GetRegistration(new Guid(item["Id"].Text));
                regentrylist.Add(new RegEntry {
                    entrylist = entryList, registration = reg
                });
            }
            chkbox.Checked = false;
        }

        if (regentrylist.Count() == 0)
        {
            lblError.Text = "Please select atleast one registration to send email.<br/>";
        }
        else
        {
            foreach (RegEntry regEntry in regentrylist.ToList())
            {
                GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", regEntry.registration.Id);
                List <Guid> IDList = new List <Guid>();
                if (regEntry.entrylist.Count() == 0)
                {
                    //GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", regEntry.registration.Id);
                }
                else
                {
                    foreach (Entry entry in regEntry.entrylist)
                    {
                        IDList.Add(entry.Id);
                        //GeneralFunction.SaveEmailSentLogReg(regEntry.registration, templateId, evetnYear, "UserList", entry.Id);
                        entry.LastSendSubmissionReminderEmailDateString = DateTime.Now.ToString();
                        entry.Save();
                    }
                }

                Email.SendReminderEmailTemplatelReg(regEntry.registration, GeneralFunction.CheckPlaceHolders(rEditorBody.Content, true), txtTemplateSubject.Text, IDList, "UserList");
                //Email.SendReminderEmailTemplatelReg(regEntry.registration, templateId, IDList, "UserList");
            }

            lblError.Text = "Email sent " + regentrylist.Count() + " .<br/>";
        }

        regentrylist.Clear();

        phSelectTemplate.Visible = false;
        radGridUser.Rebind();
    }
Пример #12
0
    private void BindGrid(bool needRebind)
    {
        EmailTemplateList emailTemplateList = EmailTemplateList.GetEmailTemplateList();

        radGridJury.DataSource = emailTemplateList.Where(m => m.TemplateId != new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value) && !m.IsDelete).OrderByDescending(m => m.DateCreated).ToList();

        if (needRebind)
        {
            radGridJury.Rebind();
        }
    }
Пример #13
0
    public void PopulateTemplatePanel(Button pressedButton)
    {
        lblTempError.Text = string.Empty;
        lblError.Text     = string.Empty;

        IptechLib.Forms.RemoveHighlightControls(phSelectTemplate);

        List <EmailTemplate> defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(Guid.Empty).Where(m => m.TemplateId != new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value) &&
                                                                                                                 m.IsActive && !m.IsInvitation).ToList();

        if (defaultEmailTempalteList.Count == 0)
        {
            lblError.Text = "No Email Template found.<br/>";
        }

        phSelectTemplate.Visible = (defaultEmailTempalteList.Count != 0);

        if (defaultEmailTempalteList.Count != 0)
        {
            ddlTemplateList.DataSource     = defaultEmailTempalteList;
            ddlTemplateList.DataTextField  = "Title";
            ddlTemplateList.DataValueField = "Id";
            ddlTemplateList.DataBind();

            ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));

            hlkPreview.Visible = !ddlTemplateList.SelectedValue.Equals(Guid.Empty.ToString());

            lblTitle.Text = pressedButton.Text;
        }
    }
Пример #14
0
    public void GenerateInvitation(SendInvitationCriteria invCriteria, Guid templateId)
    {
        string evetnYear = string.Empty;

        try
        {
            evetnYear = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value;
        }
        catch { }

        lblError.Text = string.Empty;
        int counter = 0;

        foreach (GridDataItem item in radGridJury.Items)
        {
            CheckBox    chkbox = (CheckBox)item.FindControl("chkbox");
            HiddenField hdfId  = (HiddenField)item.FindControl("hdfId");

            if (chkbox.Checked)
            {
                Jury jury = Jury.GetJury(new Guid(hdfId.Value.ToString()));

                InvitationList invList = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);

                Invitation inv = null;

                if (invList.Count > 0)
                {
                    inv = invList[0];
                }
                else
                {
                    inv = Invitation.NewInvitation();
                }

                inv.EventCode = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value.ToString();
                inv.JuryId    = jury.Id;

                if (invCriteria.isRound1)
                {
                    inv.IsRound1Invited           = true;
                    inv.DateRound1EmailSentString = DateTime.Now.ToString();
                }
                if (invCriteria.isRound2)
                {
                    inv.IsRound2Invited           = true;
                    inv.DateRound2EmailSentString = DateTime.Now.ToString();
                }

                if (inv.IsNew)
                {
                    inv.DateCreatedString = DateTime.Now.ToString();
                }

                inv.DateModifiedString = DateTime.Now.ToString();

                if (invCriteria.isSend)
                {
                    Email.SendInvitationTemplateEmail(inv, templateId);
                    GeneralFunction.SaveEmailSentLog(jury, templateId, evetnYear);
                }
                else
                {
                    inv.IsLocked = true;
                }

                if (inv.IsValid)
                {
                    inv.Save();
                }

                chkbox.Checked = false;
                counter++;
            }
        }

        if (counter == 0)
        {
            lblError.Text = "Please select atleat one jury to send Invitation.<br/>";
        }
        else
        {
            if (invCriteria.isSend)
            {
                lblError.Text = "Email sent to " + (counter).ToString() + " Jury(s).<br/>";
            }
            else
            {
                lblError.Text = "Invitation added for " + (counter).ToString() + " Jury(s).<br/>";
            }
        }
    }
Пример #15
0
    protected void radGridJury_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item.ItemType == GridItemType.Item || e.Item.ItemType == GridItemType.AlternatingItem)
        {
            Jury jury = (Jury)e.Item.DataItem;

            LinkButton lnkBtn = null;
            Label      lbl    = null;
            HyperLink  lnk    = null;

            // Jury Id
            lnkBtn                 = (LinkButton)e.Item.FindControl("lnkBtnJuryId");
            lnkBtn.Text            = jury.SerialNo;
            lnkBtn.CommandArgument = jury.Id.ToString();

            ((GridDataItem)e.Item)["Status"].Text = jury.IsToDelete ? "Del" : "Cur";

            // Jury Name
            lnk             = (HyperLink)e.Item.FindControl("lnkJuryName");
            lnk.Text        = jury.FirstName + " " + jury.LastName;
            lnk.NavigateUrl = "mailto:" + jury.Email;

            lnkBtn = (LinkButton)e.Item.FindControl("lnkBtnEdit");
            lnkBtn.CommandArgument = jury.Id.ToString();

            HiddenField hdfId = (HiddenField)e.Item.FindControl("hdfId");
            hdfId.Value = jury.Id.ToString();

            lnk             = (HyperLink)e.Item.FindControl("hlkEmailHistory");
            lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
            lnk.NavigateUrl = "./EmailSentHistory.aspx?juryId=" + jury.Id.ToString();

            CheckBox chkbox = (CheckBox)e.Item.FindControl("chkbox");

            try {
                InvitationList invList = InvitationList.GetInvitationList(jury.Id, Gen_GeneralUseValueList.GetGen_GeneralUseValueList("EventCode")[0].Value);
                if (invList.Count > 0)
                {
                    chkbox.Enabled = false;
                }
            }
            catch { }


            lnk             = (HyperLink)e.Item.FindControl("hlkEmailHistory");
            lnk.CssClass    = "fancybox fancybox.iframe tblLinkRed";
            lnk.NavigateUrl = "./EmailSentHistory.aspx?juryId=" + jury.Id.ToString();

            LinkButton lnkDelete = (LinkButton)e.Item.FindControl("lnkDelete");
            lnkDelete.CommandArgument = jury.Id.ToString();
            LinkButton lnkRestore = (LinkButton)e.Item.FindControl("lnkRestore");
            lnkRestore.CommandArgument = jury.Id.ToString();

            CheckBox chkBox = (CheckBox)e.Item.FindControl("chkbox");

            switch ((string)ViewState["TabFilterValue"])
            {
            case "All":
                lnkRestore.Visible = false;
                lnkDelete.Visible  = true;
                chkBox.Visible     = true;
                break;

            case "Deleted":
                lnkDelete.Visible  = false;
                lnkRestore.Visible = true;
                chkBox.Visible     = false;
                break;

            default:
                lnkDelete.Visible = true;
                chkBox.Visible    = true;
                break;
            }

            if (Security.IsRoleReadOnlyAdmin())
            {
                lnkDelete.Visible = false;
            }
        }
        else if (e.Item.ItemType == GridItemType.Pager)
        {
            RadComboBox PageSizeCombo = (RadComboBox)e.Item.FindControl("PageSizeComboBox");

            PageSizeCombo.Items.Clear();
            PageSizeCombo.Items.Add(new RadComboBoxItem("50", "50"));
            PageSizeCombo.FindItemByText("50").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("100", "100"));
            PageSizeCombo.FindItemByText("100").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("200", "200"));
            PageSizeCombo.FindItemByText("200").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.Items.Add(new RadComboBoxItem("All", "99999"));
            PageSizeCombo.FindItemByText("All").Attributes.Add("ownerTableViewId", radGridJury.MasterTableView.ClientID);
            PageSizeCombo.FindItemByValue(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;
        }
    }
Пример #16
0
    public void LoadForm()
    {
        EmailTemplateList defaultEmailTempalteList = EmailTemplateList.GetEmailTemplateList(new Guid(Gen_GeneralUseValueList.GetGen_GeneralUseValueList("DefaultTemplateId")[0].Value));

        ddlTemplateList.DataSource     = defaultEmailTempalteList;
        ddlTemplateList.DataTextField  = "Title";
        ddlTemplateList.DataValueField = "Id";
        ddlTemplateList.DataBind();

        ddlTemplateList.Items.Insert(0, new ListItem("Please Select", Guid.Empty.ToString()));
    }
Пример #17
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        lblMsg.Text = "";

        if (!txtLoginId.Text.Trim().Equals("") && !txtPassword.Text.Trim().Equals(""))
        {
            string MasterKeyUser = Gen_GeneralUseValueList.GetGen_GeneralUseValueList("MasterKeyUser")[0].Value;
            //string MasterKeyUser = ConfigurationManager.AppSettings["MasterKeyUser"].ToString();
            List <Registration> registrationList = Effie2017.App.RegistrationList.GetRegistrationList(txtLoginId.Text, "", StatusRegistration.OK).ToList();
            bool isBackDoor = (MasterKeyUser == GeneralFunction.CreateMD5(txtPassword.Text));
            if (registrationList.Count == 1)
            {
                if (registrationList[0].IsExpired)
                {
                    lblMsg.Text = "Your Email has been expired.<br>";
                }
                else if (registrationList[0].IsLooked)
                {
                    lblMsg.Text = "Account locked. Please contact <a href=\"mailto:[email protected]\">[email protected]</a> for help.<br><br>";
                }
                else if (registrationList[0].IsActive == false)
                {
                    lblMsg.Text = "Account Unactive. Please contact <a href=\"mailto:[email protected]\">[email protected]</a> for help.<br><br>";
                }
                else if (registrationList[0].Password == GeneralFunction.CreateMD5(txtPassword.Text) || isBackDoor)
                {
                    Effie2017.App.Registration registration = Effie2017.App.Registration.GetRegistration(registrationList[0].Id);

                    if (registration.LastSignIn2.ToString("yyyyMMdd") != "99991231")
                    {
                        registration.LastSignInString = registration.LastSignIn2.ToString();
                    }

                    FailedLoginCount = 0;
                    registration.LastSignIn2String = DateTime.Now.ToString();
                    registration.Save();

                    string IPAddress = Page.Request.ServerVariables["REMOTE_ADDR"];
                    GeneralFunction.CreateLogPassword(registration, "Registration", IPAddress);

                    Security.SetLoginSessionUser(registration);

                    if (chkRememberMe.Checked)
                    {
                        Response.Cookies["wdduw2013UserLogin"].Value   = GeneralFunction.StringEncryption(registrationList[0].Id.ToString());
                        Response.Cookies["wdduw2013UserLogin"].Expires = DateTime.Now.AddYears(1);
                    }
                    if (Request["rd"] != null)
                    {
                        string BackTo = IptechLib.Crypto.StringDecryption(Request["rd"].ToString());
                        Response.Redirect(BackTo);
                    }
                    else
                    {
                        Response.Redirect(loginSuccessRedirection);
                    }
                }
                else
                {
                    if (FailedLoginCount >= 3)
                    {
                        Effie2017.App.Registration registration = Effie2017.App.Registration.GetRegistration(registrationList[0].Id);
                        registration.IsLooked = true;
                        registration.Save();
                        lblMsg.Text = "Account locked. Please contact <a href=\"mailto:[email protected]\">[email protected]</a> for help.<br>";
                    }
                    else
                    {
                        lblMsg.Text = "Your Email and password don't match.<br>";
                    }

                    FailedLoginCount++;
                }
            }
            else
            {
                lblMsg.Text = "Login and Password is invalid.<br>";
            }
        }
        else
        {
            GeneralFunction.ValidateTextBox("Email", txtLoginId, true, "string");
            GeneralFunction.ValidateTextBox("Password", txtPassword, true, "string");
            lblMsg.Text = "Login and Password is required.<br>";
        }
    }