public bool AddTCashSlip(TCashSlip TCashSlip) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "AddTCashSlip"; cmd.Parameters.AddWithValue("@CashSlipNo", TCashSlip.CashSlipNo); cmd.Parameters.AddWithValue("@DocketUserNo", TCashSlip.DocketUserNo); cmd.Parameters.AddWithValue("@ToDate", TCashSlip.ToDate); cmd.Parameters.AddWithValue("@LedgerNo", TCashSlip.LedgerNo); cmd.Parameters.AddWithValue("@UserID", TCashSlip.UserID); cmd.Parameters.AddWithValue("@UserDate", TCashSlip.UserDate); cmd.Parameters.AddWithValue("@CompanyNo", TCashSlip.CompanyNo); SqlParameter outParameter = new SqlParameter(); outParameter.ParameterName = "@ReturnID"; outParameter.Direction = ParameterDirection.Output; outParameter.DbType = DbType.Int32; cmd.Parameters.Add(outParameter); commandcollection.Add(cmd); return(true); }
public TCashSlip ModifyTCashSlipByID(long ID) { SqlConnection Con = new SqlConnection(CommonFunctions.ConStr); string sql; SqlCommand cmd; sql = "Select * from TCashSlip where CashSlipNo =" + 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) { TCashSlip MM = new TCashSlip(); while (dr.Read()) { MM.CashSlipNo = Convert.ToInt32(dr["CashSlipNo"]); if (!Convert.IsDBNull(dr["DocketUserNo"])) { MM.DocketUserNo = Convert.ToInt64(dr["DocketUserNo"]); } if (!Convert.IsDBNull(dr["ToDate"])) { MM.ToDate = Convert.ToDateTime(dr["ToDate"]); } if (!Convert.IsDBNull(dr["LedgerNo"])) { MM.LedgerNo = Convert.ToInt64(dr["LedgerNo"]); } 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["CompanyNo"])) { MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]); } } dr.Close(); return(MM); } else { dr.Close(); } return(new TCashSlip()); }
public bool DeleteTCashSlip(TCashSlip TCashSlip) { SqlCommand cmd; cmd = new SqlCommand(); cmd.CommandType = CommandType.StoredProcedure; cmd.CommandText = "DeleteTCashSlip"; cmd.Parameters.AddWithValue("@CashSlipNo", TCashSlip.CashSlipNo); if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true) { return(true); } else { return(false); } }