コード例 #1
0
ファイル: UserType.cs プロジェクト: ArsenShnurkov/deveeldb
        public UserType(UserTypeInfo typeInfo)
            : base(typeInfo.TypeName.FullName, SqlTypeCode.Type)
        {
            if (typeInfo == null)
                throw new ArgumentNullException("typeInfo");

            TypeInfo = typeInfo;
        }
コード例 #2
0
        protected override bool OnSetUp(string testName, IQuery query)
        {
            var typeName = ObjectName.Parse("APP.type1");
            var typeInfo = new UserTypeInfo(typeName);

            typeInfo.AddMember("a", PrimitiveTypes.Integer());
            typeInfo.AddMember("b", PrimitiveTypes.DateTime());
            query.Access().CreateObject(typeInfo);

            return(true);
        }
コード例 #3
0
        protected override void OnAfterSetup(string testName)
        {
            if (testName == "UnderType")
            {
                var typeName = ObjectName.Parse("APP.parentType");
                var typeInfo = new UserTypeInfo(typeName);
                typeInfo.AddMember("id", PrimitiveTypes.Integer());
                typeInfo.AddMember("name", PrimitiveTypes.String());

                AdminQuery.Access().CreateObject(typeInfo);
            }

            base.OnAfterSetup(testName);
        }
コード例 #4
0
        protected override bool OnSetUp(string testName, IQuery query)
        {
            if (testName.EndsWith("WithUserType"))
            {
                var typeName = ObjectName.Parse("APP.type1");
                var typeInfo = new UserTypeInfo(typeName);
                typeInfo.AddMember("a", PrimitiveTypes.String());
                typeInfo.AddMember("b", PrimitiveTypes.Integer());

                query.Access().CreateObject(typeInfo);
            }

            CreateTestTable(query, testName);
            return(true);
        }
コード例 #5
0
        protected override void ExecuteStatement(ExecutionContext context)
        {
            //if (!context.User.CanCreateInSchema(TypeName.ParentName))
            //	throw new SecurityException(String.Format("The user '{0}' has no rights to create in schema '{1}'.",
            //		context.User.Name, TypeName.ParentName));

            if (ParentTypeName != null)
            {
                if (!context.DirectAccess.TypeExists(ParentTypeName))
                {
                    throw new StatementException(String.Format("The type '{0}' inherits from the type '{1}' that does not exist.",
                                                               TypeName, ParentTypeName));
                }

                if (context.DirectAccess.IsTypeSealed(ParentTypeName))
                {
                    throw new StatementException(String.Format("The type '{0}' is sealed and cannot be inherited by '{1}'.",
                                                               ParentTypeName, TypeName));
                }
            }

            if (context.DirectAccess.TypeExists(TypeName))
            {
                if (!ReplaceIfExists)
                {
                    throw new StatementException(String.Format("The type '{0}' already exists.", TypeName));
                }

                context.DirectAccess.DropType(TypeName);
            }

            var typeInfo = new UserTypeInfo(TypeName, ParentTypeName)
            {
                IsAbstract = IsAbstract,
                IsSealed   = IsSealed
            };

            foreach (var member in Members)
            {
                typeInfo.AddMember(member);
            }

            typeInfo.Owner = context.User.Name;

            context.DirectAccess.CreateType(typeInfo);
            context.DirectAccess.GrantOn(DbObjectType.Type, TypeName, context.User.Name, PrivilegeSets.TableAll, true);
        }
コード例 #6
0
        //获取所有会员类型
        public List <UserTypeInfo> getUserTypeInfo()
        {
            List <Model.UserTypeInfo> list = new List <UserTypeInfo>();

            using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, PROC_GETUSERTYPE, null))
            {
                while (dr.Read())
                {
                    Model.UserTypeInfo item = new UserTypeInfo();
                    item.UserTypeId   = Convert.ToInt32(dr["UserTypeId"]);
                    item.UserTypeName = dr["UserTypeName"].ToString();

                    list.Add(item);
                }
            }
            return(list);
        }
コード例 #7
0
    private AddUserOptions GetOptions()
    {
        AddUserOptions options = new AddUserOptions();
        UserTypeInfo   info    = UserTypeInfo.GetTypeInfoFromCode(lbxUserType.SelectedValue);

        options.UserType = info.UserType;
        if (String.IsNullOrEmpty(ddlQuantity.SelectedValue))
        {
            options.Quantity = 1;
        }
        else
        {
            options.Quantity = System.Convert.ToInt32(ddlQuantity.SelectedValue);
        }
        if (chkCreateFromProfile.Checked)
        {
            options.CreateFromProfile = true;
            if (rdoProfileFrom.SelectedValue == "U")
            {
                if (string.IsNullOrEmpty(lueAddUser.LookupResultValue.ToString()))
                {
                    throw new ValidationException(GetLocalResourceObject("lueAddUser.Validate").ToString());
                }
                options.TemplateID = lueAddUser.LookupResultValue.ToString();
            }
            else
            {
                options.TemplateID = lbxTemplates.SelectedValue;
            }
        }
        else
        {
            options.CreateFromProfile = false;
            options.TemplateID        = string.Empty;
        }
        options.UseGeneralProfile       = chkGeneral.Checked;
        options.UseEmployeeProfile      = chkEmployee.Checked;
        options.UseCalendarProfile      = chkCalender.Checked;
        options.UseClientOptionsProfile = chkClientOptions.Checked;
        options.UseSecurityProfile      = chkSecurity.Checked;
        options.UseSupportProfile       = chkServiceAndSupport.Checked;
        options.UseTeamsProfile         = chkTeams.Checked;
        return(options);
    }
コード例 #8
0
 /// <summary>
 /// 用户类型转换字符串
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static string ConverterUserType(UserTypeInfo info)
 {
     switch (info)
     {
         case UserTypeInfo.RootType:
             return "超级管理员";
             break;
         case UserTypeInfo.AdminType:
             return "管理员类型";
             break;
         case UserTypeInfo.OrgType:
             return "会员类型";
             break;
         case UserTypeInfo.NormalType:
             return "普通类型";
             break;
     }
     return "普通类型";
 }
コード例 #9
0
        public IActionResult GetUserType()
        {
            UserTypeInfo type = new UserTypeInfo();

            if (User.FindFirstValue("cid") != null)
            {
                type.user_type = "client";
            }
            else if (User.FindFirstValue("bid") != null)
            {
                type.user_type = "business";
            }
            else
            {
                return(BadRequest(new ResultBody("Function does not support this type of user.")));
            }

            return(Ok(type));
        }
コード例 #10
0
 /// <summary>
 /// 用户类型转换
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public static Gss.BusinessService.ManagementService.UserType  ConverterUserType(UserTypeInfo info)
 {
     switch(info)
     {
         case UserTypeInfo.AdminType:
             return Gss.BusinessService.ManagementService.UserType.AdminType;
             break;
         case UserTypeInfo.NormalType:
             return Gss.BusinessService.ManagementService.UserType.NormalType;
             break;
         case UserTypeInfo.OrgType:
             return Gss.BusinessService.ManagementService.UserType.OrgType;
             break;
         case UserTypeInfo.RootType:
             return Gss.BusinessService.ManagementService.UserType.RootType;
             break;
     }
     return Gss.BusinessService.ManagementService.UserType.NormalType;
 }
コード例 #11
0
        private void CreateAccount(UserTypeInfo info)
        {
            ClientAccount newClient = CreateClientAcc();
            ClientAccountInfoWindow clientView = new ClientAccountInfoWindow
            {
                POrgList=this.POrgList,
                Owner = Application.Current.MainWindow,
                DataContext = newClient,
                CreateMode = true,
            };

            if (clientView.ShowDialog() == true)
            {
                newClient.AccInfo.UserID = Guid.NewGuid().ToString("n");
                ErrType err = _businessService.AddClientAccount(newClient, info, _loginID);
                if (err == GeneralErr.Success)
                    AddClientAccount(UserBaseInfo.TdUserList, newClient);
                else
                {
                    MessageBox.Show(err.ErrMsg, err.ErrTitle, MessageBoxButton.OK, MessageBoxImage.Warning);
                    CreateClientAccountExecute();
                }

            }
        }
コード例 #12
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="d"></param>
        /// <returns></returns>
        public int Upt(UserTypeInfo u)
        {
            string sql = string.Format("update UserTypeInfo set UserTypeName='{0}' where Id='{1}'", u.UserTypeName, u.UserTypeId);

            return(db.ExecuteNonQuery(sql));
        }
コード例 #13
0
        /// <summary>
        /// 添加用户状态
        /// </summary>
        /// <returns></returns>
        public int Add(UserTypeInfo u)
        {
            string sql = string.Format("insert into UserTypeInfo values('{0}')", u.UserTypeName);

            return(db.ExecuteNonQuery(sql));
        }
コード例 #14
0
 /// <summary>
 /// 添加用户状态
 /// </summary>
 /// <returns></returns>
 public int Add(UserTypeInfo u)
 {
     return(dal.Add(u));
 }
コード例 #15
0
 public void CreateType(UserTypeInfo typeInfo)
 {
     CreateObject(typeInfo);
 }
コード例 #16
0
        /// <summary>
        /// 用户类型转换
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public static Gss.BusinessService.ManagementService.UserType  ConverterUserType(UserTypeInfo info)
        {
            switch (info)
            {
            case UserTypeInfo.AdminType:
                return(Gss.BusinessService.ManagementService.UserType.AdminType);

                break;

            case UserTypeInfo.NormalType:
                return(Gss.BusinessService.ManagementService.UserType.NormalType);

                break;

            case UserTypeInfo.OrgType:
                return(Gss.BusinessService.ManagementService.UserType.OrgType);

                break;

            case UserTypeInfo.RootType:
                return(Gss.BusinessService.ManagementService.UserType.RootType);

                break;
            }
            return(Gss.BusinessService.ManagementService.UserType.NormalType);
        }
コード例 #17
0
 /// <summary>
 /// 修改
 /// </summary>
 /// <param name="d"></param>
 /// <returns></returns>
 public int Upt(UserTypeInfo u)
 {
     return(dal.Upt(u));
 }
コード例 #18
0
 /// <summary>
 /// 新增客户账号
 /// </summary>
 /// <param name="clientAcc">新增的客户资料信息</param>
 /// <param name="Fdinfo">资金信息</param>
 /// <param name="type">账户类型</param>
 /// <param name="loginID">登录标识</param>
 /// <returns></returns>
 public ErrType AddClientAccount(ClientAccount clientAcc, FundsInformation Fdinfo, UserTypeInfo type, string loginID)
 {
     try
     {
         UserType uType = EnumConverter.ConverterUserType(type);
         TradeUser userInfo = MyConverter.ToTradeUser(clientAcc);
         Fundinfo finfo = new Fundinfo();
         finfo.OpenBank = Fdinfo.OpenBank;
         finfo.BankCard = Fdinfo.BankCardNumber;
         finfo.ConBankType = Fdinfo.banktype;
         ResultDesc result = ManagerService.AddTradeUserEx(userInfo, finfo, uType, loginID);
         return result.Result ? GeneralErr.Success : new ErrType(ERR.SERVICE, result.Desc);
     }
     catch (TimeoutException te)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name, te.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.TimeoutException);
     }
     catch (Exception ex)
     {
         FileLog.WriteLog("", Assembly.GetExecutingAssembly().GetName().Name, this.GetType().Name,
      new StackTrace().GetFrame(0).GetMethod().Name, ex.Message);
         return new ErrType(ERR.EXEPTION, ErrorText.OperationError);
     }
 }
コード例 #19
0
    private void LoadView()
    {
        if (lbxUserType.Items.Count < 1)
        {
            var userTypes = UserTypeInfo.GetUserTypes();

            foreach (UserTypeInfo info in userTypes.Values)
            {
                if ((info.UserType != UserType.Admin) && (info.UserType != UserType.Retired))
                {
                    ListItem item = new ListItem(info.DisplayName, info.Code);
                    lbxUserType.Items.Add(item);
                }
            }
            lbxUserType.SelectedIndex = 0;
            lbxUserType.Focus();
        }



        if (lbxTemplates.Items.Count < 1)
        {
            var templateList = UserManagementService.GetTemplates();
            foreach (IUser temp in templateList)
            {
                lbxTemplates.Items.Add(new ListItem(temp.UserInfo.UserName, temp.Id.ToString()));
            }
            if (lbxTemplates.Items.Count > 0)
            {
                lbxTemplates.SelectedIndex = 0;
            }
        }

        if (rdoProfileFrom.SelectedValue == "U")
        {
            div_Templates_lbl.Style.Add("display", "none");
            div_Users_lbl.Style.Add("display", "block");
            div_Templates_Ctrl.Style.Add("display", "none");
            div_Users_Ctrl.Style.Add("display", "block");
        }
        else
        {
            div_Templates_lbl.Style.Add("display", "block");
            div_Users_lbl.Style.Add("display", "none");
            div_Templates_Ctrl.Style.Add("display", "block");
            div_Users_Ctrl.Style.Add("display", "none");
        }



        SetProfileTabs(chkCreateFromProfile.Checked);

        bool canAdd = false;

        if (lbxUserType.SelectedItem != null)
        {
            UserTypeInfo utInfo   = UserTypeInfo.GetTypeInfoFromCode(lbxUserType.SelectedItem.Value);
            int          addCount = System.Convert.ToInt32(ddlQuantity.SelectedValue);
            int          licCount = UserManagementService.GetLicenseAvailableCount(utInfo.UserType);
            if (addCount < 1)
            {
                canAdd = false;
            }
            else
            {
                if (UserManagementService.IsLicenseAvailable(utInfo.UserType, addCount))
                {
                    canAdd = true;
                }
            }

            if (utInfo.UserType == UserType.Template)
            {
                lblAvailableLic.Text = GetLocalResourceObject("LicNotRequired").ToString();
            }
            else
            {
                if (utInfo.UserType == UserType.Concurrent)
                {
                    lblAvailableLic.Style.Remove("color");
                    lblAvailableLic.Text = string.Format(GetLocalResourceObject("LicAvailable").ToString(), UserManagementService.GetLicenseCount(UserType.Concurrent));
                }
                else
                {
                    if (licCount >= addCount)
                    {
                        lblAvailableLic.Style.Remove("color");
                        lblAvailableLic.Text = string.Format(GetLocalResourceObject("LicAvailable").ToString(), licCount);
                    }
                    else
                    {
                        lblAvailableLic.Style.Add("color", "Red");
                        lblAvailableLic.Text = string.Format(GetLocalResourceObject("LicTooFewAvailable").ToString(), licCount);
                    }
                }
            }
        }

        int    addCount2 = System.Convert.ToInt32(ddlQuantity.SelectedValue);
        string plural    = string.Empty;

        if (addCount2 > 1)
        {
            plural = GetLocalResourceObject("plural").ToString();
        }

        string processMsg = string.Format(GetLocalResourceObject("lblProcessing.Text").ToString(), System.Convert.ToInt32(ddlQuantity.SelectedValue), lbxUserType.SelectedItem.Text, plural);

        btnOk.OnClientClick = string.Format("addUser_OkClick('{0}', '{1}','{2}')", divStep1.ClientID, divStep2.ClientID, Sage.Platform.WebPortal.PortalUtil.JavaScriptEncode(processMsg));

        div_Req.Style.Add("display", "none");
        if (chkCreateFromProfile.Checked)
        {
            if (rdoProfileFrom.SelectedValue == "U")
            {
                if (string.IsNullOrEmpty(lueAddUser.LookupResultValue.ToString()))
                {
                    div_Req.Style.Add("display", "block");
                    canAdd = false;
                }
            }
            else
            {
                if (string.IsNullOrEmpty(lbxTemplates.SelectedValue))
                {
                    div_Req.Style.Add("display", "block");
                    canAdd = false;
                }
            }
        }
        btnOk.Enabled = canAdd;
    }