public MasterEquipmentCollection GetAllEquipmentsInColl(DateTime dtCreated) { MasterEquipmentCollection equipments = null; if (this.TryConnection()) { DatabaseParameters parameters = new DatabaseParameters(); string str = dtCreated.Year.ToString() + "-" + dtCreated.Month.ToString() + "-" + dtCreated.Day.ToString() + " 00:00:00"; base.CurSQLFactory.SelectCommand(parameters, this.DataStructrure.Tables.MasterEquipment.ActualTableName); base.CurSQLFactory.SQL = base.CurSQLFactory.SQL + " WHERE dt_created >= CAST('" + str + "' AS DATETIME)"; DataTable table = base.CurDBEngine.SelectQuery(base.CurSQLFactory.SQL); if (table == null) { return(equipments); } equipments = new MasterEquipmentCollection(); foreach (DataRow row in table.Rows) { MasterEquipment equipment = new MasterEquipment(row[this.DataStructrure.Tables.MasterEquipment.EquipmentID.ActualFieldName].ToString()) { equipment_desc = row[this.DataStructrure.Tables.MasterEquipment.EquipmentDescription.ActualFieldName].ToString(), equipment_obj = row[this.DataStructrure.Tables.MasterEquipment.EquipmentObject.ActualFieldName].ToString(), equipment_snr = row[this.DataStructrure.Tables.MasterEquipment.Equipmentsnr.ActualFieldName].ToString(), equipment_location = row[this.DataStructrure.Tables.MasterEquipment.EquipmentLocation.ActualFieldName].ToString(), equipment_profile = row[this.DataStructrure.Tables.MasterEquipment.EquipmentProfile.ActualFieldName].ToString() }; equipments.Add(equipment); } } return(equipments); }
public string DownloadMasterEquipment(DateTime dtCreated) { UploadManager CurUploadManager = new UploadManager(); MasterEquipmentCollection equipmentCollection = CurUploadManager.DownloadMasterEquipment(dtCreated); string json = JsonConvert.SerializeObject(equipmentCollection); return(json); }
public string DownloadMasterDataFromSQL(DateTime dtCreated, string employeeID) { string json = ""; this.GeneralLogManager = new LogManager(tmp_config); try { UploadManager CurUploadManager = new UploadManager(); MasterCauseCollection CausesCollection = CurUploadManager.DownloadMasterCauses(dtCreated); if (CausesCollection != null) { json += "MasterCauses " + JsonConvert.SerializeObject(CausesCollection); } MasterDamageCollection DamagesCollection = CurUploadManager.DownloadMasterDamages(dtCreated); if (DamagesCollection != null) { json += "MasterDamages" + JsonConvert.SerializeObject(DamagesCollection); } MasterCustomerCollection customerCollection = CurUploadManager.DownloadMasterCustomers(dtCreated); if (customerCollection != null) { json += "MasterCustomers" + JsonConvert.SerializeObject(customerCollection); } MasterEquipmentCollection equipmentCollection = CurUploadManager.DownloadMasterEquipment(dtCreated); if (equipmentCollection != null) { json += "MasterEquipment" + JsonConvert.SerializeObject(equipmentCollection); } MasterLookUpCollection lookUpCollection = CurUploadManager.DownloadMasterLookUp(dtCreated); if (lookUpCollection != null) { json += "MasterLookUp" + JsonConvert.SerializeObject(lookUpCollection); } ApplicationUserCollection UserCollection = CurUploadManager.DownloadMasterUsersInColl(dtCreated); if (UserCollection != null) { json += "MasterUsers" + JsonConvert.SerializeObject(UserCollection); } MasterQuickNotesCollection quickNotesCollection = CurUploadManager.DownloadQuickNotes(); if (quickNotesCollection != null) { json += "MasterQuickNotes" + JsonConvert.SerializeObject(quickNotesCollection); } MasterCheckListTypeCollection masterCheckListTypeColleaction = CurUploadManager.DownloadMasterCheckListType(); if (masterCheckListTypeColleaction != null) { json += "MasterCheckListType" + JsonConvert.SerializeObject(masterCheckListTypeColleaction); } MasterCheckListInCollection masterCheckListCollection = CurUploadManager.DownloadMasterCheckList(); if (masterCheckListCollection != null) { json += "MasterCheckList" + JsonConvert.SerializeObject(masterCheckListCollection); } MasterCheckListRelationCollection checkListRelationCollection = CurUploadManager.DownloadMasterCheckListRelation(); if (checkListRelationCollection != null) { json += "MasterCheckListRelation" + JsonConvert.SerializeObject(checkListRelationCollection); } if (json.Equals("")) { this.GeneralLogManager.LogAction("DownloadMasterDataFromSQL", employeeID, "Result :: null "); } else { this.GeneralLogManager.LogAction("DownloadMasterDataFromSQL", employeeID, "Result :: " + json); } } catch (Exception e) { string ErrorID = SwissArmy.UniqueID(); this.CurLogManager.LogError(ErrorID, "DownloadMasterDataFromSQL: Error :: " + e.ToString(), employeeID); json = "Error: " + e.ToString(); } return(json); }