public TChequeNoDetails ModifyTChequeNoDetailsByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TChequeNoDetails where PkSrNo =" + 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) { TChequeNoDetails MM = new TChequeNoDetails(); while (dr.Read()) { MM.PkSrNo = Convert.ToInt32(dr["PkSrNo"]); if (!Convert.IsDBNull(dr["FkChequeNo"])) { MM.FkChequeNo = Convert.ToInt64(dr["FkChequeNo"]); } if (!Convert.IsDBNull(dr["ChequeDetailsUserNo"])) { MM.ChequeDetailsUserNo = Convert.ToString(dr["ChequeDetailsUserNo"]); } if (!Convert.IsDBNull(dr["FkVoucherTrnNo"])) { MM.FkVoucherTrnNo = Convert.ToInt64(dr["FkVoucherTrnNo"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TChequeNoDetails()); }
public bool DeleteTChequeNoDetails(TChequeNoDetails tchequenodetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTChequeNoDetails"; cmd.Parameters.AddWithValue("@PkSrNo", tchequenodetails.PkSrNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { tchequenodetails.msg = ObjTrans.ErrorMessage; return(false); } }
public bool AddTChequeNoDetails(TChequeNoDetails tchequenodetails) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTChequeNoDetails"; cmd.Parameters.AddWithValue("@PkSrNo", tchequenodetails.PkSrNo); //cmd.Parameters.AddWithValue("@FkChequeNo", tchequenodetails.FkChequeNo); cmd.Parameters.AddWithValue("@ChequeDetailsUserNo", tchequenodetails.ChequeDetailsUserNo); cmd.Parameters.AddWithValue("@FkVoucherTrnNo", tchequenodetails.FkVoucherTrnNo); cmd.Parameters.AddWithValue("@IsActive", tchequenodetails.IsActive); commandcollection.Add(cmd); return(true); }