private void saveUnits()
    {
        string _listValue = _hListValue.Value;
        string[] _listItem = _listValue.Split(';');

        if (_rdoUnitGroup.Checked)
        {
            ProcessUserGroupUnits _processGroup = new ProcessUserGroupUnits(AlarmasABC.BLL.InvokeOperations.operations.INSERT);
            try
            {
                for (int i = 0; i < _listItem.Length - 1; i++)
                {
                    _processGroup.ComID = int.Parse(Session["trkCompany"].ToString());
                    _processGroup.GroupID = int.Parse(_listItem[i].ToString());
                    _processGroup.UserID = uID;
                    _processGroup.invoke();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            finally
            {
                _processGroup = null;
            }
        }
        else if (_rdoUnits.Checked)
        {
            ProcessUsersUnitData _units = new ProcessUsersUnitData();
            try
            {
                for (int i = 0; i < _listItem.Length - 1; i++)
                {
                    _units.UnitID = int.Parse(_listItem[i].ToString());
                    _units.ComID = int.Parse(Session["trkCompany"].ToString());
                    _units.invoke();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
            finally
            {
                _units = null;
            }
        }
    }
    private void saveUserGroupWiseUnits()
    {
        ProcessUserGroupUnits _UserGroupUnits = new ProcessUserGroupUnits(AlarmasABC.BLL.InvokeOperations.operations.INSERT);

        try
        {
            _UserGroupUnits.ComID = int.Parse(Session["trkCompany"].ToString());
            _UserGroupUnits.GroupID = int.Parse(_ddlGroup.SelectedValue);
            _UserGroupUnits.invoke();
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }

        finally
        {
            _UserGroupUnits = null;
        }
    }
Пример #3
0
    private void createUser(string fullName, string name, string password, string email,
        int unitGroupID, int userGroupID, int securityQuestion,
        string securityAnswer)
    {
        User _user = new User();
        ProcessUser _processUser = new ProcessUser(AlarmasABC.BLL.InvokeOperations.operations.INSERT);

        try
        {
            _user.Login = name;
            _user.UserName = fullName;
            _user.ComID = comID;
            _user.GroupID = userGroupID;
            _user.Email = email;
            _user.IsActive = true;
            _user.RoleID = 3;
            _user.Password = EncDec.GetEncryptedText(password);
            _user.SecurityQuestion = int.Parse(ddlSecurityQuestion.SelectedValue);
            _user.SecurityScheme = getDefaultSecurityScheme();
            _user.SecurityAnswer = securityAnswer;

            _processUser.UserObj = _user;
            _processUser.invoke();

            int uID = _processUser.UID;

            ProcessUserGroupUnits _processGroup = new ProcessUserGroupUnits(AlarmasABC.BLL.InvokeOperations.operations.INSERT);
            _processGroup.ComID = comID;
            _processGroup.GroupID = unitGroupID;
            _processGroup.UserID = uID;
            _processGroup.invoke();

            Mailer.SendWelcomeMail(_user.Email, _user.Login, password, comID.ToString());
        }
        catch (Exception ex)
        {
            throw new Exception("CreateNewAccount::createUser(): " + ex.Message.ToString());
        }
        finally
        {
            _user = null;
            _processUser = null;
        }
    }