//protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) //{ // if (e.CommandName == "Submit") // { // Response.Write(((TextBox)e.Item.FindControl("TextBoxWeekSchedule")).Text+"<br>"); // Response.Write(((TextBox)e.Item.FindControl("TextBoxWeekExecution")).Text + "<br>"); // Response.Write(((CheckBox)e.Item.FindControl("CheckBoxState")).Text + "<br>"); // Repeater1.Visible = false; // } //} protected void ButtonSubmit_Click(object sender, EventArgs e) { string weekSchedule, weekExecution; int state, weekOfYear; Guid monnthTaskID = sc.GetMonthID(Guid.Parse(DropDownListWork.SelectedValue), int.Parse(DropDownListMonth.SelectedValue)); bool succeed = true; foreach (RepeaterItem ri in Repeater1.Items) { 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); } string result = succeed ? "成功" : "不成功"; Response.Write("周计划添加" + result + "<br/><br/>"); Repeater1.Visible = false; }
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); }