protected void ButtonSubmit_Click(object sender, EventArgs e) { string weekSchedule, weekExecution; int state, weekOfYear; editWorkID = Guid.Parse(ViewState["editWorkID"].ToString()); editMonth = int.Parse(ViewState["editMonth"].ToString()); Guid monnthTaskID = sc.GetMonthID(editWorkID, editMonth); bool succeed = false; foreach (RepeaterItem ri in ((Repeater)((Control)sender).Parent.Parent).Items) { //Response.Write(ri.FindControl("TextBoxWeekSchedule") + "<br/>"); //Response.Write(ri.FindControl("TextBoxWeekExecution") + "<br/>"); weekOfYear = int.Parse(((Label)ri.FindControl("lbWeek")).Text); weekSchedule = ((TextBox)ri.FindControl("TextBoxWeekSchedule")).Text; weekExecution = ((TextBox)ri.FindControl("TextBoxWeekExecution")).Text; if (weekExecution.Trim() == "") { state = weekSchedule.Trim() == "" ? 0 : 1; } else { state = ((CheckBox)ri.FindControl("CheckBoxState")).Checked ? 3 : 2; } succeed = mc.InputWeekSchedule(monnthTaskID, weekOfYear, weekSchedule, weekExecution, state); if (!succeed) { return; } //Response.Write(weekOfYear + "++" + weekSchedule + "-" + weekExecution + ":" + state + "<br/>"); } if (succeed) { PreLoadData(); RepeaterSchedule.DataBind(); } //search(((Control)sender).Parent.Parent); }
protected void Page_Load(object sender, EventArgs e) { //Session["UserID"] = 11; if (Session["UserID"] == null || string.IsNullOrWhiteSpace(Session["UserID"].ToString())) { Response.Redirect("~/Account/Login.aspx"); } tool = new Core.Tools(); sc = new ScheduleClass(); wc = new WorkClass(); mc = new ManageClass(); uc = new UserClass(); if (uc.GetUserType(int.Parse(Session["UserID"].ToString())) != 1) { Response.Redirect("~/Account/Login.aspx"); } category = 0; if (IsPostBack) { weeksOfMonth = (int[])ViewState["weeksOfMonth"]; allWorkID = (Guid[])ViewState["allWorkID"]; existMonths = (Dictionary <Guid, int[]>)ViewState["existMonths"]; existWeeks = (Dictionary <Guid, Dictionary <int, int> >)ViewState["existWeeks"]; projectCategoryLocationID = ViewState["projectCategoryLocationID"] as Guid[]; categoryName = ViewState["categoryName"] as string[]; } else { PreLoadData(); } SqlDataSource1.SelectParameters["year"].DefaultValue = tool.year.ToString(); //SqlDataSource1.DataBind(); RepeaterSchedule.DataBind(); }
//public Core.AddScheduleClass asc; protected void Page_Load(object sender, EventArgs e) { tool = new Core.Tools(); sc = new ScheduleClass(); wc = new WorkClass(); mc = new ManageClass(); //asc = new AddScheduleClass(); //Session["UserID"] = 12; //if (Request.QueryString["id"] != null) // Session["UserID"] = Request.QueryString["UserID"]; if (Session["UserID"] == null || string.IsNullOrWhiteSpace(Session["UserID"].ToString())) { Response.Redirect("~/default.aspx"); } userID = int.Parse(Session["UserID"].ToString()); if (IsPostBack) { weeksOfMonth = (int[])ViewState["weeksOfMonth"]; userWorkID = (Guid[])ViewState["userWorkID"]; existMonths = (Dictionary <Guid, int[]>)ViewState["existMonths"]; existWeeks = (Dictionary <Guid, Dictionary <int, int> >)ViewState["existWeeks"]; editedWorkID = ViewState["editedWorkID"] as List <Guid>; } else { PreLoadData(); } SqlDataSource1.SelectParameters["year"].DefaultValue = tool.year.ToString(); RepeaterSchedule.DataBind(); }