//Grabar Kardex Material public static string GrabarKardexMaterial(KardexMaterial objParam, int accion) { string conn = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ToString(); SqlConnection cnnDS = new SqlConnection(); SqlTransaction txOle = null; string Resultado = string.Empty; try { cnnDS.ConnectionString = conn; cnnDS.Open(); txOle = cnnDS.BeginTransaction(); if (accion == 1) { Resultado = AtencionPeluqueriaDAO.InsertarMovHardexMaterial(objParam, txOle); } else if (accion == 2) { AtencionPeluqueriaDAO.AnularKardexMaterial(objParam, txOle); } txOle.Commit(); cnnDS.Close(); return(Resultado); } catch (Exception ex) { txOle.Rollback(); cnnDS.Close(); throw; return(string.Empty); } finally { cnnDS = null; txOle = null; } }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <param name="objParam"></param> /// <param name="accion"></param> /// <returns></returns> public static string GrabarKardexMaterial(KardexMaterial objParam, int accion) { string Conn = System.Configuration.ConfigurationManager.ConnectionStrings["database"].ToString(); SqlConnection CnnDS = new SqlConnection(); SqlTransaction TxOle = null; string Resultado = string.Empty; try { CnnDS.ConnectionString = Conn; CnnDS.Open(); TxOle = CnnDS.BeginTransaction(); if (accion == Utilitario.Comun.AccionMovimientoMateriales.Insertar) { Resultado = AtencionPeluqueriaDAO.InsertarMovKardexMaterial(objParam, TxOle); } else if (accion == Utilitario.Comun.AccionMovimientoMateriales.Anular) { AtencionPeluqueriaDAO.AnularKardexMaterial(objParam, TxOle); } TxOle.Commit(); CnnDS.Close(); return(Resultado); } catch { TxOle.Rollback(); CnnDS.Close(); throw; } finally { CnnDS = null; TxOle = null; } }