Ejemplo n.º 1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);//获取角色id
     if (id > 0)
     {
         table = rolebll.resourcelist(id);
     }
     if (!IsPostBack)
     {
         var dic = new SysRoleInfoBLL().GetField();
         this.Tax_cate.DataTextField  = "show";
         this.Tax_cate.DataValueField = "val";
         this.Tax_cate.DataSource     = dic.FirstOrDefault(_ => _.Key == "Tax_cate").Value;
         this.Tax_cate.DataBind();
         Tax_cate.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "   ", Selected = true
         });
         if (id > 0)//修改
         {
             role = new SysRoleInfoBLL().GetOneData(id);
             this.Role_Name.Text = role.name.ToString();
             if (Convert.ToInt32(role.is_active.ToString()) > 0)
             {
                 this.Active.Checked = true;
             }
             if (role.description != null && !string.IsNullOrEmpty(role.description.ToString()))
             {
                 this.Role_Description.Text = role.description.ToString();
             }
             if (role.tax_cate_id != null && !string.IsNullOrEmpty(role.tax_cate_id.ToString()))
             {
                 this.Tax_cate.SelectedValue = role.tax_cate_id.ToString();
             }
             this.Hourly_Billing_Rate.Text   = role.hourly_rate.ToString();
             this.Block_Hour_Multiplier.Text = role.hourly_factor.ToString();
             if (role.is_excluded > 0)
             {
                 this.Excluded.Checked = true;
             }
         }
         else
         {
             this.Active.Checked = true;
         }
     }
 }
Ejemplo n.º 2
0
        public void Exclude(HttpContext context, long exclude_id)
        {
            var result = new SysRoleInfoBLL().Exclude(exclude_id, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("从全部当前激活的合同中排除成功!");
            }
            else if (result == DTO.ERROR_CODE.CONTRACT_NO_ACTIVE)
            {
                context.Response.Write("当前不存在已经激活的合同!");
            }
            else
            {
                context.Response.Write("从全部当前激活的合同中排除失败!");
            }
        }
Ejemplo n.º 3
0
        public void No_Active(HttpContext context, long role_id)
        {
            var result = new SysRoleInfoBLL().NoAction(role_id, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("停用成功!");
            }
            else if (result == DTO.ERROR_CODE.NO_ACTIVATION)
            {
                context.Response.Write("已是停用状态,无需此操作!");
            }
            else
            {
                context.Response.Write("停用失败!");
            }
        }
Ejemplo n.º 4
0
        public void Active(HttpContext context, long role_id)
        {
            var result = new SysRoleInfoBLL().ActiveRole(role_id, LoginUserId);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("激活成功!");
            }
            else if (result == DTO.ERROR_CODE.ACTIVATION)
            {
                context.Response.Write("已是激活状态,无需此操作!");
            }
            else
            {
                context.Response.Write("激活失败!");
            }
        }
Ejemplo n.º 5
0
        public void Delete(HttpContext context, long role_delete_id)
        {
            string returnvalue = string.Empty;
            var    result      = new SysRoleInfoBLL().Delete(role_delete_id, LoginUserId, out returnvalue);

            if (result == DTO.ERROR_CODE.SUCCESS)
            {
                context.Response.Write("删除成功!");
            }
            else if (result == DTO.ERROR_CODE.EXIST)
            {
                context.Response.Write(returnvalue);
            }
            else
            {
                context.Response.Write("删除失败!");
            }
        }
Ejemplo n.º 6
0
 protected void SaveRole_Click(object sender, EventArgs e)
 {
     role.name = this.Role_Name.Text.Trim().ToString();
     if (this.Active.Checked)
     {
         role.is_active = 1;
     }
     else
     {
         role.is_active = 0;
     }
     if (!string.IsNullOrEmpty(this.Role_Description.Text.ToString()))
     {
         role.description = this.Role_Description.Text.Trim().ToString();
     }
     role.hourly_factor = Convert.ToDecimal(this.Block_Hour_Multiplier.Text.Trim().ToString());
     role.hourly_rate   = Convert.ToDecimal(this.Hourly_Billing_Rate.Text.Trim().ToString());
     if (Convert.ToInt32(this.Tax_cate.SelectedValue.ToString()) > 0)
     {
         role.tax_cate_id = Convert.ToInt32(this.Tax_cate.SelectedValue.ToString());
     }
     if (this.Excluded.Checked)
     {
         role.is_excluded = 1;
     }
     else
     {
         role.is_excluded = 0;
     }
     if (id > 0)
     {
         role.id = id;
         var result = new SysRoleInfoBLL().Update(role, GetLoginUserId());
         if (result == ERROR_CODE.ERROR)
         {
             Response.Write("<script>alert('修改失败!');</script>");
         }
         else if (result == ERROR_CODE.SUCCESS)                                                                 // 插入用户成功,刷新前一个页面
         {
             Response.Write("<script>alert('角色修改成功!');window.close();self.opener.location.reload();</script>"); //  关闭添加页面的同时,刷新父页面
         }
         else if (result == ERROR_CODE.USER_NOT_FIND)                                                           // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("Login.aspx");
         }
         else if (result == ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称的角色!');</script>");
         }
     }
     else
     {
         var result = new SysRoleInfoBLL().Insert(role, GetLoginUserId());
         if (result == ERROR_CODE.SUCCESS)                                                                      // 插入用户成功,刷新前一个页面
         {
             Response.Write("<script>alert('角色添加成功!');window.close();self.opener.location.reload();</script>"); //  关闭添加页面的同时,刷新父页面
         }
         else if (result == ERROR_CODE.USER_NOT_FIND)                                                           // 用户丢失
         {
             Response.Write("<script>alert('查询不到用户,请重新登陆');</script>");
             Response.Redirect("Login.aspx");
         }
         else if (result == ERROR_CODE.EXIST)
         {
             Response.Write("<script>alert('已经存在相同名称的角色!');</script>");
         }
     }
     //Response.Write("<script>alert('角色添加成功!');window.close();self.opener.location.reload();</script>");
 }