Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccount();

            if (string.IsNullOrEmpty(Request["day"]))
            {
                _date = DateTime.Now.Date;
            }
            else
            {
                _date = DateTime.Parse(HttpUtility.HtmlDecode(Request["day"]));
            }
            DateTime d2 = _date.AddDays(1);

            _user = Page.User.Identity.Name;
            if (!string.IsNullOrEmpty(Request["user"]))
            {
                _user = HttpUtility.HtmlDecode(Request["user"]);
            }

            App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            _data = GetList(db.GetUnplan(_user, _date, d2));
            AddList(db.GetNotDonePrim(_user, _date, d2));
            if (_data.Count < 1)
            {
                UnplanBlock.Visible = false;
                DpZayavky(sender, e);
                LiftZPrim(sender, e);
            }

            if (!IsPostBack)
            {
                Unplan.DataSource = _data;
                Unplan.DataBind();

                DpZayavky(sender, e);
                LiftZPrim(sender, e);
                List <Data> data = GetListDp(db.GetPlan(_user, _date, d2));
                if (data.Count < 1 && _data.Count < 1)
                {
                    AllZayavky(sender, e);
                    AllZPrim(sender, e);
                }
            }
        }