/// <summary> /// This function returns list of Departments for a specific state, city or village and its locality. /// </summary> /// <param name="stateId"></param> /// <param name="cityId"></param> /// <param name="villageId"></param> /// <param name="localityId"></param> /// <param name="departmentTypeId"></param> /// <returns></returns> public static List <Department> GetAllByLocationAndType(int stateId, int cityId, int villageId, int localityId, int departmentTypeId) { String SQL = null; List <Department> list = null; if (villageId != 0) { SQL = String.Format("select * from Departments where StateId='{0}' and CityId='{1}' and VillageId='{2}' and LocalityId='{3}' and DepartmentTypeId='{4}' ", stateId, cityId, villageId, localityId, departmentTypeId); } else { SQL = String.Format("select * from Departments where StateId='{0}' and CityId='{1}' and LocalityId='{2}' and DepartmentTypeId='{3}' ", stateId, cityId, localityId, departmentTypeId); } list = BaseDataAccess.GetRecordsList <Department>(SQL); foreach (Department info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); } return(list); }
public static BusinessObjects.Village GetDetails(int Id) { VillageDA V = new VillageDA(); var InDb = V.context.Villages.SingleOrDefault(v => v.Id == Id); BusinessObjects.Village village = new BusinessObjects.Village { Id = InDb.Id, Name = InDb.Name, Block = InDb.Block, DistrictId = InDb.DistrictId }; V.context.Dispose(); return(village); }
public static List <Locality> GetAll() { List <Locality> list = null; list = BaseDataAccess.GetRecordsList <Locality>(String.Format("select * from Localities")); foreach (Locality info in list) { info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } } return(list); }
public static List <Department> GetAll() { List <Department> list = null; list = BaseDataAccess.GetRecordsList <Department>(String.Format("select * from Departments ")); foreach (Department info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); info.Village = VillageDA.GetDetails(info.VillageId); info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); } return(list); }
public static DepartmentXAreaIncharge GetDetails(int id) { DepartmentXAreaIncharge info = null; info = BaseDataAccess.GetRecords <DepartmentXAreaIncharge>(String.Format("select * from DepartmentXAreaIncharges where Id='{0}'", id)); info.Department = DepartmentDA.GetDetails(info.DepartmentId); info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.GovernmentOfficial = GovernmentOfficialDA.GetDetails(info.InchargeId); return(info); }
public static List <BusinessObjects.Village> GetAll() { VillageDA V = new VillageDA(); List <BusinessObjects.Village> list = new List <BusinessObjects.Village>(); var listVillagesInDb = V.context.Villages.ToList(); foreach (var InDb in listVillagesInDb) { BusinessObjects.Village village = new BusinessObjects.Village { Id = InDb.Id, Name = InDb.Name, Block = InDb.Block, DistrictId = InDb.DistrictId }; list.Add(village); } return(list); }
public static Locality GetDetails(int id) { Locality info = null; info = BaseDataAccess.GetRecords <Locality>(String.Format("select * from Localities where Id='{0}' ", id)); if (info != null) { info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } return(info); } else { return(info); } }
public static bool Delete(BusinessObjects.Village villageBO) { VillageDA V = new VillageDA(); var InDb = V.context.Villages.SingleOrDefault(v => v.Id == villageBO.Id); V.context.Villages.Remove(InDb); int affectedRows = V.context.SaveChanges(); V.context.Dispose(); if (affectedRows > 0) { return(true); } else { return(false); } }
public static DepartmentXAreaOnDuty GetByTime(int departmentId, DateTime timeOfDay) { DepartmentXAreaOnDuty info = null; info = BaseDataAccess.GetRecords <DepartmentXAreaOnDuty>(String.Format("select * from DepartmentXAreaOnDuty where DepartmentId='{0}'", departmentId)); if (info != null) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.Department = DepartmentDA.GetDetails(info.DepartmentId); info.GovermentOfficial = GovernmentOfficialDA.GetDetails(info.OnDutyPersonId); } return(info); }
public static List <Complaint> GetAllByAdhar(string Adhar) { List <Complaint> list = null; list = BaseDataAccess.GetRecordsList <Complaint>(String.Format("select * from Complaints where ReportingPersonAdhaarId='{0}' ", Adhar)); foreach (Complaint info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); info.ComplaintType = ComplaintTypeDA.GetDetails(info.ComplaintTypeId); info.ComplaintStatus = ComplaintStatusDA.GetDetails(info.CurrentStatusId); } return(list); }
public static List <Complaint> GetAllByDateRange(int departmentId) { List <Complaint> list = null; list = BaseDataAccess.GetRecordsList <Complaint>(String.Format("select * from Complaints where departmentId={0}", departmentId)); foreach (Complaint info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); info.ComplaintType = ComplaintTypeDA.GetDetails(info.ComplaintTypeId); info.ComplaintStatus = ComplaintStatusDA.GetDetails(info.CurrentStatusId); } return(list); }
public static List <DepartmentXAreaOnDuty> GetAll() { List <DepartmentXAreaOnDuty> list = null; list = BaseDataAccess.GetRecordsList <DepartmentXAreaOnDuty>(String.Format("select * from DepartmentXAreaOnDuty ")); foreach (DepartmentXAreaOnDuty info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.Department = DepartmentDA.GetDetails(info.DepartmentId); info.GovermentOfficial = GovernmentOfficialDA.GetDetails(info.OnDutyPersonId); } return(list); }
public static List <DepartmentXAreaIncharge> GetAllForDepartment(int departmentId) { List <DepartmentXAreaIncharge> list = null; list = BaseDataAccess.GetRecordsList <DepartmentXAreaIncharge>(String.Format("select * from DepartmentXAreaIncharges where departmentId='{0}' ", departmentId)); foreach (DepartmentXAreaIncharge info in list) { info.Department = DepartmentDA.GetDetails(info.DepartmentId); info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.GovernmentOfficial = GovernmentOfficialDA.GetDetails(info.InchargeId); } return(list); }
public static Complaint GetDetails(int id) { Complaint info = null; info = BaseDataAccess.GetRecords <Complaint>(String.Format("select * from Complaints where Id='{0}' ", id)); if (info != null) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); info.ComplaintType = ComplaintTypeDA.GetDetails(info.ComplaintTypeId); info.ComplaintStatus = ComplaintStatusDA.GetDetails(info.CurrentStatusId); info.Department = DepartmentDA.GetDetails(info.DepartmentId); } return(info); }
public static bool Update(BusinessObjects.Village villageBO) { VillageDA V = new VillageDA(); var InDb = V.context.Villages.SingleOrDefault(v => v.Id == villageBO.Id); InDb.Name = villageBO.Name; InDb.DistrictId = villageBO.DistrictId; InDb.Block = villageBO.Block; int affectedRows = V.context.SaveChanges(); V.context.Dispose(); if (affectedRows > 0) { return(true); } else { return(false); } }
public static List <DepartmentXAreaOnDuty> GetAllByLocationAndDepartment(int localityId, int departmentId) { List <DepartmentXAreaOnDuty> list = null; list = BaseDataAccess.GetRecordsList <DepartmentXAreaOnDuty>(String.Format("select * from DepartmentXAreaOnDuty where LocalityId='{0}' and DepartmentId='{1}' ", localityId, departmentId)); foreach (DepartmentXAreaOnDuty info in list) { info.DutyTimeFrom = Convert.ToDateTime(info.DutyTimeFrom.ToString("hh:mm:ss")); info.DutyTimeTo = Convert.ToDateTime(info.DutyTimeTo.ToString("hh:mm:ss")); info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.Department = DepartmentDA.GetDetails(info.DepartmentId); info.GovermentOfficial = GovernmentOfficialDA.GetDetails(info.OnDutyPersonId); } return(list); }
public static List <Department> GetAllByCity(int cityId) { String SQL = null; List <Department> list = null; SQL = String.Format("select * from Departments where CityId='{0}' ", cityId); list = BaseDataAccess.GetRecordsList <Department>(SQL); foreach (Department info in list) { info.State = StateDA.GetDetails(info.StateId); info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } info.Locality = LocalityDA.GetDetails(info.LocalityId); info.DepartmentType = DepartmentTypeDA.GetDetails(info.DepartmentTypeId); } return(list); }
public static List <Locality> GetDetails(int CityId, int VillageId) { List <Locality> list = null; if (VillageId != 0) { list = BaseDataAccess.GetRecordsList <Locality>(String.Format("select * from Localities where CityId='{0}' and VillageId='{1}' ", CityId, VillageId)); } else { list = BaseDataAccess.GetRecordsList <Locality>(String.Format("select * from Localities where CityId='{0}' and VillageId is NULL ", CityId)); } foreach (Locality info in list) { info.City = CityDA.GetDetails(info.CityId); if (info.VillageId != 0) { info.Village = VillageDA.GetDetails(info.VillageId); } } return(list); }
public static bool Add(BusinessObjects.Village villageBO) { VillageDA V = new VillageDA(); var village = new Village { Name = villageBO.Name, DistrictId = villageBO.DistrictId, Block = villageBO.Block }; V.context.Villages.Add(village); int affectedRows = V.context.SaveChanges(); V.context.Dispose(); if (affectedRows > 0) { return(true); } else { return(false); } }