Пример #1
0
        public void UpdateUserDetails(int argnID, string argUsername, string argUserShortID, string argPassword, int argDepartID, string argContactNumber, string argEmail, int argDesignationID, int argLevelID, int argCreatedBy)
        {
            ValidationException error = new ValidationException();
            UserMaster          Table = new UserMaster();

            if (Validations.IsEmpty(argUserShortID))
            {
                error.AddError("Enter Short ID");
            }

            if (Validations.IsEmpty(argUsername))
            {
                error.AddError("Enter User Name");
            }

            if (Validations.IsEmpty(argPassword))
            {
                error.AddError("Enter Password");
            }

            if (Validations.IsEmpty(argContactNumber))
            {
                error.AddError("Enter ContactNumber");
            }

            if (Validations.IsEmpty(argEmail))
            {
                error.AddError("Enter Email");
            }

            if (!Validations.IsEmail(argEmail, true).IsValid)
            {
                error.AddError("Enter Valid Email ID");
            }

            if (!Validations.IsNumber(argContactNumber))
            {
                error.AddError("Enter Number only");
            }

            if (!error.isValid)
            {
                throw error;
            }

            DataSet DSUserCheck = Table.CheckshortID(argUsername);

            if (DSUserCheck != null && DSUserCheck.Tables.Count > 0)
            {
                if (int.Parse(DSUserCheck.Tables[0].Rows[0]["Cnt"].ToString()) > 0)
                {
                    throw new UserNonAvailabiltyException();
                }
                else
                {
                    Table.Connection.beginTransact();
                }
            }
            try
            {
                Table.UpdateUserDetails(argnID, argUsername, argUserShortID, argPassword.Encrypt(), argDepartID, argContactNumber, argEmail, argDesignationID, argLevelID, argCreatedBy);
                Table.Connection.commit();
            }
            catch (Exception ex)
            {
                Table.Connection.rollback();
                throw ex;
            }
        }