public bool AddTVoucherEntryFormDetails(TVoucherEntryFormDetails tvoucherentryformdetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTVoucherEntryFormDetails"; cmd.Parameters.AddWithValue("@PkVoucherFormNo", tvoucherentryformdetails.PkVoucherFormNo); cmd.Parameters.AddWithValue("@FkVoucherNo", tvoucherentryformdetails.FkVoucherNo); cmd.Parameters.AddWithValue("@VoucherFormDate", tvoucherentryformdetails.VoucherFormDate); cmd.Parameters.AddWithValue("@FormNo", tvoucherentryformdetails.FormNo); cmd.Parameters.AddWithValue("@CompanyNo", tvoucherentryformdetails.CompanyNo); cmd.Parameters.AddWithValue("@UserID", tvoucherentryformdetails.UserID); cmd.Parameters.AddWithValue("@UserDate", tvoucherentryformdetails.UserDate); commandcollection.Add(cmd); return(true); }
public bool DeleteTVoucherEntryFormDetails(TVoucherEntryFormDetails tvoucherentryformdetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTVoucherEntryFormDetails"; cmd.Parameters.AddWithValue("@PkVoucherFormNo", tvoucherentryformdetails.PkVoucherFormNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { tvoucherentryformdetails.msg = ObjTrans.ErrorMessage; return(false); } }
public TVoucherEntryFormDetails ModifyTVoucherEntryFormDetailsByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TVoucherEntryFormDetails where PkVoucherFormNo =" + ID; cmd = new SqlCommand(sql, Con); cmd.Connection = Con; Con.Open(); cmd.CommandType = CommandType.Text; SqlDataReader dr; dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); if (dr.HasRows) { TVoucherEntryFormDetails MM = new TVoucherEntryFormDetails(); while (dr.Read()) { MM.PkVoucherFormNo = Convert.ToInt32(dr["PkVoucherFormNo"]); if (!Convert.IsDBNull(dr["FkVoucherNo"])) { MM.FkVoucherNo = Convert.ToInt64(dr["FkVoucherNo"]); } if (!Convert.IsDBNull(dr["VoucherFormDate"])) { MM.VoucherFormDate = Convert.ToDateTime(dr["VoucherFormDate"]); } if (!Convert.IsDBNull(dr["FormNo"])) { MM.FormNo = Convert.ToString(dr["FormNo"]); } if (!Convert.IsDBNull(dr["StatusNo"])) { MM.StatusNo = Convert.ToInt64(dr["StatusNo"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } if (!Convert.IsDBNull(dr["UserID"])) { MM.UserID = Convert.ToInt64(dr["UserID"]); } if (!Convert.IsDBNull(dr["UserDate"])) { MM.UserDate = Convert.ToDateTime(dr["UserDate"]); } if (!Convert.IsDBNull(dr["ModifiedBy"])) { MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TVoucherEntryFormDetails()); }