public void cargarPanelCliente() { datosCliente = (DatosCliente)LoadControl(pathToControls + "AMS.Automotriz.DatosCliente.ascx"); phDatosCliente.Controls.Add(datosCliente); }
//protected void Guardar_Cita(Object Sender, EventArgs e) //{ // datosCliente = (DatosCliente)phDatosCliente.Controls[0]; // Control controlHiddencolores = (Control)phDatosCliente.Controls[0]; // if ((placa.Text == "") || !datosCliente.TieneSuficientesDatos()) // Utils.MostrarAlerta(Response, "Hace Falta Algún Dato. Revise Por Favor"); // else // { // ArrayList sqlStrings = new ArrayList(); // string codigoRecepcionista = DBFunctions.SingleData("SELECT pven_codigo FROM pvendedor WHERE pven_nombre='"+recepcion.SelectedItem.ToString()+"'"); // string fechaGrabacion = calFecha.SelectedDate.ToString("yyyy-MM-dd"); // if(codigoRecepcionista == null || codigoRecepcionista.Equals("")) // { // Utils.MostrarAlerta(Response, "Por favor seleccione un recepcionista"); // return; // } // DateTime horaAlmuerzo = System.Convert.ToDateTime(DBFunctions.SingleData("SELECT pven_horalmuerzo FROM pvendedor WHERE pven_codigo='"+codigoRecepcionista+"'")); // DateTime horaFinal = horaAlmuerzo.AddMinutes(59); // DateTime hora = System.Convert.ToDateTime(horaEsc.SelectedItem.ToString()); // string kit = (servicio.SelectedValue.Length==0) ? "NULL" : "'"+servicio.SelectedValue+"'"; // if((hora>=horaAlmuerzo)&&(hora<horaFinal)) // Utils.MostrarAlerta(Response, "Lo sentimos ha esta hora el recepcionista se encuentra reservado"); // //lbErr.Text = "Lo sentimos ha esta hora el recepcionista se encuentra reservado"; // else if((!DBFunctions.RecordExist("SELECT * FROM mcitataller WHERE mcit_fecha='"+fechaGrabacion+"' AND mcit_hora='"+horaEsc.SelectedItem.ToString()+"' AND mcit_codven='"+codigoRecepcionista+"'"))&&(!DBFunctions.RecordExist("SELECT * FROM mcitataller where mcit_fecha='"+fechaGrabacion+"' AND mcit_placa='"+placa.Text+"'"))) // { // sqlStrings.Add("INSERT INTO mcitataller VALUES('" + fechaGrabacion + "','" + horaEsc.SelectedItem.ToString() + "','" + codigoRecepcionista + "','" + vehiculos.SelectedValue + "','" + placa.Text.ToString() + "','" + datosCliente.Nombrecompleto + "','" + datosCliente.Telefono + "','" + datosCliente.Celular + "','" + datosCliente.Email + "'," + kit + ",'N','" + tbObservaciones.Text + "','" + HttpContext.Current.User.Identity.Name.ToLower() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + taller.SelectedValue + "')"); // if (DBFunctions.Transaction(sqlStrings)) // { // lbErr.Text = ""; // Utils.MostrarAlerta(Response, "Su CITA ha sido creada SATISFACTORIAMENTE .. lo esperamos !"); // } // else // { // lbErr.Text = "Error :" + DBFunctions.exceptions; // Utils.MostrarAlerta(Response, "La CITA no ha podido ser registrada. Por favor revise los datos de ingreso."); // } // this.PrepararTabla(taller.SelectedItem.ToString()); // this.LlenarCitas(calFecha.SelectedDate.ToString("yyyy-MM-dd"), "SI", horaEsc.SelectedItem.ToString(), codigoRecepcionista); // } // else // Utils.MostrarAlerta(Response, "Usted ha escogido una opcion invalida o ya tiene una cita programada para hoy"); // } //} protected void Guardar_Cita_dgCitas(Object sender, CommandEventArgs e) { DataTable dtPrueba = new DataTable(); dtPrueba = (DataTable)Session["dtCitas"]; //string nombreRecepcionista = dtPrueba.Columns[]; datosCliente = (DatosCliente)phDatosCliente.Controls[0]; if ((placa.Text == "") || !datosCliente.TieneSuficientesDatos()) { Utils.MostrarAlerta(Response, "Hace Falta Algún Dato. Revise Por Favor"); } else { ArrayList sqlStrings = new ArrayList(); string pruebaRecepcionista = (e.CommandArgument).ToString(); string codigoRecepcionista = pruebaRecepcionista.Substring(0, pruebaRecepcionista.IndexOf("_")); //string codigoRecepcionista = DBFunctions.SingleData("SELECT pven_codigo FROM pvendedor WHERE pven_nombre='" + recepcion.SelectedItem.ToString() + "'"); string fechaGrabacion = calFecha.SelectedDate.ToString("yyyy-MM-dd"); if (codigoRecepcionista == null || codigoRecepcionista.Equals("")) { Utils.MostrarAlerta(Response, "Por favor seleccione un recepcionista"); return; } DateTime horaAlmuerzo = System.Convert.ToDateTime(DBFunctions.SingleData("SELECT pven_horalmuerzo FROM pvendedor WHERE pven_codigo='" + codigoRecepcionista + "'")); DateTime horaFinal = horaAlmuerzo.AddMinutes(59); DateTime hora = System.Convert.ToDateTime(horaEsc.SelectedItem.ToString()); string kit = (servicio.SelectedValue.Length == 0) ? "NULL" : "'" + servicio.SelectedValue + "'"; if ((hora >= horaAlmuerzo) && (hora < horaFinal)) { Utils.MostrarAlerta(Response, "Lo sentimos ha esta hora el recepcionista se encuentra reservado"); } } datosCliente = (DatosCliente)phDatosCliente.Controls[0]; Control controlHiddencolores = (Control)phDatosCliente.Controls[0]; string colores = ((HiddenField)controlHiddencolores.FindControl("HiColores")).Value; if (colores == "verde") { colores = "V"; } else if (colores == "rojo") { colores = "R"; } else if (colores == "amarillo") { colores = "A"; } else { colores = "V"; } if ((placa.Text == "") && !datosCliente.TieneSuficientesDatos()) { Utils.MostrarAlerta(Response, "Falta algun dato por entrar. Por favor revise"); } else { ArrayList sqlStrings = new ArrayList(); string opc = (e.CommandArgument).ToString(); //string opc = ((CommandEventArgs)e).CommandArgument.ToString(); string codigoRecepcionista = opc.Substring(0, opc.IndexOf("_")); string horaGrabacion = opc.Substring(opc.IndexOf("_") + 1); string fechaGrabacion = calFecha.SelectedDate.ToString("yyyy-MM-dd"); string kit = (servicio.SelectedValue.Length == 0) ? "NULL" : "'" + servicio.SelectedValue + "'"; string Color = colores; if (!DBFunctions.RecordExist("SELECT * FROM mcitataller where mcit_fecha='" + fechaGrabacion + "' AND mcit_placa='" + placa.Text + "'")) { sqlStrings.Add("INSERT INTO mcitataller VALUES('" + fechaGrabacion + "','" + horaGrabacion + "','" + codigoRecepcionista + "','" + vehiculos.SelectedValue + "','" + placa.Text.ToString() + "','" + datosCliente.Nombrecompleto + "','" + datosCliente.Telefono + "','" + datosCliente.Celular + "','" + datosCliente.Email + "'," + kit + ",'N','" + tbObservaciones.Text + "','" + HttpContext.Current.User.Identity.Name.ToLower() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','" + taller.SelectedValue + "','" + Color + "');"); if (DBFunctions.Transaction(sqlStrings)) { lbErr.Text = ""; Utils.MostrarAlerta(Response, "Su CITA ha sido creada SATISFACTORIAMENTE .. lo esperamos !"); } else { lbErr.Text = "Error :" + DBFunctions.exceptions; Utils.MostrarAlerta(Response, "La CITA no ha podido ser registrada. Por favor revise los datos de ingreso."); } this.PrepararTabla(taller.SelectedItem.ToString()); this.LlenarCitas(calFecha.SelectedDate.ToString("yyyy-MM-dd"), "SI", horaGrabacion, codigoRecepcionista); } else { Utils.MostrarAlerta(Response, "Usted ya tiene una cita para el dia de hoy"); } } }