private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objUser = new tblUser();
         if (objUser.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtFullName.Text      = objUser.AppFullName;
             txtMobileNo.Text      = objUser.AppMobile;
             txtEmailAddress.Text  = objUser.AppEmail;
             txtAddress.Text       = objUser.AppAddress;
             imgUserPhoto.ImageUrl = objUser.s_AppPhoto;
         }
         objUser = null;
     }
 }
    private bool SaveData()
    {
        objClsCommon = new clsCommon();
        objUser      = new tblUser();

        if (objClsCommon.IsRecordExists("tblUser", tblUser.ColumnNames.AppEmail, tblUser.ColumnNames.AppUserId, txtEmailAddress.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("Email Address is already exists", Enums.MessageType.Warning);
            return(false);
        }

        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objUser.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }


        objUser.AppFullName = txtFullName.Text;
        objUser.AppMobile   = txtMobileNo.Text;
        objUser.AppEmail    = txtEmailAddress.Text;
        objUser.AppAddress  = txtAddress.Text;
        if (FileUploadImg.HasFile)
        {
            objClsCommon = new clsCommon();
            string strError = "";
            string Time     = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second);
            string strPath  = objClsCommon.FileUpload_Images(FileUploadImg.PostedFile, txtFullName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/Employee/", ref strError, 0, objUser.s_AppPhoto);
            if (strError == "")
            {
                objUser.AppPhoto = strPath;
            }
            else
            {
                DInfo.ShowMessage(strError, Enums.MessageType.Error);
                return(false);
            }
        }
        objUser.Save();
        hdnPKID.Value = objUser.AppUserId.ToString();
        objUser       = null;
        return(true);
    }
    private void SetValuesToControls()
    {
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objUser = new tblUser();
            if (objUser.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
            {
                txtUserName.Text = objUser.AppUserName;
                objEncrypt       = new clsEncryption();
                txtPassword.Attributes.Add("value", objEncrypt.Decrypt(objUser.AppPassword, appFunctions.strKey));
                ddlRoleName.SelectedValue = objUser.s_AppRoleId;

                txtFullName.Text      = objUser.AppFullName;
                txtMobileNo.Text      = objUser.AppMobile;
                txtEmailAddress.Text  = objUser.AppEmail;
                txtAddress.Text       = objUser.AppAddress;
                chkIsActive.Checked   = objUser.AppIsActive;
                imgUserPhoto.ImageUrl = objUser.s_AppPhoto;
                txtDescription.Text   = objUser.AppDescription;
            }
            objUser = null;
        }
    }