Ejemplo n.º 1
0
        /// <summary>
        /// 根据员工id,查询出员工的角色
        /// </summary>
        /// <param name="context"></param>
        /// <param name="resource_id"></param>
        public void GetRoleList(HttpContext context, long resource_id, bool isShowNull = true)
        {
            // 查找出部门类型的角色
            var           roleList = new sys_resource_department_dal().GetRolesBySource(resource_id, DEPARTMENT_CATE.DEPARTMENT);
            StringBuilder roles    = new StringBuilder();

            if (isShowNull)
            {
                roles.Append("<option value='0'>     </option>");
            }

            if (roleList != null && roleList.Count > 0)
            {
                var rDal = new sys_role_dal();
                foreach (var role in roleList)
                {
                    var thisRole = rDal.FindNoDeleteById(role.role_id);
                    if (thisRole != null)
                    {
                        roles.Append("<option value='" + thisRole.id + "'>" + thisRole.name + "</option>");
                    }
                }
            }
            context.Response.Write(roles);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取到这个角色相关的信息返回到页面
        /// </summary>
        /// <param name="context"></param>
        /// <param name="role_id"></param>
        public void GetRole(HttpContext context, long role_id)
        {
            var role = new sys_role_dal().FindSignleBySql <sys_role>($"select * from sys_role where id = {role_id} and delete_time = 0");

            if (role != null)
            {
                context.Response.Write(new EMT.Tools.Serialize().SerializeJson(role));
            }
        }
Ejemplo n.º 3
0
        private void GetRoleByResId(HttpContext context)
        {
            var resId = context.Request.QueryString["resId"];

            if (resId != null)
            {
                var roleList = new sys_role_dal().GetRoleByResId(long.Parse(resId));
                if (roleList != null && roleList.Count > 0)
                {
                    context.Response.Write(new EMT.Tools.Serialize().SerializeJson(roleList));
                }
            }
        }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var contract_id = Request.QueryString["contract_id"];
                if (!string.IsNullOrEmpty(contract_id))
                {
                    contract = new ctt_contract_dal().FindNoDeleteById(long.Parse(contract_id));
                    if (contract != null)
                    {
                        roleList = new sys_role_dal().GetContarctNoRate(contract.id);
                    }
                }

                var rate_id = Request.QueryString["rate_id"];
                if (!string.IsNullOrEmpty(rate_id))
                {
                    conRate = new ctt_contract_rate_dal().FindNoDeleteById(long.Parse(rate_id));
                    if (conRate != null)
                    {
                        isAdd = false;
                        var thisRole = new sys_role_dal().FindNoDeleteById(conRate.role_id);
                        roleList.Add(thisRole);
                    }
                }

                if (roleList != null && roleList.Count > 0)
                {
                    role_id.DataTextField  = "name";
                    role_id.DataValueField = "id";
                    role_id.DataSource     = roleList;
                    role_id.DataBind();
                    role_id.Items.Insert(0, new ListItem()
                    {
                        Value = "0", Text = "   ", Selected = true
                    });
                    if (!isAdd)
                    {
                        role_id.SelectedValue = conRate.role_id.ToString();
                    }
                }
                else
                {
                    Response.Write("<script>alert('在你可以添加更多的合同费率之前,请在系统中加入更多的角色。在你可以添加额外的合同费率之前,请在系统中加入额外的角色。');window.close();</script>");
                }
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 根据 物料代码Id 和 角色ID返回相关费率
        /// </summary>
        public decimal?GetRateByCodeAndRole(long cost_code_id, long role_id)
        {
            decimal?rate         = null;
            var     dccDal       = new d_cost_code_dal();
            var     srDal        = new sys_role_dal();
            var     thisCostCode = dccDal.FindNoDeleteById(cost_code_id);
            var     thisRole     = srDal.FindNoDeleteById(role_id);

            if (thisCostCode != null && thisRole != null)
            {
                switch (thisCostCode.billing_method_id)
                {
                case (int)DicEnum.WORKTYPE_BILLING_METHOD.USE_ROLE_RATE:
                    rate = thisRole.hourly_rate;
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.FLOAT_ROLE_RATE:
                    if (thisCostCode.rate_adjustment != null)
                    {
                        rate = (thisRole.hourly_rate + thisCostCode.rate_adjustment);
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.RIDE_ROLE_RATE:
                    if (thisCostCode.rate_multiplier != null)
                    {
                        rate = (thisRole.hourly_rate * thisCostCode.rate_multiplier);
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.USE_UDF_ROLE_RATE:
                    if (thisCostCode.custom_rate != null)
                    {
                        rate = thisCostCode.custom_rate;
                    }
                    break;

                case (int)DicEnum.WORKTYPE_BILLING_METHOD.BY_TIMES:
                    if (thisCostCode.flat_rate != null)
                    {
                        rate = thisCostCode.flat_rate;
                    }
                    break;

                default:
                    break;
                }
            }
            return(rate);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取一个合同可选的角色列表
        /// </summary>
        /// <param name="contractId"></param>
        /// <returns></returns>
        public List <sys_role> GetAvailableRoles(long contractId)
        {
            var list          = new sys_role_dal().GetList();
            var exclusionList = new ctt_contract_exclusion_role_dal().FindListByContractId(contractId);

            if (exclusionList == null || exclusionList.Count == 0)
            {
                return(list);
            }

            List <sys_role> roles = new List <sys_role>();

            foreach (var role in list)
            {
                if (!exclusionList.Exists(r => r.role_id == role.id))
                {
                    roles.Add(role);
                }
            }

            return(roles);
        }