Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckAccount();
            App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            _workers       = db.GetWorkers();
            _hollidaysType = db.GetWorkTypes();
            if (!IsPostBack)
            {
                SaveOrClear.DataSource = _soc;
                SaveOrClear.DataBind();
                SaveOrClear.SelectedIndex = 0;
                HollidaysType.DataSource  = _hollidaysType;
                HollidaysType.DataBind();
                HollidaysType.SelectedIndex = 0;
                Base.UserInfo ui = db.GetUserInfo(_workers[0].UserName);
                From.Text  = ui.HourBeg.ToString();
                To.Text    = ui.HourEnd.ToString();
                Lunch.Text = ui.Lunch.ToString();
                DataTable   data = db.GetWorkTime();
                List <Data> ls   = new List <Data>();
                foreach (DataRow dr in data.Rows)
                {
                    ls.Add(new Data()
                    {
                        Name  = dr["Family"].ToString() + " " + dr["IO"].ToString(),
                        From  = dr["HourBeg"].ToString(),
                        To    = dr["HourEnd"].ToString(),
                        Lunch = dr["Lunch"].ToString()
                    });
                }
                Graf.DataSource = ls;
                Graf.DataBind();

                WorkerName.DataSource = _workers;
                WorkerName.DataBind();
                WorkerName.SelectedIndex = 0;
                List <string> s = db.GetIdU();
                IdU.DataSource = s;
                IdU.DataBind();
                if (s.Count > 0)
                {
                    IdU.SelectedIndex = 0;
                }
                IdU_SelectedIndexChanged(sender, e);
                //Beg.SelectedDate = DateTime.Now.Date;
                //End.SelectedDate = DateTime.Now.Date.AddMonths(1);
                Calendar1.SelectedDate = DateTime.Now.Date;
                Calendar2.SelectedDate = DateTime.Now.Date.AddMonths(1);
                Calendar3.SelectedDate = DateTime.Now.Date;
                DHStart.SelectedDate   = DateTime.Now.Date;
                DHEnd.SelectedDate     = DateTime.Now.Date.AddMonths(1);
                Base.PersonData pd     = _workers.Find(delegate(Base.PersonData i)
                {
                    return(i.Title == WorkerName.SelectedValue);
                });
                List <Base.UserLift> ul = db.GetUserLift(pd.Id);
                AllList.DataSource = ul;
                AllList.DataBind();
            }
        }
Esempio n. 2
0
        protected void IdM_SelectedIndexChanged(object sender, EventArgs e)
        {
            App_Code.Base db = new App_Code.Base(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ToString());
            Base.PersonData pd = _workers.Find(delegate(Base.PersonData i)
            {
                return(i.Title == WorkerName.SelectedValue);
            });
            List <Base.UserLift> data = db.GetUserLift(pd.UserName, IdU.SelectedValue, IdM.SelectedValue);

            IdL.DataSource = data;
            IdL.DataBind();

            List <Base.UserLift> ul = db.GetUserLift(pd.Id);

            AllList.DataSource = ul;
            AllList.DataBind();
        }