Esempio n. 1
0
        public string MD5Crypt(string PasswordSalt)
        {
            MD5CryptEncrypt encode_obj   = new MD5CryptEncrypt();
            string          PasswordHash = encode_obj.getMd5Hash(PasswordSalt);

            return(PasswordHash);
        }
Esempio n. 2
0
        public void CheckLogin(string Email, string Password, out int status, out string o_userid, out string o_custname)
        {
            try
            {
                MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
                string HashedPassword = md5_obj.getMd5Hash(Password);
                //md5_obj.verifyMd5Hash(source, hash);

                SqlCommand cmd = new SqlCommand("[Sales].[Customers_CheckLogin]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
                cmd.Parameters.AddWithValue("@Email", Email);
                cmd.Parameters.AddWithValue("@HashedPassword", HashedPassword);
                cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int, 2) { Direction = ParameterDirection.Output });
                cmd.Parameters.Add(new SqlParameter("@o_userid", SqlDbType.NVarChar, int.MaxValue) { Direction = ParameterDirection.Output });
                cmd.Parameters.Add(new SqlParameter("@o_custname", SqlDbType.NVarChar, int.MaxValue) { Direction = ParameterDirection.Output });
                con.Open();
                cmd.ExecuteNonQuery();
                status = (int)cmd.Parameters["@o_return"].Value;
                o_userid = (string)cmd.Parameters["@o_userid"].Value;
                o_custname = (string)cmd.Parameters["@o_custname"].Value;
                con.Close();
            }
            catch (Exception ex)
            {
                EventLog objLog = new EventLog();
                objLog.LogError(ex);
                throw ex;
            }
        }
Esempio n. 3
0
        public int Insert(int VendorId, int ContactTypeId, string Email, string PasswordSalt, string Title, string FirstName, string MiddleName, string LastName,
                          string Phone)
        {
            MD5CryptEncrypt md5_obj      = new MD5CryptEncrypt();
            string          PasswordHash = md5_obj.getMd5Hash(PasswordSalt);

            SqlCommand cmd = new SqlCommand("[Person].[Contact_Insert]", con)
            {
                CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout
            };

            cmd.Parameters.AddWithValue("@VendorId", VendorId);
            cmd.Parameters.AddWithValue("@ContactTypeId", ContactTypeId);
            cmd.Parameters.AddWithValue("@Title", Title);
            cmd.Parameters.AddWithValue("@FirstName", FirstName);
            cmd.Parameters.AddWithValue("@MiddleName", MiddleName);
            cmd.Parameters.AddWithValue("@LastName", LastName);
            cmd.Parameters.AddWithValue("@EmailAddress", Email);
            cmd.Parameters.AddWithValue("@Phone", Phone);
            cmd.Parameters.AddWithValue("@PasswordHash", PasswordHash);
            cmd.Parameters.AddWithValue("@PasswordSalt", PasswordSalt);
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            });
            con.Open();
            cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;

            con.Close();
            return(retunvalue);
        }
Esempio n. 4
0
        private int UpdateData()
        {
            string FullName    = txtFullName.Text;
            string DisplayName = txtDisplayName.Text;
            string Address     = txtAddress.Text;
            string Phone       = txtPhone.Text;
            string Email       = txtEmail.Text;


            ModuleClass module_obj = new ModuleClass();
            string      Username   = string.Empty;

            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                Response.Write("<script>alert('Invalid Username');</script>");
                Response.End();
            }

            MD5CryptEncrypt md5_obj          = new MD5CryptEncrypt();
            string          Password         = md5_obj.getMd5Hash(txtPassword.Text);
            string          PasswordSalt     = txtPassword.Text;
            string          passwordConfirm  = txtPasswordConfirm.Text;
            string          PasswordQuestion = ddlPassQuestion.SelectedValue;
            string          PasswordAnswer   = txtPassAnswer.Text;

            UserController user_obj = new UserController();
            int            result   = user_obj.Edit(Username, Password, PasswordSalt, PasswordQuestion, PasswordAnswer,
                                                    FullName, DisplayName, Address, Phone, Email);

            return(result);
        }
Esempio n. 5
0
        public void CheckLogin(string Email, string Password, out int status, out string o_userid, out string o_custname)
        {
            try
            {
                MD5CryptEncrypt md5_obj        = new MD5CryptEncrypt();
                string          HashedPassword = md5_obj.getMd5Hash(Password);
                //md5_obj.verifyMd5Hash(source, hash);

                SqlCommand cmd = new SqlCommand("[Sales].[Customers_CheckLogin]", con)
                {
                    CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout
                };
                cmd.Parameters.AddWithValue("@Email", Email);
                cmd.Parameters.AddWithValue("@HashedPassword", HashedPassword);
                cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int, 2)
                {
                    Direction = ParameterDirection.Output
                });
                cmd.Parameters.Add(new SqlParameter("@o_userid", SqlDbType.NVarChar, int.MaxValue)
                {
                    Direction = ParameterDirection.Output
                });
                cmd.Parameters.Add(new SqlParameter("@o_custname", SqlDbType.NVarChar, int.MaxValue)
                {
                    Direction = ParameterDirection.Output
                });
                con.Open();
                cmd.ExecuteNonQuery();
                status     = (int)cmd.Parameters["@o_return"].Value;
                o_userid   = (string)cmd.Parameters["@o_userid"].Value;
                o_custname = (string)cmd.Parameters["@o_custname"].Value;
                con.Close();
            }
            catch (Exception ex)
            {
                EventLog objLog = new EventLog();
                objLog.LogError(ex);
                throw ex;
            }
        }
Esempio n. 6
0
        public int Insert(int VendorId, int ContactTypeId, string Email, string PasswordSalt, string Title, string FirstName, string MiddleName, string LastName,
                      string Phone)
        {
            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string PasswordHash = md5_obj.getMd5Hash(PasswordSalt);

            SqlCommand cmd = new SqlCommand("[Person].[Contact_Insert]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
            cmd.Parameters.AddWithValue("@VendorId", VendorId);
            cmd.Parameters.AddWithValue("@ContactTypeId", ContactTypeId);
            cmd.Parameters.AddWithValue("@Title", Title);
            cmd.Parameters.AddWithValue("@FirstName", FirstName);
            cmd.Parameters.AddWithValue("@MiddleName", MiddleName);
            cmd.Parameters.AddWithValue("@LastName", LastName);
            cmd.Parameters.AddWithValue("@EmailAddress", Email);
            cmd.Parameters.AddWithValue("@Phone", Phone);
            cmd.Parameters.AddWithValue("@PasswordHash", PasswordHash);
            cmd.Parameters.AddWithValue("@PasswordSalt", PasswordSalt);            
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int) { Direction = ParameterDirection.Output });
            con.Open();
            cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;
            con.Close();
            return retunvalue;
        }
        public string[] CheckUser(string UserName, string Password)
        {
            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string Hashed_Password = md5_obj.getMd5Hash(Password);
            string PageUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString();

            SqlCommand cmd = new SqlCommand("aspnet_Users_CheckUser", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
            cmd.Parameters.AddWithValue("@UserName", UserName);
            cmd.Parameters.AddWithValue("@Password", Hashed_Password);
            cmd.Parameters.AddWithValue("@PageUrl", PageUrl);
            cmd.Parameters.AddWithValue("@IPAddress", IP);
            cmd.Parameters.Add(new SqlParameter("@UserId", SqlDbType.Int) { Direction = ParameterDirection.Output });
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int) { Direction = ParameterDirection.Output });
            con.Open();
            int i = cmd.ExecuteNonQuery();
            string[] result = new string[3];
            result[0] = cmd.Parameters["@UserId"].Value.ToString();
            result[1] = cmd.Parameters["@o_return"].Value.ToString();
            con.Close();
            return result;
        }
        public string[] CheckLogin(string UserName, string Password)
        {
            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string Hashed_Password = md5_obj.getMd5Hash(Password);
            string PageUrl = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.ToString();

            SqlCommand cmd = new SqlCommand("aspnet_Users_CheckUserLogin", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
            cmd.Parameters.AddWithValue("@UserName", UserName);
            cmd.Parameters.AddWithValue("@Password", Hashed_Password);
            cmd.Parameters.AddWithValue("@PageUrl", PageUrl);
            cmd.Parameters.AddWithValue("@IPAddress", IP);
            cmd.Parameters.Add("@ApplicationId", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@UserId", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@RoleId", SqlDbType.NVarChar, 100).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@HomeDirectory", SqlDbType.VarChar, 100).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@PortalId", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@VendorId", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@IsSuperUser", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@UpdatePassword", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@IsDeleted", SqlDbType.Int).Direction = ParameterDirection.Output;
            cmd.Parameters.Add("@o_return", SqlDbType.Int).Direction = ParameterDirection.Output;
            con.Open();
            cmd.ExecuteNonQuery();
            string[] result = new string[10];
            result[0] = cmd.Parameters["@ApplicationId"].Value.ToString();
            result[1] = cmd.Parameters["@UserId"].Value.ToString();
            result[2] = cmd.Parameters["@RoleId"].Value.ToString();
            result[3] = cmd.Parameters["@PortalId"].Value.ToString();
            result[4] = cmd.Parameters["@VendorId"].Value.ToString();
            result[5] = cmd.Parameters["@HomeDirectory"].Value.ToString();
            result[6] = cmd.Parameters["@IsSuperUser"].Value.ToString();
            result[7] = cmd.Parameters["@UpdatePassword"].Value.ToString();
            result[8] = cmd.Parameters["@IsDeleted"].Value.ToString();
            result[9] = cmd.Parameters["@o_return"].Value.ToString();
            con.Close();
            return result;
        }
        private int UpdateData()
        {
            string ApplicationId = ddlApplicationList.SelectedValue;
            int    PortalId      = Convert.ToInt32(ddlPortalList.SelectedValue);
            int    VendorId      = Convert.ToInt32(ddlVendorList.SelectedValue);
            string RoleId        = ddlRoleList.SelectedValue;
            string FullName      = txtFullName.Text;
            string DisplayName   = txtDisplayName.Text;
            string MobilePIN     = txtMobilePIN.Text;
            string Address       = txtAddress.Text;
            string Phone         = txtPhone.Text;
            string Email         = txtEmail.Text;

            //=================================================
            bool _IsSuperUser = chkIsSuperUser.Checked;
            int  IsSuperUser;

            if (_IsSuperUser == true)
            {
                IsSuperUser = 1;
            }
            else
            {
                IsSuperUser = 0;
            }
            //=================================================
            bool _IsDeleted = chkIsDeleted.Checked;
            int  IsDeleted;

            if (_IsDeleted == true)
            {
                IsDeleted = 1;
            }
            else
            {
                IsDeleted = 0;
            }
            //=================================================
            bool _IsApproved = chkIsApproved.Checked;
            int  IsApproved;

            if (_IsApproved == true)
            {
                IsApproved = 1;
            }
            else
            {
                IsApproved = 0;
            }
            //=================================================
            bool _UpdatePassword = chkUpdatePassword.Checked;
            int  UpdatePassword;

            if (_UpdatePassword == true)
            {
                UpdatePassword = 1;
            }
            else
            {
                UpdatePassword = 0;
            }
            //=================================================
            bool _IsLockedOut = chkIsLockedOut.Checked;
            int  IsLockedOut;

            if (_IsLockedOut == true)
            {
                IsLockedOut = 1;
            }
            else
            {
                IsLockedOut = 0;
            }
            //=================================================
            ModuleClass module_obj = new ModuleClass();
            string      Username   = string.Empty;

            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                Response.Write("<script>alert('Invalid Username');</script>");
                Response.End();
            }

            MD5CryptEncrypt md5_obj          = new MD5CryptEncrypt();
            string          Password         = md5_obj.getMd5Hash(txtPassword.Text);
            string          PasswordSalt     = txtPassword.Text;
            string          passwordConfirm  = txtPasswordConfirm.Text;
            string          PasswordQuestion = ddlPassQuestion.SelectedValue;
            string          PasswordAnswer   = txtPassAnswer.Text;

            string Comment = txtComment.Text;

            UserController user_obj = new UserController();
            int            result   = user_obj.Update(_idx, ApplicationId, PortalId, VendorId, RoleId, Username,
                                                      Password, PasswordSalt, PasswordQuestion, PasswordAnswer,
                                                      FullName, DisplayName, Address, MobilePIN, Phone, Email,
                                                      IsSuperUser, UpdatePassword, IsDeleted, IsApproved, IsLockedOut, Comment);

            return(result);
        }
Esempio n. 10
0
        //INSERT- UPDATE - DELETE --------------------------------------------------------------------------
        public int Insert(string CreatedByUserId, int PortalId, string Category_Code, string VendorName, string AddressLine1, string AddressLine2,
                          int CountryId, string PostalCode, string Cell, string SupportOnline,
                          string Hotline, string Telephone, string Fax, string Email,
                          string Website, string KeyWords, int Authorized, string StoreName, string StoreCompanyName, string TaxCode,
                          string LogoFile, string Slogan, string CurrencyCode, string CurrencySymbol,
                          string Decimals, string DecimalSymbol, string ThousandSeparator, string PositiveFormat,
                          string NegativeFormat, string TermsOfService, string Description,
                          int ContactTypeId, string ContactEmail, string PasswordSalt, string Title, string FirstName, string MiddleName, string LastName,
                          string Phone)
        {
            MD5CryptEncrypt md5_obj      = new MD5CryptEncrypt();
            string          PasswordHash = md5_obj.getMd5Hash(PasswordSalt);

            SqlCommand cmd = new SqlCommand("[Purchasing].[Vendors_Insert]", con)
            {
                CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout
            };

            cmd.Parameters.AddWithValue("@PortalId", PortalId);
            cmd.Parameters.AddWithValue("@Category_Code", Category_Code);
            cmd.Parameters.AddWithValue("@VendorName", VendorName);
            cmd.Parameters.AddWithValue("@AddressLine1", AddressLine1);
            cmd.Parameters.AddWithValue("@AddressLine2", AddressLine2);
            cmd.Parameters.AddWithValue("@CountryId", CountryId);
            cmd.Parameters.AddWithValue("@PostalCode", PostalCode);
            cmd.Parameters.AddWithValue("@Cell", Cell);
            cmd.Parameters.AddWithValue("@SupportOnline", SupportOnline);
            cmd.Parameters.AddWithValue("@Hotline", Hotline);
            cmd.Parameters.AddWithValue("@Telephone", Telephone);
            cmd.Parameters.AddWithValue("@Fax", Fax);
            cmd.Parameters.AddWithValue("@Email", Email);
            cmd.Parameters.AddWithValue("@Website", Website);
            cmd.Parameters.AddWithValue("@KeyWords", KeyWords);
            cmd.Parameters.AddWithValue("@Authorized", Authorized);
            cmd.Parameters.AddWithValue("@StoreName", StoreName);
            cmd.Parameters.AddWithValue("@StoreCompanyName", StoreCompanyName);
            cmd.Parameters.AddWithValue("@TaxCode", TaxCode);
            cmd.Parameters.AddWithValue("@LogoFile", LogoFile);
            cmd.Parameters.AddWithValue("@Slogan", Slogan);
            cmd.Parameters.AddWithValue("@CurrencyCode", CurrencyCode);
            cmd.Parameters.AddWithValue("@CurrencySymbol", CurrencySymbol);
            cmd.Parameters.AddWithValue("@Decimals", Decimals);
            cmd.Parameters.AddWithValue("@DecimalSymbol", DecimalSymbol);
            cmd.Parameters.AddWithValue("@ThousandSeparator", ThousandSeparator);
            cmd.Parameters.AddWithValue("@PositiveFormat", PositiveFormat);
            cmd.Parameters.AddWithValue("@NegativeFormat", NegativeFormat);
            cmd.Parameters.AddWithValue("@TermsOfService", TermsOfService);
            cmd.Parameters.AddWithValue("@Description", Description);
            cmd.Parameters.AddWithValue("@CreatedIP", IP);
            cmd.Parameters.AddWithValue("@ContactTypeId", ContactTypeId);
            cmd.Parameters.AddWithValue("@Title", Title);
            cmd.Parameters.AddWithValue("@FirstName", FirstName);
            cmd.Parameters.AddWithValue("@MiddleName", MiddleName);
            cmd.Parameters.AddWithValue("@LastName", LastName);
            cmd.Parameters.AddWithValue("@EmailAddress", Email);
            cmd.Parameters.AddWithValue("@Phone", Phone);
            cmd.Parameters.AddWithValue("@PasswordHash", PasswordHash);
            cmd.Parameters.AddWithValue("@PasswordSalt", PasswordSalt);
            cmd.Parameters.AddWithValue("@CreatedByUserId", CreatedByUserId);
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int)
            {
                Direction = ParameterDirection.Output
            });
            con.Open();
            int i          = cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;

            con.Close();
            return(retunvalue);
        }
        private int UpdateData()
        {
            string ApplicationId = ddlApplicationList.SelectedValue;
            int PortalId = Convert.ToInt32(ddlPortalList.SelectedValue);
            int VendorId = Convert.ToInt32(ddlVendorList.SelectedValue);
            string RoleId = ddlRoleList.SelectedValue;
            string FullName = txtFullName.Text;
            string DisplayName = txtDisplayName.Text;                
            string MobilePIN = txtMobilePIN.Text;
            string Address = txtAddress.Text;
            string Phone = txtPhone.Text;
            string Email = txtEmail.Text;         

            //=================================================
            bool _IsSuperUser = chkIsSuperUser.Checked;                
            int IsSuperUser;
            if (_IsSuperUser == true)
            {
                IsSuperUser = 1;
            }
            else
            {
                IsSuperUser = 0;
            }
            //=================================================
            bool _IsDeleted = chkIsDeleted.Checked;
            int IsDeleted;
            if (_IsDeleted == true)
            {
                IsDeleted = 1;
            }
            else
            {
                IsDeleted = 0;
            }
            //=================================================
            bool _IsApproved = chkIsApproved.Checked;
            int IsApproved;
            if (_IsApproved == true)
            {
                IsApproved = 1;
            }
            else
            {
                IsApproved = 0;
            }
            //=================================================
            bool _UpdatePassword = chkUpdatePassword.Checked;
            int UpdatePassword;
            if (_UpdatePassword == true)
            {
                UpdatePassword = 1;
            }
            else
            {
                UpdatePassword = 0;
            }
            //=================================================
            bool _IsLockedOut = chkIsLockedOut.Checked;
            int IsLockedOut;
            if (_IsLockedOut == true)
            {
                IsLockedOut = 1;
            }
            else
            {
                IsLockedOut = 0;
            }
            //=================================================
            ModuleClass module_obj = new ModuleClass();
            string Username = string.Empty;
            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                Response.Write("<script>alert('Invalid Username');</script>");
                Response.End();
            }

            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string Password = md5_obj.getMd5Hash(txtPassword.Text);
            string PasswordSalt = txtPassword.Text;
            string passwordConfirm = txtPasswordConfirm.Text;
            string PasswordQuestion = ddlPassQuestion.SelectedValue;
            string PasswordAnswer = txtPassAnswer.Text;

            string Comment = txtComment.Text;

            UserController user_obj = new UserController();
            int result = user_obj.Update(_idx, ApplicationId, PortalId, VendorId, RoleId, Username,
            Password, PasswordSalt, PasswordQuestion, PasswordAnswer,
            FullName, DisplayName, Address, MobilePIN, Phone, Email,
            IsSuperUser, UpdatePassword,IsDeleted, IsApproved, IsLockedOut, Comment);           
            
            return result;

        }
        private int AddData()
        {          
            string ApplicationId = ddlApplicationList.SelectedValue;
            int PortalId = Convert.ToInt32(ddlPortalList.SelectedValue);
            int VendorId = Convert.ToInt32(ddlVendorList.SelectedValue);
            string RoleId = ddlRoleList.SelectedValue;
            string FullName = txtFullName.Text;
            string DisplayName = txtDisplayName.Text;                
            string MobilePIN = txtMobilePIN.Text;
            string Address = txtAddress.Text;
            string Phone = txtPhone.Text;
            string Email = txtEmail.Text;          

            bool _IsSuperUser = chkIsSuperUser.Checked;                
            int IsSuperUser;
            if (_IsSuperUser == true)
            {
                IsSuperUser = 1;
            }
            else
            {
                IsSuperUser = 0;
            }

            bool _IsDeleted = chkIsDeleted.Checked;
            int IsDeleted;
            if (_IsDeleted == true)
            {
                IsDeleted = 1;
            }
            else
            {
                IsDeleted = 0;
            }

            bool _IsApproved = chkIsApproved.Checked;
            int IsApproved;
            if (_IsApproved == true)
            {
                IsApproved = 1;
            }
            else
            {
                IsApproved = 0;
            }

            bool _UpdatePassword = chkUpdatePassword.Checked;
            int UpdatePassword;
            if (_UpdatePassword == true)
            {
                UpdatePassword = 1;
            }
            else
            {
                UpdatePassword = 0;
            }

            ModuleClass module_obj = new ModuleClass();
            string Username = string.Empty;
            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                string scriptCode = "<script>alert('Invalid Username.');</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", scriptCode);
            }

            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string Password = md5_obj.getMd5Hash(txtPassword.Text);
            string PasswordSalt = txtPassword.Text;
            string passwordConfirm = txtPasswordConfirm.Text;
            string PasswordQuestion = ddlPassQuestion.SelectedValue;
            string PasswordAnswer = txtPassAnswer.Text;

            string Comment = txtComment.Text;

            UserController user_obj = new UserController();
            int result = user_obj.Insert(ApplicationId, PortalId, VendorId, RoleId, Username, Password, PasswordSalt,
                PasswordQuestion, PasswordAnswer, FullName, DisplayName, Address, MobilePIN,
                Phone, Email, IsSuperUser, UpdatePassword, IsDeleted, IsApproved, Comment);  
            return result;
        }
Esempio n. 13
0
 public string MD5Crypt(string PasswordSalt)
 {
     MD5CryptEncrypt encode_obj = new MD5CryptEncrypt();
     string PasswordHash = encode_obj.getMd5Hash(PasswordSalt);
     return PasswordHash;
 }
Esempio n. 14
0
        private int AddData()
        {
            string ApplicationId = ddlApplicationList.SelectedValue;
            int    PortalId      = Convert.ToInt32(ddlPortalList.SelectedValue);
            int    VendorId      = Convert.ToInt32(ddlVendorList.SelectedValue);
            string RoleId        = ddlRoleList.SelectedValue;
            string FullName      = txtFullName.Text;
            string DisplayName   = txtDisplayName.Text;
            string MobilePIN     = txtMobilePIN.Text;
            string Address       = txtAddress.Text;
            string Phone         = txtPhone.Text;
            string Email         = txtEmail.Text;

            bool _IsSuperUser = chkIsSuperUser.Checked;
            int  IsSuperUser;

            if (_IsSuperUser == true)
            {
                IsSuperUser = 1;
            }
            else
            {
                IsSuperUser = 0;
            }

            bool _IsDeleted = chkIsDeleted.Checked;
            int  IsDeleted;

            if (_IsDeleted == true)
            {
                IsDeleted = 1;
            }
            else
            {
                IsDeleted = 0;
            }

            bool _IsApproved = chkIsApproved.Checked;
            int  IsApproved;

            if (_IsApproved == true)
            {
                IsApproved = 1;
            }
            else
            {
                IsApproved = 0;
            }

            bool _UpdatePassword = chkUpdatePassword.Checked;
            int  UpdatePassword;

            if (_UpdatePassword == true)
            {
                UpdatePassword = 1;
            }
            else
            {
                UpdatePassword = 0;
            }

            ModuleClass module_obj = new ModuleClass();
            string      Username   = string.Empty;

            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                string scriptCode = "<script>alert('Invalid Username.');</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "scriptName", scriptCode);
            }

            MD5CryptEncrypt md5_obj          = new MD5CryptEncrypt();
            string          Password         = md5_obj.getMd5Hash(txtPassword.Text);
            string          PasswordSalt     = txtPassword.Text;
            string          passwordConfirm  = txtPasswordConfirm.Text;
            string          PasswordQuestion = ddlPassQuestion.SelectedValue;
            string          PasswordAnswer   = txtPassAnswer.Text;

            string Comment = txtComment.Text;

            UserController user_obj = new UserController();
            int            result   = user_obj.Insert(ApplicationId, PortalId, VendorId, RoleId, Username, Password, PasswordSalt,
                                                      PasswordQuestion, PasswordAnswer, FullName, DisplayName, Address, MobilePIN,
                                                      Phone, Email, IsSuperUser, UpdatePassword, IsDeleted, IsApproved, Comment);

            return(result);
        }
        private int UpdateData()
        {           
            string FullName = txtFullName.Text;
            string DisplayName = txtDisplayName.Text;           
            string Address = txtAddress.Text;
            string Phone = txtPhone.Text;
            string Email = txtEmail.Text;

           
            ModuleClass module_obj = new ModuleClass();
            string Username = string.Empty;
            if (module_obj.CheckInput(txtUserName.Text))
            {
                Username = txtUserName.Text;
            }
            else
            {
                Response.Write("<script>alert('Invalid Username');</script>");
                Response.End();
            }

            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string Password = md5_obj.getMd5Hash(txtPassword.Text);
            string PasswordSalt = txtPassword.Text;
            string passwordConfirm = txtPasswordConfirm.Text;
            string PasswordQuestion = ddlPassQuestion.SelectedValue;
            string PasswordAnswer = txtPassAnswer.Text;

            UserController user_obj = new UserController();
            int result = user_obj.Edit(Username,Password, PasswordSalt, PasswordQuestion, PasswordAnswer,
                                 FullName, DisplayName, Address, Phone, Email);
            return result;

        }
Esempio n. 16
0
        //INSERT- UPDATE - DELETE --------------------------------------------------------------------------
        public int Insert(string CreatedByUserId, int PortalId, string Category_Code, string VendorName, string AddressLine1, string AddressLine2,
                        int CountryId, string PostalCode, string Cell, string SupportOnline,
                        string Hotline, string Telephone, string Fax, string Email,
                        string Website, string KeyWords, int Authorized, string StoreName, string StoreCompanyName, string TaxCode,
                        string LogoFile, string Slogan, string CurrencyCode, string CurrencySymbol,
                        string Decimals, string DecimalSymbol, string ThousandSeparator, string PositiveFormat,
                        string NegativeFormat, string TermsOfService, string Description,
                        int ContactTypeId, string ContactEmail, string PasswordSalt, string Title, string FirstName, string MiddleName, string LastName,
                      string Phone)
        {
            MD5CryptEncrypt md5_obj = new MD5CryptEncrypt();
            string PasswordHash = md5_obj.getMd5Hash(PasswordSalt);

            SqlCommand cmd = new SqlCommand("[Purchasing].[Vendors_Insert]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
            cmd.Parameters.AddWithValue("@PortalId", PortalId);
            cmd.Parameters.AddWithValue("@Category_Code", Category_Code);
            cmd.Parameters.AddWithValue("@VendorName", VendorName);
            cmd.Parameters.AddWithValue("@AddressLine1", AddressLine1);
            cmd.Parameters.AddWithValue("@AddressLine2", AddressLine2);
            cmd.Parameters.AddWithValue("@CountryId", CountryId);
            cmd.Parameters.AddWithValue("@PostalCode", PostalCode);
            cmd.Parameters.AddWithValue("@Cell", Cell);
            cmd.Parameters.AddWithValue("@SupportOnline", SupportOnline);
            cmd.Parameters.AddWithValue("@Hotline", Hotline);
            cmd.Parameters.AddWithValue("@Telephone", Telephone);
            cmd.Parameters.AddWithValue("@Fax", Fax);
            cmd.Parameters.AddWithValue("@Email", Email);
            cmd.Parameters.AddWithValue("@Website", Website);
            cmd.Parameters.AddWithValue("@KeyWords", KeyWords);
            cmd.Parameters.AddWithValue("@Authorized", Authorized);
            cmd.Parameters.AddWithValue("@StoreName", StoreName);
            cmd.Parameters.AddWithValue("@StoreCompanyName", StoreCompanyName);
            cmd.Parameters.AddWithValue("@TaxCode", TaxCode);
            cmd.Parameters.AddWithValue("@LogoFile", LogoFile);
            cmd.Parameters.AddWithValue("@Slogan", Slogan);
            cmd.Parameters.AddWithValue("@CurrencyCode", CurrencyCode);
            cmd.Parameters.AddWithValue("@CurrencySymbol", CurrencySymbol);
            cmd.Parameters.AddWithValue("@Decimals", Decimals);
            cmd.Parameters.AddWithValue("@DecimalSymbol", DecimalSymbol);
            cmd.Parameters.AddWithValue("@ThousandSeparator", ThousandSeparator);
            cmd.Parameters.AddWithValue("@PositiveFormat", PositiveFormat);
            cmd.Parameters.AddWithValue("@NegativeFormat", NegativeFormat);
            cmd.Parameters.AddWithValue("@TermsOfService", TermsOfService);
            cmd.Parameters.AddWithValue("@Description", Description);
            cmd.Parameters.AddWithValue("@CreatedIP", IP);
            cmd.Parameters.AddWithValue("@ContactTypeId", ContactTypeId);
            cmd.Parameters.AddWithValue("@Title", Title);
            cmd.Parameters.AddWithValue("@FirstName", FirstName);
            cmd.Parameters.AddWithValue("@MiddleName", MiddleName);
            cmd.Parameters.AddWithValue("@LastName", LastName);
            cmd.Parameters.AddWithValue("@EmailAddress", Email);
            cmd.Parameters.AddWithValue("@Phone", Phone);
            cmd.Parameters.AddWithValue("@PasswordHash", PasswordHash);
            cmd.Parameters.AddWithValue("@PasswordSalt", PasswordSalt);
            cmd.Parameters.AddWithValue("@CreatedByUserId", CreatedByUserId);
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int) { Direction = ParameterDirection.Output });
            con.Open();
            int i = cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;
            con.Close();
            return retunvalue;
        }