public static CBE.CustomerAppointmentCollection GetCustomerAppointmentByAccountId(CBE.CustomerAppointmentCBE CustomerAppointment) { VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection CustomerAppointmentQueues = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection(); try { string spName = Constants.oraclePackagePrefix + "CUSTAPPOINTMENT_GETACC_ID"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_TMS_ID", DbType.Int32, CustomerAppointment.TmsId, ParameterDirection.Input)); command.Parameters.Add(VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.CreateDbParameter(ref command, "P_ACCOUNT_ID", DbType.Int32, CustomerAppointment.AccountId, ParameterDirection.Input)); DataSet ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName); DataTable dt = ds.Tables[tableName]; return(CustomerAppointmentQueues = ConvertDataTableToCollection(dt)); } catch (Exception ex) { throw ex; } }
public static VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection GetAllCustomerAppointment() { VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection customerQueue = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection(); try { //Stored procedure must have cur_out parameter. //There is no need to add ref cursor for oracle in code. string spName = VaaaN.MLFF.Libraries.CommonLibrary.Constants.oraclePackagePrefix + "CUSTOMER_APPOINTMENT_GETALL"; DbCommand command = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.GetStoredProcCommand(spName); DataSet ds = VaaaN.MLFF.Libraries.CommonLibrary.DBA.DBAccessor.LoadDataSet(command, tableName); DataTable dt = ds.Tables[tableName]; customerQueue = ConvertDataTableToCollection(dt); } catch (Exception ex) { throw ex; } return(customerQueue); }
private static VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection ConvertDataTableToCollection(DataTable dt) { try { VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection customerAppointments = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCollection(); for (int i = 0; i < dt.Rows.Count; i++) { VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCBE customerAppointment = new VaaaN.MLFF.Libraries.CommonLibrary.CBE.CustomerAppointmentCBE(); if (dt.Rows[i]["TMS_ID"] != DBNull.Value) { customerAppointment.TmsId = Convert.ToInt32(dt.Rows[i]["TMS_ID"]); } if (dt.Rows[i]["CUSTOMER_APPOINTMENT_ID"] != DBNull.Value) { customerAppointment.CustomerAppointmentId = Convert.ToInt32(dt.Rows[i]["CUSTOMER_APPOINTMENT_ID"]); } if (dt.Rows[i]["ACCOUNT_ID"] != DBNull.Value) { customerAppointment.AccountId = Convert.ToInt32(dt.Rows[i]["ACCOUNT_ID"]); } if (dt.Rows[i]["APPOINTMENT_LOCATION"] != DBNull.Value) { customerAppointment.AppointmentLocation = Convert.ToString(dt.Rows[i]["APPOINTMENT_LOCATION"]); } if (dt.Rows[i]["APPOINTMENT_DATE"] != DBNull.Value) { customerAppointment.AppointmentDate = Convert.ToString(dt.Rows[i]["APPOINTMENT_DATE"]); } if (dt.Rows[i]["APPOINTED_BY"] != DBNull.Value) { customerAppointment.AppointedById = Convert.ToInt32(dt.Rows[i]["APPOINTED_BY"]); } if (dt.Rows[i]["ATTENDED_BY"] != DBNull.Value) { customerAppointment.AttendedbyId = Convert.ToInt32(dt.Rows[i]["ATTENDED_BY"]); } if (dt.Rows[i]["CREATION_DATE"] != DBNull.Value) { customerAppointment.CreationDate = Convert.ToDateTime(dt.Rows[i]["CREATION_DATE"]); } if (dt.Rows[i]["MODIFIER_ID"] != DBNull.Value) { customerAppointment.ModifierId = Convert.ToInt32(dt.Rows[i]["MODIFIER_ID"]); } if (dt.Rows[i]["MODIFICATION_DATE"] != DBNull.Value) { customerAppointment.ModificationDate = Convert.ToDateTime(dt.Rows[i]["MODIFICATION_DATE"]); } customerAppointments.Add(customerAppointment); } return(customerAppointments); } catch (Exception ex) { throw ex; } }