예제 #1
0
        public static int Insert(UserElementEntity ueEntity)
        {
            if (ueEntity.UserElementDBEntity.Count == 0)
            {
                return 0;
            }

            //if (roleEntity.LogMessages == null)
            //{
            //    return 0;
            //}

            //if (CheckInsert(roleEntity) > 0)
            //{
            //    return 2;
            //}

            UserElementDBEntity dbParm = (ueEntity.UserElementDBEntity.Count > 0) ? ueEntity.UserElementDBEntity[0] : new UserElementDBEntity();

            DataCommand cmd = DataCommandManager.GetDataCommand("InsertToUserElement");

            cmd.SetParameterValue("@Role_ID", dbParm.RoleID);
            cmd.SetParameterValue("@User_Account", dbParm.UserAccount);
            cmd.SetParameterValue("@UE_Type", dbParm.UEType);
            cmd.SetParameterValue("@UE_Creator", dbParm.UECreator);

            int intCount = cmd.ExecuteNonQuery();

            return intCount;
        }
예제 #2
0
        //选择在当前角色的用户
        //public static DataSet SelectInRole()
        //{
        //    DataCommand cmd = DataCommandManager.GetDataCommand("SelectUserInRoleList");
        //    DataSet ds = cmd.ExecuteDataSet();
        //    return ds;
        //}
        //public static DataSet SelectNotInRole(string roleID, string searchText)
        //{
        //    DataCommand cmd = DataCommandManager.GetDataCommand("SelectUserNotInRoleList");
        //    cmd.SetParameterValue("@roleid", roleID);
        //    cmd.SetParameterValue("@SearchText", searchText);
        //    DataSet ds = cmd.ExecuteDataSet();
        //    return ds;
        //}
        public static UserElementEntity SelectInRole(UserElementEntity ueEntity)
        {
            UserElementDBEntity dbParm = (ueEntity.UserElementDBEntity.Count > 0) ? ueEntity.UserElementDBEntity[0] : new UserElementDBEntity();

            DataCommand cmd = DataCommandManager.GetDataCommand("SelectUserInRoleList");
            cmd.SetParameterValue("@roleid", dbParm.RoleID);
            ueEntity.QueryResult = cmd.ExecuteDataSet();
            return ueEntity;
        }
예제 #3
0
 public static int Delete(UserElementEntity ueEntity)
 {
     try
     {
         UserElementDBEntity dbParm = (ueEntity.UserElementDBEntity.Count > 0) ? ueEntity.UserElementDBEntity[0] : new UserElementDBEntity();
         DataCommand cmd = DataCommandManager.GetDataCommand("DeleteUserElementByUserAccount");//删除相应的UserAccount在Role中的信息。
         cmd.SetParameterValue("@Role_ID", dbParm.RoleID);
         cmd.SetParameterValue("@User_Account", dbParm.UserAccount);
         int intCount = cmd.ExecuteNonQuery();
         return intCount;
     }
     catch
     {
         return 0;
     }
 }
예제 #4
0
 //删除
 public static int Delete(UserElementEntity ueEntity)
 {
     ueEntity.LogMessages.MsgType = MessageType.INFO;
     ueEntity.LogMessages.Content = _nameSpaceClass + "delete";
     LoggerHelper.LogWriter(ueEntity.LogMessages);
     try
     {
         return UserElementDA.Delete(ueEntity);  //UserElementDA.Insert(ueEntity);
     }
     catch (Exception ex)
     {
         ueEntity.LogMessages.MsgType = MessageType.ERROR;
         ueEntity.LogMessages.Content = _nameSpaceClass + "delete  Error: " + ex.Message;
         LoggerHelper.LogWriter(ueEntity.LogMessages);
         throw ex;
     }
 }
예제 #5
0
        public static UserElementEntity SelectNotInRole(UserElementEntity ueEntity,string searchText)
        {
            ueEntity.LogMessages.MsgType = MessageType.INFO;
            ueEntity.LogMessages.Content = _nameSpaceClass + "Select not in role";
            LoggerHelper.LogWriter(ueEntity.LogMessages);

            try
            {
                return UserElementDA.SelectNotInRole(ueEntity, searchText);
            }
            catch (Exception ex)
            {
                ueEntity.LogMessages.MsgType = MessageType.ERROR;
                ueEntity.LogMessages.Content = _nameSpaceClass + "Select not in role Error: " + ex.Message;
                LoggerHelper.LogWriter(ueEntity.LogMessages);
                throw ex;
            }
        }
    //增加新用户,执行方法
    private void addUser(string strUserAccount, string strUserName, string strEmail, string strPwd, string strHRID, string strTel, string strTitle, string strUserManager)
    {
        strUserAccount = CommonFunction.StringFilter(strUserAccount);
        strUserName = CommonFunction.StringFilter(strUserName);
        strEmail = CommonFunction.StringFilter(strEmail);

        DataCommand cmd = DataCommandManager.GetDataCommand("InsertCmsUser");
        cmd.SetParameterValue("@User_Account", strUserAccount);
        cmd.SetParameterValue("@User_Pwd", strPwd);
        cmd.SetParameterValue("@User_DspName", strUserName);
        cmd.SetParameterValue("@User_Email", strEmail);
        cmd.SetParameterValue("@User_HRID", strHRID);
        cmd.SetParameterValue("@User_Tel", strTel);
        cmd.SetParameterValue("@User_Title", strTitle);
        cmd.SetParameterValue("@User_Manager", strUserManager);
        int i = cmd.ExecuteNonQuery();

        if (!String.IsNullOrEmpty(ddpRole.SelectedValue))
        {
            UserElementEntity _ueEntity = new UserElementEntity();
            _ueEntity.LogMessages = new HotelVp.Common.Logger.LogMessage();
            _ueEntity.LogMessages.Userid = UserSession.Current.UserAccount;
            _ueEntity.LogMessages.Username = UserSession.Current.UserDspName;
            _ueEntity.LogMessages.IpAddress = UserSession.Current.UserIP;
            _ueEntity.UserElementDBEntity = new List<UserElementDBEntity>();
            UserElementDBEntity ueDBEntity = new UserElementDBEntity();
            ueDBEntity.RoleID = ddpRole.SelectedValue;
            ueDBEntity.UserAccount = strUserAccount;
            ueDBEntity.UEType = "0";
            ueDBEntity.UECreator = UserSession.Current.UserAccount;

            _ueEntity.UserElementDBEntity.Add(ueDBEntity);
            int intResult = UserElementBP.Insert(_ueEntity);
        }
    }