public int SowDetailInsert(SowDetailBAL sowDetailBAL) { try { con = Connection.GetConnection(); cmd = Connection.GetCommand("SowDetailInsert", con); con.Open(); cmd.Parameters.AddWithValue("@SowDocument", sowDetailBAL.SowDocument); cmd.Parameters.AddWithValue("@ProjectId", sowDetailBAL.ProjectId); cmd.Parameters.AddWithValue("@SowDetailId", sowDetailBAL.SowDetailId); cmd.Parameters["@SowDetailId"].Direction = ParameterDirection.InputOutput; cmd.ExecuteNonQuery(); int SowId = Convert.ToInt32(cmd.Parameters["@SowDetailId"].Value); con.Close(); return(SowId); } catch (Exception ex) { throw ex; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } } }
public DataTable SowDetailSelect(SowDetailBAL sowDetailBAL) { try { dt = new DataTable(); con = Connection.GetConnection(); cmd = Connection.GetCommand("SowDetailSelect", con); cmd.Parameters.AddWithValue("@ProjectId", sowDetailBAL.ProjectId); sda = new SqlDataAdapter(cmd); sda.Fill(dt); return(dt); } catch (Exception ex) { throw ex; } }
public static string DeleteSowDetail(string SowDetailId, string filePath) { SowDetailBAL sowDetailBAL = new SowDetailBAL(); try { sowDetailBAL.SowDetailId = Convert.ToInt32(SowDetailId); sowDetailBAL.SowDetailDelete(); if (File.Exists(filePath)) { File.Delete(filePath); } return("0"); } catch (Exception ex) { return(ex.Message); } }
public void SowDetailDelete(SowDetailBAL sowDetailBAL) { try { con = Connection.GetConnection(); cmd = Connection.GetCommand("SowDetailDelete", con); con.Open(); cmd.Parameters.AddWithValue("@SowDetailId", sowDetailBAL.SowDetailId); cmd.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { throw ex; } finally { if (con.State != ConnectionState.Closed) { con.Close(); } } }