Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected void btn_replicate_Click(object sender, EventArgs e)
- {
- string dataI = start_date.Text;
- string dataF = end_date.Text;
- DateTime START = DateTime.ParseExact(dataI, "dd/MM/yyyy HH:mm", System.Globalization.DateTimeFormatInfo.CurrentInfo);
- DateTime END = DateTime.ParseExact(dataF, "dd/MM/yyyy HH:mm", System.Globalization.DateTimeFormatInfo.CurrentInfo);
- INT weekRepeat = CONVERT.ToInt32(tb_replicate.Text);
- FOR(INT i = 0;i<weekRepeat;i++)
- {
- DateTime nextWeekStart = START.AddDays((7*(i+1)));
- DateTime nextWeekEnd = END.AddDays((7 * (i + 1)));
- Response.WRITE("Start: " + nextWeekStart + " " + " end: " + nextWeekEnd);
- TimeSpan diferença = nextWeekEnd.Subtract(nextWeekStart);
- DOUBLE difDouble = diferença.TotalHours;
- SqlConnection myConn = NEW SqlConnection(ConfigurationManager.ConnectionStrings["projectofinalatestes2ConnectionString"].ConnectionString);
- SqlCommand myCommand = NEW SqlCommand();
- myCommand.Connection = myConn;
- myCommand.Parameters.AddWithValue("@id", -1);
- DateTime aEnviar = DateTime.ParseExact(nextWeekStart.ToShortDateString(), "dd/MM/yyyy", System.Globalization.DateTimeFormatInfo.CurrentInfo);
- Response.WRITE(aEnviar.ToString());
- //myCommand.Parameters.AddWithValue("@st_date", nextWeekStart);
- //myCommand.Parameters.AddWithValue("@ed_date", nextWeekEnd);
- //myCommand.Parameters.AddWithValue("@id_turma", CONVERT.ToInt32(SESSION["id_turma"].ToString()));
- //myCommand.Parameters.AddWithValue("@id_form", ddl_form.SelectedValue);
- //myCommand.Parameters.AddWithValue("@id_ufcd", ddl_ufcd.SelectedValue);
- //myCommand.Parameters.AddWithValue("@horas", difDouble);
- //myCommand.Parameters.AddWithValue("@text", ddl_ufcd.SelectedItem.ToString() + " - " + ddl_form.SelectedItem.ToString());
- //SqlParameter existe = NEW SqlParameter();
- //existe.ParameterName = "@flag";
- //existe.SIZE = 10;
- //existe.Direction = ParameterDirection.Output;
- //myCommand.Parameters.ADD(existe);
- //myCommand.CommandType = CommandType.StoredProcedure;
- //myCommand.CommandText = "insert_update_aulas";
- //myConn.OPEN();
- //myCommand.ExecuteNonQuery();
- //INT estado = CONVERT.ToInt32(myCommand.Parameters["@flag"].VALUE);
- //IF (estado == 4)
- //{
- // Response.WRITE("formador nao tem disponibilidade no dia " + nextWeekStart.ToShortDateString());
- //}
- //ELSE IF (estado == 3)
- //{
- // Response.WRITE("formador inserido");
- //}
- //ELSE IF (estado == 2)
- //{
- // Response.WRITE("forcar horas, foi possiver replicar " + (i + 1) + "semanas");
- //}
- //ELSE IF (estado == 1)
- //{
- // Response.WRITE("horas requeridas");
- //}
- //ELSE IF (estado == 6)
- //{
- // Response.WRITE("formador ja alocado");
- //}
- //ELSE IF (estado == 5)
- //{
- // Response.WRITE("ja há alocacao");
- //}
- //ELSE IF (estado == 7)
- //{
- // Response.WRITE("Ultima semana com horas forçadas, foi possiver replicar " + (i + 1) + "semanas");
- // break;
- //}
- //myConn.Close();
- //ClientScript.RegisterStartupScript(GetType(), "", "lightbox.close();", TRUE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement