Пример #1
0
        //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;
        }
Пример #2
0
        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 RepeaterThisWeek_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "SubmitSchedule")
            {
                string weekSchedule, weekExecution, nextWeekSchedule;
                int    status;
                Guid   id = Guid.Parse(e.CommandArgument.ToString());
                bool   result;
                Label  l = e.Item.FindControl("LabelStatus") as Label;

                weekSchedule  = (e.Item.FindControl("TextBoxWeekSchedule") as TextBox).Text;
                weekExecution = (e.Item.FindControl("TextBoxWeekExecution") as TextBox).Text;
                if (weekExecution.Trim() == "")
                {
                    status = weekSchedule.Trim() == "" ? 0 : 1;
                }
                else
                {
                    status = (e.Item.FindControl("CheckBoxStatus") as CheckBox).Checked ? 3 : 2;
                }

                //更新本周计划落实情况
                result = mc.InputWeekSchedule(id, thisWeek, weekSchedule, weekExecution, status);
                if (!result)
                {
                    l.Text = "更新不成功";
                    return;
                }


                //更新下周计划落实情况
                if ((e.Item.FindControl("PlaceHolderWeek53") as PlaceHolder).Visible == true)
                {
                    nextWeekSchedule = (e.Item.FindControl("TextBoxNextWeekSchedule") as TextBox).Text;
                    result           = mc.InputWeekSchedule(id, thisWeek + 1, nextWeekSchedule, string.Empty, 1);
                    if (!result)
                    {
                        l.Text = "更新不成功";
                        return;
                    }
                }

                //Label l = e.Item.FindControl("LabelStatus") as Label;
                l.Text  = "<br/>" + e.CommandArgument.ToString();
                l.Text += "<br/>" + weekSchedule;
                l.Text += "<br/>" + weekExecution;
                l.Text += "<br/>" + status;
                //l.Text += "<br/>" + nextWeekSchedule;


                //修改上周计划
                if ((e.Item.FindControl("CheckBoxModify") as CheckBox).Checked)
                {
                    weekSchedule  = (e.Item.FindControl("TextBoxLastWeekSchedule") as TextBox).Text;
                    weekExecution = (e.Item.FindControl("TextBoxLastWeekExecution") as TextBox).Text;
                    status        = (e.Item.FindControl("CheckBoxLastStatus") as CheckBox).Checked ? 3 : 2;
                    result        = mc.InputWeekSchedule(id, thisWeek + 1, weekSchedule, weekExecution, status);
                    if (!result)
                    {
                        l.Text = "更新不成功";
                        return;
                    }

                    l.Text += "<br/>" + e.CommandArgument.ToString();
                    l.Text += "<br/>" + weekSchedule;
                    l.Text += "<br/>" + weekExecution;
                    l.Text += "<br/>" + status + "<br/>";
                }

                l.Text = "更新成功";
            }
        }