public bool AddMBank(MOtherBank mbank) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddMOtherBank"; cmd.Parameters.AddWithValue("@BankNo", mbank.BankNo); cmd.Parameters.AddWithValue("@BankName", mbank.BankName); cmd.Parameters.AddWithValue("@IsActive", mbank.IsActive); cmd.Parameters.AddWithValue("@UserID", mbank.UserID); cmd.Parameters.AddWithValue("@UserDate", mbank.UserDate); cmd.Parameters.AddWithValue("@CompanyNo", mbank.CompanyNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mbank.msg = ObjTrans.ErrorMessage; return(false); } }
public MOtherBank ModifyMBankByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from MOtherBank where BankNo =" + 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) { MOtherBank MM = new MOtherBank(); while (dr.Read()) { MM.BankNo = Convert.ToInt32(dr["BankNo"]); if (!Convert.IsDBNull(dr["BankName"])) { MM.BankName = Convert.ToString(dr["BankName"]); } if (!Convert.IsDBNull(dr["IsActive"])) { MM.IsActive = Convert.ToBoolean(dr["IsActive"]); } 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"]); } if (!Convert.IsDBNull(dr["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new MOtherBank()); }
public bool DeleteMBank(MOtherBank mbank) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteMOtherBank"; cmd.Parameters.AddWithValue("@BankNo", mbank.BankNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { mbank.msg = ObjTrans.ErrorMessage; return(false); } }