public int DInsertCabReq(EReqCabecera eReqCab, string tabla) { int i = 0; try { SqlCommand cmd = new SqlCommand(); cmd.CommandType = CommandType.Text; string sql = "INSERT INTO " + tabla + " ( " + " A11STT, A11NSA, A11TSA, A11FSA, A11TUR, " + " A11ARE, A11AUT, A11SOL, A11OTR, A11COR, " + " A11TIP, A11IMS, A11IMD, A11UGE, A11UA1, " + " A11UA2, A11UA3, A11FGE, A11FA1, A11FA2, " + " A11FA3, A11UHM, A11EST, A11NVS, A11FVS, " + " A11HVS, A11UDE, A11CGE, A11CA1, A11CA2, A11CA3) " + " VALUES " + " ('" + eReqCab.Situacion + "', '" + eReqCab.NroRequerimiento + "', " + eReqCab.TipoSalida + ", " + eReqCab.FechaSalida + ", " + eReqCab.Turno + ", " + " " + eReqCab.Area + ", " + eReqCab.Autorizado + ", " + eReqCab.Solicitante + ", " + eReqCab.OrdenTrabajo + ", " + eReqCab.Recibido + ", " + " '" + eReqCab.TipoAlmacen + "', " + eReqCab.ImpSoles + ", " + eReqCab.ImpDolares + ", '" + eReqCab.UserGenera + "', '" + eReqCab.UserAprueba1 + "', " + " '" + eReqCab.UserAprueba2 + "', '" + eReqCab.UserAprueba3 + "', '" + eReqCab.FechaGenera + "', '" + eReqCab.FechaAprueba1 + "', '" + eReqCab.FechaAprueba2 + "', " + " '" + eReqCab.FechaAprueba3 + "', " + eReqCab.HoraMinuto + ", '" + eReqCab.Estado + "', " + eReqCab.NroValeSalida + ", " + eReqCab.FechaValeSalida + ", " + " " + eReqCab.HoraValeSalida + ", '" + eReqCab.UsuarioDespacha + "'," + eReqCab.CodUserGenera + "," + eReqCab.CodUserAprueba1 + "," + eReqCab.CodUserAprueba2 + "," + eReqCab.CodUserAprueba3 + ") "; cmd.CommandText = sql; cmd.Connection = cn; cmd.Connection.Open(); cmd.ExecuteNonQuery(); i = 1; cmd.Dispose(); cn.Dispose(); cn.Close(); } catch { throw; } return i; }
void GrabarCabecera() { eCabReq = new EReqCabecera(); eCabReq.Situacion = "S"; eCabReq.NroRequerimiento = nroReq; eCabReq.TipoSalida = 1; eCabReq.FechaSalida = Convert.ToDecimal(fecha); eCabReq.Turno = turno; eCabReq.Area = Convert.ToDecimal(txtDpt.Text); eCabReq.Autorizado = Convert.ToDecimal((string)Session["CodPlanilla"]);//Convert.ToDecimal(codEmpleado); eCabReq.Solicitante = Convert.ToDecimal((string)Session["CodPlanilla"]); eCabReq.OrdenTrabajo = Convert.ToDecimal(txtOTR.Text); /********Verificarlo************/ eCabReq.Recibido = 0; /**ACTUALIZACION GRABA LA GERENCIA POR CADA USUARIO***/ eCabReq.TipoAlmacen = (string)Session["Gerencia"]; /******************************/ eCabReq.ImpSoles = Convert.ToDecimal(txtTotalS.Text); eCabReq.ImpDolares = Convert.ToDecimal(txtTotalD.Text); eCabReq.UserGenera = (string)Session["Usuario"]; /*******************Actualizacion************************/ eCabReq.CodUserGenera = Convert.ToDecimal((string)Session["CodPlanilla"]); eCabReq.CodUserAprueba1 = 0; eCabReq.CodUserAprueba2 = 0; eCabReq.CodUserAprueba3 = 0; eCabReq.UserAprueba1 = ""; eCabReq.UserAprueba2 = ""; eCabReq.UserAprueba3 = ""; /********************************************************/ eCabReq.FechaGenera = fecha; /*******************Actualizacion************************/ eCabReq.FechaAprueba1 = ""; eCabReq.FechaAprueba2 = ""; eCabReq.FechaAprueba3 = ""; /********************************************************/ eCabReq.HoraMinuto = Convert.ToDecimal(Hora); /*******************Actualizacion************************/ eCabReq.Estado = "1"; eCabReq.NroValeSalida = 0; eCabReq.FechaValeSalida = 0; eCabReq.HoraValeSalida = 0; eCabReq.UsuarioDespacha = ""; /********************************************************/ objTran = new BTransaccion(); int i = objTran.BInsertCabReq(eCabReq, "ALI011UTIL"); }
public int BInsertCabReq(EReqCabecera eReqCab, string tabla) { return objTran.DInsertCabReq(eReqCab, tabla); }