Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Request.QueryString["command"] == "delete")
            {
                var shiftRepository = new ShiftRepository();
                var shiftId = this.Request.QueryString["shiftId"];
                int shiftIdInt;
                if (int.TryParse(shiftId, out shiftIdInt))
                {
                    shiftRepository.RemoveShift(shiftIdInt);
                }

                this.GoToShiftMainPage();
            }

            if (!this.IsPostBack)
            {
                var shiftIdString = this.Request.QueryString["shiftId"];
                if (string.IsNullOrEmpty(shiftIdString))
                {
                    // New shift
                }
                else
                {
                    // Edit shift
                    int shiftId;
                    if (int.TryParse(shiftIdString, out shiftId))
                    {
                        this.BindShift(shiftId);
                    }
                    else
                    {
                        this.GoToShiftMainPage();
                    }
                }
            }

            this.RefreshGrid();
        }