Exemple #1
0
        private void AddStatusDate()
        {
            DataTable dt = ObjDAL.GetData(DBName + ".dbo.RegistrationDetails", "PcName='" + Environment.MachineName + "'", "ID");

            if (dt != null && dt.Rows.Count > 0)
            {
                DateTime status  = Convert.ToDateTime(ObjUtil.Decrypt(dt.Rows[0]["StatusDate"].ToString(), true));
                DateTime ExpDate = Convert.ToDateTime(ObjUtil.Decrypt(dt.Rows[0]["ExpiryDate"].ToString(), true));

                //if (dt.Rows[0]["StatusDate"] != DBNull.Value && Convert.ToDateTime(dt.Rows[0]["StatusDate"]) <= DateTime.Now && Convert.ToDateTime(dt.Rows[0]["ExpiryDate"]) >= DateTime.Now)
                if (dt.Rows[0]["StatusDate"] != DBNull.Value && status <= ExpDate)
                {
                    if (status <= Convert.ToDateTime(DateTime.Now.ToString("yyyy/MM/dd h:mm:ss tt")))
                    {
                        ObjDAL.UpdateColumnData("StatusDate", SqlDbType.VarChar, ObjUtil.Encrypt(DateTime.Now.ToString(), true));
                        ObjDAL.UpdateData(DBName + ".dbo.RegistrationDetails", "PcName='" + Environment.MachineName + "'");
                    }
                }
                if (dt.Rows[0]["SoftKey"] == DBNull.Value)
                {
                    lblStatus.Text = lblStatus.Text + " UnRegistered Version";
                }
                else
                {
                    lblStatus.Text = lblStatus.Text + " Registered Version";
                }
            }
            else
            {
                lblStatus.Text = lblStatus.Text + " UnRegistered Version";
            }
        }
Exemple #2
0
        private void ValidatingExpDate()
        {
            DataTable dt = ObjDAL.GetData(clsUtility.DBName + ".dbo.RegistrationDetails", "[PcName]='" + Environment.MachineName + "' and [IsKeyEnter]=1", "RegistrationID");

            if (dt != null && dt.Rows.Count > 0)
            {
                dDatetimepicker dd = new dDatetimepicker(ValidatingExpDate);
                if (dtpExpiryDate.InvokeRequired)
                {
                    this.Invoke(dd, null);
                }
                else
                {
                    dtpExpiryDate.Value   = Convert.ToDateTime(Objutil.Decrypt(dt.Rows[0]["ExpiryDate"].ToString(), true));
                    dtpExpiryDate.Enabled = false;
                }
            }
            else
            {
                dDatetimepicker dd = new dDatetimepicker(ValidatingExpDate);
                if (dtpExpiryDate.InvokeRequired)
                {
                    this.Invoke(dd, null);
                }
                else
                {
                    dtpExpiryDate.Enabled = true;
                    dtpExpiryDate.MinDate = DateTime.Now;
                    dtpExpiryDate.MaxDate = DateTime.Now.AddYears(1);
                }
            }
        }
Exemple #3
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (Validateform())
            {
                if (DuplicateUser(ID))
                {
                    string pass = ObjUtil.Encrypt(txtPassword.Text, true);
                    ObjDAL.UpdateColumnData("UserName", SqlDbType.NVarChar, txtUserName.Text);
                    ObjDAL.UpdateColumnData("Password", SqlDbType.NVarChar, pass);
                    ObjDAL.UpdateColumnData("EmailID", SqlDbType.VarChar, txtEmail.Text);
                    ObjDAL.UpdateColumnData("SecurityQuestion", SqlDbType.NVarChar, cmbSecurity.SelectedItem.ToString());
                    ObjDAL.UpdateColumnData("Answer", SqlDbType.NVarChar, ObjUtil.Encrypt(txtAsnwer.Text.Trim(), true));
                    ObjDAL.UpdateColumnData("IsAdmin", SqlDbType.Bit, rdAdmin.Checked == true ? 1 : 0);
                    ObjDAL.UpdateColumnData("ActiveStatus", SqlDbType.Bit, rdActive.Checked == true ? 1 : 0);
                    if (rdAdmin.Checked == false)
                    {
                        admin = false;
                        clsUtility.IsAdmin = admin;
                    }

                    if (UserName != txtUserName.Text.Trim() || txtVerifyPassword.Text.Trim() != ObjUtil.Decrypt(pass, true) || rdAdmin.Checked || rdLimitedUser.Checked)
                    {
                        ObjDAL.UpdateColumnData("UpdatedOn", SqlDbType.DateTime, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
                        ObjDAL.UpdateColumnData("UpdatedBy", SqlDbType.Int, LogID); //if LogID=0 then Test Admin else user
                    }
                    if (ObjDAL.UpdateData(DBName + ".dbo.UserManagement", "UserID=" + ID) > 0)
                    {
                        ObjUtil.SetCommandButtonStatus(clsCommon.ButtonStatus.AfterUpdate, admin);
                        LoadData();
                        ClearAll();
                        EnableDisable(false);
                        clsUtility.ShowInfoMessage("'" + UserName + "' user is Updated", clsUtility.strProjectTitle);
                    }
                    else
                    {
                        clsUtility.ShowErrorMessage("'" + UserName + "' user is not Updated", clsUtility.strProjectTitle);
                    }
                    ObjDAL.ResetData();
                }
                else
                {
                    clsUtility.ShowErrorMessage("'" + txtUserName.Text + "' UserName OR EmailID is already exist..", clsUtility.strProjectTitle);
                    txtUserName.Focus();
                }
            }
        }
        private void BindUserDetails()
        {
            DataTable dt = ObjDAL.ExecuteSelectStatement("SELECT * FROM " + clsUtility.DBName + ".[dbo].[UserManagement] WHERE EmployeeID=" + EmployeeID);

            if (ObjUtil.ValidateTable(dt))
            {
                txtUsername.Text = dt.Rows[0]["UserName"].ToString();
                txtPass.Text     = ObjUtil.Decrypt(dt.Rows[0]["Password"].ToString(), true);
                txtEmail.Text    = dt.Rows[0]["EmailID"].ToString();
            }
        }
Exemple #5
0
        private bool FormValidation()
        {
            string ValidatingEmailID = txtEmail.Text.Trim();

            if (ObjUtil.IsControlTextEmpty(txtUserName))
            {
                clsUtility.ShowInfoMessage("Enter UserName.", clsUtility.strProjectTitle);
                txtUserName.Focus();
                return(false);
            }

            else if (ObjUtil.IsControlTextEmpty(txtEmail))
            {
                clsUtility.ShowInfoMessage("Enter E-Mail Address.", clsUtility.strProjectTitle);
                txtEmail.Focus();
                return(false);
            }
            else if (!ObjUtil.ValidateEmail(ValidatingEmailID))
            {
                clsUtility.ShowInfoMessage("Enter Valid E-Mail Address.", clsUtility.strProjectTitle);
                txtEmail.Focus();
                return(false);
            }
            else if (ObjUtil.IsControlTextEmpty(cmbSecurity))
            {
                clsUtility.ShowInfoMessage("Select Security question for password retrival.", clsUtility.strProjectTitle);
                cmbSecurity.Focus();
                return(false);
            }
            else if (ObjUtil.IsControlTextEmpty(txtAsnwer))
            {
                clsUtility.ShowInfoMessage("Enter Security's question.", clsUtility.strProjectTitle);
                txtAsnwer.Focus();
                return(false);
            }
            else
            {
                dt = ObjDAL.GetDataCol(clsUtility.DBName + ".dbo.UserManagement", "[UserName],[SecurityQuestion],[Answer],[Password],EmailID", "UserName='******'", null);
                if (ObjUtil.ValidateTable(dt))
                {
                    string SecurityQuestion, Answer, Password, EmailID;

                    SecurityQuestion = dt.Rows[0]["SecurityQuestion"].ToString();
                    Answer           = ObjUtil.Decrypt(dt.Rows[0]["Answer"].ToString(), true);
                    Password         = dt.Rows[0]["Password"].ToString();
                    EmailID          = dt.Rows[0]["EmailID"].ToString();

                    if (SecurityQuestion == cmbSecurity.SelectedItem.ToString() && Answer.ToLower() == txtAsnwer.Text.ToLower() && EmailID.ToLower() == txtEmail.Text.ToLower())
                    {
                        txtRetrivePassword.Text = ObjUtil.Decrypt(Password, true);
                    }
                    else
                    {
                        clsUtility.ShowInfoMessage("Entered details is not matching.", clsUtility.strProjectTitle);
                        return(false);
                    }
                }
                else
                {
                    clsUtility.ShowInfoMessage("Entered UserName or EmailID is not exist.", clsUtility.strProjectTitle);
                    return(false);
                }
                return(true);
            }
        }