Example #1
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            d_sla pageSla = AssembleModel <d_sla>();

            if (!string.IsNullOrEmpty(Request.Form["isSetEnd"]) && Request.Form["isSetEnd"] == "on")
            {
                pageSla.set_ticket_due_date = 1;
            }
            else
            {
                pageSla.set_ticket_due_date = 0;
            }
            if (Request.Form["HoursType"] == "yes")
            {
                pageSla.holiday_hours_type_id = (int)DTO.DicEnum.HOLIDAY_HOURS_TYPE.WORK;
            }
            else
            {
                pageSla.holiday_hours_type_id = (int)DTO.DicEnum.HOLIDAY_HOURS_TYPE.NO_WORK;
            }

            if (!isAdd)
            {
                sla.name        = pageSla.name;
                sla.description = pageSla.description;
                sla.first_response_goal_percentage  = pageSla.first_response_goal_percentage;
                sla.resolution_plan_goal_percentage = pageSla.resolution_plan_goal_percentage;
                sla.location_id = pageSla.location_id;
                sla.resolution_goal_percentage = pageSla.resolution_goal_percentage;
                sla.set_ticket_due_date        = pageSla.set_ticket_due_date;
                sla.holiday_hours_type_id      = pageSla.holiday_hours_type_id;

                if (hoursList != null && hoursList.Count > 0 && sla.location_id == null)
                {
                    foreach (var hours in hoursList)
                    {
                        hours.start_time          = Request.Form[hours.id.ToString() + "_start_time"];
                        hours.end_time            = Request.Form[hours.id.ToString() + "_end_time"];
                        hours.extended_start_time = Request.Form[hours.id.ToString() + "_extended_start_time"];
                        hours.extended_end_time   = Request.Form[hours.id.ToString() + "_extended_end_time"];
                    }
                }
            }

            bool result = false;

            if (isAdd)
            {
                result = bll.AddSLA(pageSla, LoginUserId);
            }
            else
            {
                result = bll.EditSLA(sla, hoursList, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');self.opener.location.reload();window.close();</script>");
        }