Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var  bll = new TimeOffPolicyBLL();
            long id;
            long resId;

            if (!long.TryParse(Request.QueryString["resId"], out resId))
            {
                Response.End();
                return;
            }
            if (long.TryParse(Request.QueryString["id"], out id))
            {
                plcAss = new DAL.tst_timeoff_policy_resource_dal().FindById(id);
            }
            policyList = bll.GetPolicyList();

            if (IsPostBack)
            {
                DateTime effDate = DateTime.Parse(Request.Form["effDate"]);
                if (plcAss == null)
                {
                    long plcId = long.Parse(Request.Form["plc"]);
                    bll.AddEditTimeoffResource(0, resId, plcId, effDate, LoginUserId);
                }
                else
                {
                    if (effDate < plcAss.effective_date)
                    {
                        bll.AddEditTimeoffResource(plcAss.id, resId, plcAss.timeoff_policy_id, effDate, LoginUserId);
                    }
                }
                Response.Write("<script>window.close();self.opener.location.reload();</script>");
                Response.End();
            }
        }
Пример #2
0
        private void Bind()
        {
            var dic = new UserResourceBLL().GetDownList();

            // 日期格式
            this.DateFormat.DataTextField  = "show";
            this.DateFormat.DataValueField = "val";
            this.DateFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "DateFormat").Value;
            this.DateFormat.DataBind();
            // DateFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //数字格式
            this.NumberFormat.DataTextField  = "show";
            this.NumberFormat.DataValueField = "val";
            this.NumberFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "NumberFormat").Value;
            NumberFormat.DataBind();
            // NumberFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //TimeFormat时间格式
            this.TimeFormat.DataTextField  = "show";
            this.TimeFormat.DataValueField = "val";
            this.TimeFormat.DataSource     = dic.FirstOrDefault(_ => _.Key == "TimeFormat").Value;
            TimeFormat.DataBind();
            // TimeFormat.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //EmailType50
            this.EmailType.DataTextField  = "show";
            this.EmailType.DataValueField = "val";
            this.EmailType.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType.DataBind();
            EmailType.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            this.EmailType1.DataTextField  = "show";
            this.EmailType1.DataValueField = "val";
            this.EmailType1.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType1.DataBind();
            EmailType1.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            this.EmailType2.DataTextField  = "show";
            this.EmailType2.DataValueField = "val";
            this.EmailType2.DataSource     = dic.FirstOrDefault(_ => _.Key == "EmailType").Value;
            EmailType2.DataBind();
            EmailType2.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //Sex49
            this.Sex.DataTextField  = "show";
            this.Sex.DataValueField = "val";
            this.Sex.DataSource     = dic.FirstOrDefault(_ => _.Key == "Sex").Value;
            Sex.DataBind();
            Sex.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //NameSuffix
            this.NameSuffix.DataTextField  = "show";
            this.NameSuffix.DataValueField = "val";
            this.NameSuffix.DataSource     = dic.FirstOrDefault(_ => _.Key == "NameSuffix").Value;
            NameSuffix.DataBind();
            NameSuffix.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //Prefix前缀
            //Prefix.Items.Insert(0, new ListItem() { Value = "0", Text = "   ", Selected = true });
            //Prefix.Items.Insert(1, new ListItem() { Value = "1", Text = "Mr." });
            //Prefix.Items.Insert(2, new ListItem() { Value = "2", Text = "Mrs." });
            //Prefix.Items.Insert(3, new ListItem() { Value = "3", Text = "Ms." });
            //主要位置  location_id

            this.Position.DataTextField  = "name";
            this.Position.DataValueField = "id";
            this.Position.DataSource     = dic.FirstOrDefault(_ => _.Key == "Position").Value;
            Position.DataBind();
            Position.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            Position.Items.Insert(1, new ListItem()
            {
                Value = "1", Text = "总部"
            });
            //授权tab页

            //权限等级
            //this.Security_Level
            this.Security_Level.DataTextField  = "name";
            this.Security_Level.DataValueField = "id";
            this.Security_Level.DataSource     = dic.FirstOrDefault(_ => _.Key == "Security_Level").Value;
            Security_Level.DataBind();
            Security_Level.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });
            //外包权限
            //this.Outsource_Security
            this.Outsource_Security.DataTextField  = "show";
            this.Outsource_Security.DataValueField = "val";
            this.Outsource_Security.DataSource     = dic.FirstOrDefault(_ => _.Key == "Outsource_Security").Value;
            Outsource_Security.DataBind();
            Outsource_Security.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "   ", Selected = true
            });

            //员工类型
            var genBll  = new GeneralBLL();
            var resType = genBll.GetDicValues(GeneralTableEnum.RESOURCE_TYPE);

            type_id.DataTextField  = "show";
            type_id.DataValueField = "val";
            type_id.DataSource     = resType;
            type_id.DataBind();

            //薪资类型
            var payType = genBll.GetDicValues(GeneralTableEnum.PAYROLL_TYPE);

            payroll_type_id.DataTextField  = "show";
            payroll_type_id.DataValueField = "val";
            payroll_type_id.DataSource     = payType;
            payroll_type_id.DataBind();

            hire_date.Text             = DateTime.Now.ToString("yyyy-MM-dd");
            time_sheet_start_date.Text = DateTime.Now.ToString("yyyy-MM-dd");

            var tmoffBll = new TimeOffPolicyBLL();
            // 休假方案
            var policyList = tmoffBll.GetPolicyList();

            timeoff_policy_id.DataTextField  = "name";
            timeoff_policy_id.DataValueField = "id";
            timeoff_policy_id.DataSource     = policyList;
            timeoff_policy_id.DataBind();
            timeoff_policy_id.Items.Insert(0, new ListItem()
            {
                Value = "0", Text = "", Selected = true
            });

            // 出差限度
            var travelRest = genBll.GetDicValues(GeneralTableEnum.TRAVEL_RESTRICTIONS);

            travel_restrictions_id.DataTextField  = "show";
            travel_restrictions_id.DataValueField = "val";
            travel_restrictions_id.DataSource     = travelRest;
            travel_restrictions_id.DataBind();
        }