/// <summary> /// 编辑休假策略级别 /// </summary> /// <param name="context"></param> private void EditPolicyTier(HttpContext context) { if (string.IsNullOrEmpty(context.Request.QueryString["tierId"]) || context.Request.QueryString["tierId"] == "0") // 新增 { AddPolicyTier(context); return; } long tierId = long.Parse(context.Request.QueryString["tierId"]); decimal annualHours = decimal.Parse(context.Request.QueryString["annual"]); decimal?capHours = null; if (!string.IsNullOrEmpty(context.Request.QueryString["cap"])) { capHours = decimal.Parse(context.Request.QueryString["cap"]); } decimal?hoursPerPeriod = null; if (!string.IsNullOrEmpty(context.Request.QueryString["hoursPerPeriod"])) { hoursPerPeriod = decimal.Parse(context.Request.QueryString["hoursPerPeriod"]); } int startMonths = int.Parse(context.Request.QueryString["months"]); if (context.Request.QueryString["policyId"] == "0") { var items = context.Session["TimeoffPolicyTier"] as TimeoffPolicyTierListDto; if (items == null) { items = new TimeoffPolicyTierListDto(); } TimeoffPolicyTierDto dto = items.items.Find(_ => _.id == tierId); if (dto != null) { dto.hoursPerPeriod = hoursPerPeriod; dto.eligibleMonths = startMonths; dto.capHours = capHours; dto.annualHours = annualHours; } context.Session["TimeoffPolicyTier"] = items; context.Response.Write(new Tools.Serialize().SerializeJson(true)); } else { Core.tst_timeoff_policy_item_tier tier = new Core.tst_timeoff_policy_item_tier(); tier.id = tierId; tier.annual_hours = annualHours; tier.cap_hours = capHours; tier.hours_accrued_per_period = hoursPerPeriod; tier.eligible_starting_months = startMonths; bool rtn = bll.EditTimeoffItemTier(tier, LoginUserId); context.Response.Write(new Tools.Serialize().SerializeJson(rtn)); } }
/// <summary> /// 获取策略级别信息 /// </summary> /// <param name="context"></param> private void GetItemTierInfo(HttpContext context) { long id = long.Parse(context.Request.QueryString["id"]); var items = context.Session["TimeoffPolicyTier"] as TimeoffPolicyTierListDto; Core.tst_timeoff_policy_item_tier tier = null; TimeoffPolicyTierDto dto = null; if (items == null) { tier = bll.GetTimeoffItemTier(id); } else { var tr = items.items.Find(_ => _.id == id); if (tr == null) { tier = bll.GetTimeoffItemTier(id); } else { dto = tr; } } if (tier != null) { dto = new TimeoffPolicyTierDto { annualHours = tier.annual_hours.Value, capHours = tier.cap_hours, eligibleMonths = tier.eligible_starting_months, hoursPerPeriod = tier.hours_accrued_per_period, id = tier.id, cate = bll.GetTimeoffItem(tier.timeoff_policy_item_id).cate_id }; } context.Response.Write(new Tools.Serialize().SerializeJson(dto)); }