public static List <DCDeviceAllotment> GetDCDeviceAllotementList(bool allOffices = false, bool showDeleted = false) { List <DCDeviceAllotment> DCDeviceAllotmentList = new List <DCDeviceAllotment>(); DataTable DCDeviceAllotmentTable = new DataTable(); DCDeviceAllotmentTable = DCDeviceAllotmentDataAccess.GetInstance.GetDCDeviceAllotementList(allOffices, showDeleted); foreach (DataRow dr in DCDeviceAllotmentTable.Rows) { DCDeviceAllotment TheDCDevice = DataRowToObject(dr); DCDeviceAllotmentList.Add(TheDCDevice); } return(DCDeviceAllotmentList); }
public static DCDeviceAllotment DataRowToObject(DataRow dr) { DCDeviceAllotment TheDCDeviceAllotment = new DCDeviceAllotment(); TheDCDeviceAllotment.DCDeviceAllotmentID = int.Parse(dr["DCDeviceAllotmentID"].ToString()); TheDCDeviceAllotment.DCDeviceID = int.Parse(dr["DCDeviceID"].ToString()); TheDCDeviceAllotment.DCDeviceCode = dr["DCDeviceCode"].ToString(); TheDCDeviceAllotment.DCDeviceSerialNumber = dr["DCDeviceSerialNumber"].ToString(); TheDCDeviceAllotment.DCCollectorID = int.Parse(MicroGlobals.ReturnZeroIfNull(dr["DCCollectorID"].ToString())); TheDCDeviceAllotment.DCCollectorName = dr["DCCollectorName"].ToString(); TheDCDeviceAllotment.EffectiveDateFrom = dr["EffectiveDateFrom"].ToString(); TheDCDeviceAllotment.EffectiveDateTo = dr["EffectiveDateTo"].ToString(); TheDCDeviceAllotment.AddedBy = int.Parse(dr["AddedBy"].ToString()); TheDCDeviceAllotment.OfficeID = int.Parse(dr["OfficeID"].ToString()); TheDCDeviceAllotment.DateAdded = DateTime.Parse(dr["DateAdded"].ToString()).ToString(MicroConstants.DateFormat); return(TheDCDeviceAllotment); }
public int InsertDCDeviceAllotment(DCDeviceAllotment theDCDeviceAllotment) { int ReturnValue = 0; using (SqlCommand InsertCommand = new SqlCommand()) { InsertCommand.CommandType = CommandType.StoredProcedure; InsertCommand.Parameters.Add(GetParameter("@ReturnValue", SqlDbType.Int, ReturnValue)).Direction = ParameterDirection.Output; InsertCommand.Parameters.Add(GetParameter("@DCDeviceID", SqlDbType.Int, theDCDeviceAllotment.DCDeviceID)); InsertCommand.Parameters.Add(GetParameter("@DCCollectorID", SqlDbType.Int, theDCDeviceAllotment.DCCollectorID)); InsertCommand.Parameters.Add(GetParameter("@EffectiveDateFrom", SqlDbType.VarChar, theDCDeviceAllotment.EffectiveDateFrom)); InsertCommand.Parameters.Add(GetParameter("@OfficeID", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.OfficeID)); InsertCommand.Parameters.Add(GetParameter("@AddedBy", SqlDbType.Int, Micro.Commons.Connection.LoggedOnUser.UserID)); InsertCommand.CommandText = "pCRM_DCDeviceAllotments_Insert"; ExecuteStoredProcedure(InsertCommand); ReturnValue = int.Parse(InsertCommand.Parameters[0].Value.ToString()); return(ReturnValue); } }
public static int InsertDCDeviceAllotment(DCDeviceAllotment theDCDeviceAllotment) { return(DCDeviceAllotmentDataAccess.GetInstance.InsertDCDeviceAllotment(theDCDeviceAllotment)); }
public int InsertDCDeviceAllotment(DCDeviceAllotment theDCDeviceAllotment) { return(DCDeviceAllotementIntegration.InsertDCDeviceAllotment(theDCDeviceAllotment)); }