Example #1
0
        public static string GetManageRoleView(ManageRole role)
        {
            string viewName = string.Empty;

            switch (role)
            {
            case ManageRole.None:
                viewName = "未知";
                break;

            case ManageRole.News:
                viewName = "新闻管理";
                break;

            case ManageRole.Financial:
                viewName = "财务管理";
                break;

            case ManageRole.Interfaces:
                viewName = "接口管理";
                break;

            case ManageRole.Merchant:
                viewName = "商户管理";
                break;

            case ManageRole.Orders:
                viewName = "订单管理";
                break;

            case ManageRole.Report:
                viewName = "统计报表";
                break;

            case ManageRole.System:
                viewName = "系统管理";
                break;
                //case ManageRole.SuperAdmin:
                //    viewName = "超级管理员";
                //    break;
            }
            return(viewName);
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            string username = this.txtusername.Text.Trim();
            string realName = this.txtrelname.Text.Trim();

            string password = this.txtpassword.Text.Trim();
            string secPwd   = this.txtpassword2.Text.Trim();

            ManageRole role = ManageRole.None;

            foreach (ListItem listItem in cbl_roles.Items)
            {
                if (listItem.Selected)
                {
                    if (role == ManageRole.None)
                    {
                        role = (ManageRole)Convert.ToInt32(listItem.Value);
                    }
                    else
                    {
                        role = role | (ManageRole)Convert.ToInt32(listItem.Value);
                    }
                }
            }
            ItemInfo.username = username;

            if (IsUpdate == false)
            {
                if (!string.IsNullOrEmpty(password))
                {
                    ItemInfo.password = Cryptography.MD5(password);
                }
                if (!string.IsNullOrEmpty(secPwd))
                {
                    ItemInfo.secondpwd = Cryptography.MD5(secPwd);
                }
            }

            ItemInfo.relname        = realName;
            ItemInfo.role           = role;
            ItemInfo.commissiontype = int.Parse(this.ddlCommissionType.SelectedValue);
            decimal commission = 0M;

            if (!decimal.TryParse(this.txtCommission.Text.Trim(), out commission))
            {
                ShowMessageBox("请输入数字");
                return;
            }
            decimal _cardcommission = 0M;

            if (!decimal.TryParse(this.txtCardCommission.Text.Trim(), out _cardcommission))
            {
                ShowMessageBox("请输入数字");
                return;
            }
            ItemInfo.cardcommission = _cardcommission;
            ItemInfo.commission     = commission;
            ItemInfo.status         = int.Parse(this.ddlStus.SelectedValue);
            ItemInfo.isSuperAdmin   = this.ckb_SuperAdmin.Checked ? 1 : 0;
            ItemInfo.isAgent        = this.ckb_Agent.Checked ? 1 : 0;



            bool success = false;

            if (this.IsUpdate)
            {
                if (viviapi.BLL.ManageFactory.Update(ItemInfo))
                {
                    success = true;
                }
            }
            else
            {
                if (viviapi.BLL.ManageFactory.Add(ItemInfo) > 0)
                {
                    success = true;
                }
            }
            if (success)
            {
                AlertAndRedirect("操作成功", "List.aspx");
            }
            else
            {
                AlertAndRedirect("操作失败");
            }
        }