public IEnumerable <ComboBoxList> GetJobWorkerHelpList(int Processid, string term) { int CurrentSiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; string DivId = "|" + CurrentDivisionId.ToString() + "|"; string SiteId = "|" + CurrentSiteId.ToString() + "|"; var list = (from b in _unitOfWork.Repository <JobWorker>().Instance join bus in _unitOfWork.Repository <BusinessEntity>().Instance on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in _unitOfWork.Repository <Person>().Instance on b.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pp in _unitOfWork.Repository <PersonProcess>().Instance on b.PersonID equals pp.PersonId into PersonProcessTable from PersonProcessTab in PersonProcessTable.DefaultIfEmpty() where PersonProcessTab.ProcessId == Processid && (string.IsNullOrEmpty(term) ? 1 == 1 : PersonTab.Name.ToLower().Contains(term.ToLower())) && BusinessEntityTab.DivisionIds.IndexOf(DivId) != -1 && BusinessEntityTab.SiteIds.IndexOf(SiteId) != -1 orderby PersonTab.Name select new ComboBoxList { Id = b.PersonID, PropFirst = PersonTab.Name //PropSecond = BusinessEntityTab.SiteIds.IndexOf(SiteId).ToString() } ).Take(20); return(list.ToList()); }
public IQueryable <ComboBoxResult> GetCustomPerson(int Id, string term) { int DocTypeId = Id; int SiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; int DivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; var settings = new ProdOrderSettingsService(_unitOfWork).GetProdOrderSettingsForDocument(DocTypeId, DivisionId, SiteId); string[] PersonRoles = null; if (!string.IsNullOrEmpty(settings.filterPersonRoles)) { PersonRoles = settings.filterPersonRoles.Split(",".ToCharArray()); } else { PersonRoles = new string[] { "NA" }; } string DivIdStr = "|" + DivisionId.ToString() + "|"; string SiteIdStr = "|" + SiteId.ToString() + "|"; int ProcessId = new ProcessService(_unitOfWork).Find(ProcessConstants.Sales).ProcessId; var list = (from p in db.Persons join bus in db.BusinessEntity on p.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join pp in db.PersonProcess on p.PersonID equals pp.PersonId into PersonProcessTable from PersonProcessTab in PersonProcessTable.DefaultIfEmpty() join pr in db.PersonRole on p.PersonID equals pr.PersonId into PersonRoleTable from PersonRoleTab in PersonRoleTable.DefaultIfEmpty() where PersonProcessTab.ProcessId == ProcessId && (string.IsNullOrEmpty(term) ? 1 == 1 : (p.Name.ToLower().Contains(term.ToLower()) || p.Code.ToLower().Contains(term.ToLower()))) && (string.IsNullOrEmpty(settings.filterPersonRoles) ? 1 == 1 : PersonRoles.Contains(PersonRoleTab.RoleDocTypeId.ToString())) && BusinessEntityTab.DivisionIds.IndexOf(DivIdStr) != -1 && BusinessEntityTab.SiteIds.IndexOf(SiteIdStr) != -1 && (p.IsActive == null ? 1 == 1 : p.IsActive == true) group new { p } by new { p.PersonID } into Result orderby Result.Max(m => m.p.Name) select new ComboBoxResult { id = Result.Key.PersonID.ToString(), text = Result.Max(m => m.p.Name + ", " + m.p.Suffix + " [" + m.p.Code + "]"), } ); return(list); }
public AgentViewModel GetAgentViewModel(int id) { AgentViewModel Agentviewmodel = (from b in db.Agent join bus in db.BusinessEntity on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in db.Persons on BusinessEntityTab.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pa in db.PersonAddress on PersonTab.PersonID equals pa.PersonId into PersonAddressTable from PersonAddressTab in PersonAddressTable.DefaultIfEmpty() join ac in db.LedgerAccount on PersonTab.PersonID equals ac.PersonId into AccountTable from AccountTab in AccountTable.DefaultIfEmpty() where PersonTab.PersonID == id select new AgentViewModel { PersonId = PersonTab.PersonID, Name = PersonTab.Name, Suffix = PersonTab.Suffix, Code = PersonTab.Code, Phone = PersonTab.Phone, Mobile = PersonTab.Mobile, Email = PersonTab.Email, Address = PersonAddressTab.Address, CityId = PersonAddressTab.CityId, Zipcode = PersonAddressTab.Zipcode, IsSisterConcern = BusinessEntityTab.IsSisterConcern, IsActive = PersonTab.IsActive, LedgerAccountGroupId = AccountTab.LedgerAccountGroupId, CreatedBy = PersonTab.CreatedBy, CreatedDate = PersonTab.CreatedDate, PersonAddressID = PersonAddressTab.PersonAddressID, AccountId = AccountTab.LedgerAccountId, ImageFileName = PersonTab.ImageFileName, ImageFolderName = PersonTab.ImageFolderName }).FirstOrDefault(); var PersonRegistration = (from pp in db.PersonRegistration where pp.PersonId == id select new { PersonRegistrationId = pp.PersonRegistrationID, RregistrationType = pp.RegistrationType, RregistrationNo = pp.RegistrationNo }).ToList(); return(Agentviewmodel); }
public ComboBoxPagedResult GetListWithProcess(string searchTerm, int pageSize, int pageNum, int ProcessId) { int CurrentSiteId = (int)System.Web.HttpContext.Current.Session["SiteId"]; int CurrentDivisionId = (int)System.Web.HttpContext.Current.Session["DivisionId"]; string DivId = "|" + CurrentDivisionId.ToString() + "|"; string SiteId = "|" + CurrentSiteId.ToString() + "|"; var list = (from b in _JobworkerRepository.Instance join bus in _unitOfWork.Repository <BusinessEntity>().Instance on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in _unitOfWork.Repository <Person>().Instance on b.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pp in _unitOfWork.Repository <PersonProcess>().Instance on b.PersonID equals pp.PersonId into PersonProcessTable from PersonProcessTab in PersonProcessTable.DefaultIfEmpty() where PersonProcessTab.ProcessId == ProcessId && (string.IsNullOrEmpty(searchTerm) ? 1 == 1 : (PersonTab.Name.ToLower().Contains(searchTerm.ToLower()) || PersonTab.Code.ToLower().Contains(searchTerm.ToLower()))) && BusinessEntityTab.DivisionIds.IndexOf(DivId) != -1 && (PersonTab.IsActive == null ? 1 == 1 : PersonTab.IsActive == true) && BusinessEntityTab.SiteIds.IndexOf(SiteId) != -1 orderby PersonTab.Name select new ComboBoxResult { id = b.PersonID.ToString(), text = PersonTab.Name + "|" + PersonTab.Code, } ); var temp = list .Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList(); var count = list.Count(); ComboBoxPagedResult Data = new ComboBoxPagedResult(); Data.Results = temp; Data.Total = count; return(Data); }
public SupplierViewModel GetSupplierViewModel(int id) { SupplierViewModel Supplierviewmodel = (from b in db.Supplier join bus in db.BusinessEntity on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in db.Persons on BusinessEntityTab.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pa in db.PersonAddress on PersonTab.PersonID equals pa.PersonId into PersonAddressTable from PersonAddressTab in PersonAddressTable.DefaultIfEmpty() join ac in db.LedgerAccount on PersonTab.PersonID equals ac.PersonId into AccountTable from AccountTab in AccountTable.DefaultIfEmpty() where PersonTab.PersonID == id select new SupplierViewModel { PersonId = PersonTab.PersonID, Name = PersonTab.Name, Suffix = PersonTab.Suffix, Code = PersonTab.Code, Phone = PersonTab.Phone, Mobile = PersonTab.Mobile, Email = PersonTab.Email, Address = PersonAddressTab.Address, CityId = PersonAddressTab.CityId, Zipcode = PersonAddressTab.Zipcode, IsSisterConcern = BusinessEntityTab.IsSisterConcern, PersonRateGroupId = BusinessEntityTab.PersonRateGroupId, CreaditDays = BusinessEntityTab.CreaditDays, CreaditLimit = BusinessEntityTab.CreaditLimit, IsActive = PersonTab.IsActive, SalesTaxGroupPartyId = b.SalesTaxGroupPartyId, LedgerAccountGroupId = AccountTab.LedgerAccountGroupId, CreatedBy = PersonTab.CreatedBy, CreatedDate = PersonTab.CreatedDate, PersonAddressID = PersonAddressTab.PersonAddressID, AccountId = AccountTab.LedgerAccountId, SiteIds = BusinessEntityTab.SiteIds, DivisionIds = BusinessEntityTab.DivisionIds, Tags = PersonTab.Tags, ImageFileName = PersonTab.ImageFileName, ImageFolderName = PersonTab.ImageFolderName }).FirstOrDefault(); var PersonProcess = (from pp in db.PersonProcess where pp.PersonId == id select new { ProcessId = pp.ProcessId }).ToList(); foreach (var item in PersonProcess) { if (Supplierviewmodel.ProcessIds == "" || Supplierviewmodel.ProcessIds == null) { Supplierviewmodel.ProcessIds = item.ProcessId.ToString(); } else { Supplierviewmodel.ProcessIds = Supplierviewmodel.ProcessIds + "," + item.ProcessId.ToString(); } } var PersonRegistration = (from pp in db.PersonRegistration where pp.PersonId == id select new { PersonRegistrationId = pp.PersonRegistrationID, RregistrationType = pp.RegistrationType, RregistrationNo = pp.RegistrationNo }).ToList(); if (PersonRegistration != null) { foreach (var item in PersonRegistration) { if (item.RregistrationType == PersonRegistrationType.CstNo) { Supplierviewmodel.PersonRegistrationCstNoID = item.PersonRegistrationId; Supplierviewmodel.CstNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.TinNo) { Supplierviewmodel.PersonRegistrationTinNoID = item.PersonRegistrationId; Supplierviewmodel.TinNo = item.RregistrationNo; } } } string Divisions = Supplierviewmodel.DivisionIds; if (Divisions != null) { Divisions = Divisions.Replace('|', ' '); Supplierviewmodel.DivisionIds = Divisions; } string Sites = Supplierviewmodel.SiteIds; if (Sites != null) { Sites = Sites.Replace('|', ' '); Supplierviewmodel.SiteIds = Sites; } return(Supplierviewmodel); }
public CourierViewModel GetCourierViewModel(int id) { CourierViewModel Courierviewmodel = (from b in db.Courier join bus in db.BusinessEntity on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in db.Persons on BusinessEntityTab.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pa in db.PersonAddress on b.PersonID equals pa.PersonId into PersonAddressTable from PersonAddressTab in PersonAddressTable.DefaultIfEmpty() join ac in db.LedgerAccount on b.PersonID equals ac.PersonId into AccountTable from AccountTab in AccountTable.DefaultIfEmpty() where b.PersonID == id select new CourierViewModel { PersonId = b.PersonID, Name = PersonTab.Name, Suffix = PersonTab.Suffix, Code = PersonTab.Code, Phone = PersonTab.Phone, Mobile = PersonTab.Mobile, Email = PersonTab.Email, Address = PersonAddressTab.Address, CityId = PersonAddressTab.CityId, Zipcode = PersonAddressTab.Zipcode, TdsCategoryId = BusinessEntityTab.TdsCategoryId, TdsGroupId = BusinessEntityTab.TdsGroupId, IsActive = PersonTab.IsActive, LedgerAccountGroupId = AccountTab.LedgerAccountGroupId, CreatedBy = PersonTab.CreatedBy, CreatedDate = PersonTab.CreatedDate, PersonAddressID = PersonAddressTab.PersonAddressID, AccountId = AccountTab.LedgerAccountId, ImageFileName = PersonTab.ImageFileName, ImageFolderName = PersonTab.ImageFolderName } ).FirstOrDefault(); var PersonRegistration = (from pp in db.PersonRegistration where pp.PersonId == id select new { PersonRegistrationId = pp.PersonRegistrationID, RregistrationType = pp.RegistrationType, RregistrationNo = pp.RegistrationNo }).ToList(); if (PersonRegistration != null) { foreach (var item in PersonRegistration) { if (item.RregistrationType == PersonRegistrationType.PANNo) { Courierviewmodel.PersonRegistrationPanNoID = item.PersonRegistrationId; Courierviewmodel.PanNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.ServiceTaxNo) { Courierviewmodel.PersonRegistrationServiceTaxNoID = item.PersonRegistrationId; Courierviewmodel.ServiceTaxNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.KYCNo) { Courierviewmodel.PersonRegistrationKYCNoID = item.PersonRegistrationId; Courierviewmodel.KYCNo = item.RregistrationNo; } } } return(Courierviewmodel); }
public BuyerViewModel GetBuyerViewModel(int id) { BuyerViewModel buyerviewmodel = (from b in db.Buyer join bus in db.BusinessEntity on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join p in db.Persons on b.PersonID equals p.PersonID into PersonTable from PersonTab in PersonTable.DefaultIfEmpty() join pa in db.PersonAddress on PersonTab.PersonID equals pa.PersonId into PersonAddressTable from PersonAddressTab in PersonAddressTable.DefaultIfEmpty() join ac in db.LedgerAccount on PersonTab.PersonID equals ac.PersonId into AccountTable from AccountTab in AccountTable.DefaultIfEmpty() where PersonTab.PersonID == id select new BuyerViewModel { PersonId = PersonTab.PersonID, Name = PersonTab.Name, Suffix = PersonTab.Suffix, Code = PersonTab.Code, Phone = PersonTab.Phone, Mobile = PersonTab.Mobile, Email = PersonTab.Email, Address = PersonAddressTab.Address, CityId = PersonAddressTab.CityId, Zipcode = PersonAddressTab.Zipcode, PersonRateGroupId = BusinessEntityTab.PersonRateGroupId, CreaditDays = BusinessEntityTab.CreaditDays, CreaditLimit = BusinessEntityTab.CreaditLimit, IsActive = PersonTab.IsActive, SalesTaxGroupPartyId = BusinessEntityTab.SalesTaxGroupPartyId, CreatedBy = PersonTab.CreatedBy, CreatedDate = PersonTab.CreatedDate, SiteIds = BusinessEntityTab.SiteIds, Tags = PersonTab.Tags, ImageFileName = PersonTab.ImageFileName, ImageFolderName = PersonTab.ImageFolderName, ParentId = BusinessEntityTab.ParentId, GuarantorId = BusinessEntityTab.GuarantorId, IsSisterConcern = (bool?)BusinessEntityTab.IsSisterConcern ?? false, AccountId = (int?)AccountTab.LedgerAccountId ?? 0, PersonAddressID = (PersonAddressTab == null ? 0 : PersonAddressTab.PersonAddressID), LedgerAccountGroupId = (int?)AccountTab.LedgerAccountGroupId ?? 0, }).FirstOrDefault(); var PersonRegistration = (from pp in db.PersonRegistration where pp.PersonId == id select new { PersonRegistrationId = pp.PersonRegistrationID, RregistrationType = pp.RegistrationType, RregistrationNo = pp.RegistrationNo }).ToList(); if (PersonRegistration != null) { foreach (var item in PersonRegistration) { if (item.RregistrationType == PersonRegistrationType.CstNo) { buyerviewmodel.PersonRegistrationCstNoID = item.PersonRegistrationId; buyerviewmodel.CstNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.TinNo) { buyerviewmodel.PersonRegistrationTinNoID = item.PersonRegistrationId; buyerviewmodel.TinNo = item.RregistrationNo; } } } string Sites = buyerviewmodel.SiteIds; if (Sites != null) { Sites = Sites.Replace('|', ' '); buyerviewmodel.SiteIds = Sites; } return(buyerviewmodel); }
public PersonViewModel GetPersonViewModelForEdit(int id) { PersonViewModel Personviewmodel = (from b in db.Persons join bus in db.BusinessEntity on b.PersonID equals bus.PersonID into BusinessEntityTable from BusinessEntityTab in BusinessEntityTable.DefaultIfEmpty() join ac in db.LedgerAccount on b.PersonID equals ac.PersonId into AccountTable from AccountTab in AccountTable.DefaultIfEmpty() where b.PersonID == id select new PersonViewModel { PersonID = b.PersonID, DocTypeId = b.DocTypeId, Name = b.Name, Suffix = b.Suffix, Code = b.Code, Phone = b.Phone, Mobile = b.Mobile, Email = b.Email, TdsCategoryId = BusinessEntityTab.TdsCategoryId, TdsGroupId = BusinessEntityTab.TdsGroupId, IsSisterConcern = BusinessEntityTab.IsSisterConcern, CreaditDays = BusinessEntityTab.CreaditDays, CreaditLimit = BusinessEntityTab.CreaditLimit, GuarantorId = BusinessEntityTab.GuarantorId, IsActive = b.IsActive, LedgerAccountGroupId = AccountTab.LedgerAccountGroupId, SalesTaxGroupPartyId = BusinessEntityTab.SalesTaxGroupPartyId, SalesTaxGroupPartyName = BusinessEntityTab.SalesTaxGroupParty.ChargeGroupPersonName, CreatedBy = b.CreatedBy, CreatedDate = b.CreatedDate, AccountId = AccountTab.LedgerAccountId, DivisionIds = BusinessEntityTab.DivisionIds, SiteIds = BusinessEntityTab.SiteIds, Tags = b.Tags, ImageFileName = b.ImageFileName, ImageFolderName = b.ImageFolderName } ).FirstOrDefault(); var PersonAddress = (from Pa in db.PersonAddress where Pa.PersonId == id && Pa.AddressType == null select new { Address = Pa.Address, CityId = Pa.CityId, Zipcode = Pa.Zipcode, PersonAddressID = Pa.PersonAddressID, }).FirstOrDefault(); if (Personviewmodel != null) { Personviewmodel.PersonAddressID = PersonAddress.PersonAddressID; Personviewmodel.Address = PersonAddress.Address; Personviewmodel.CityId = PersonAddress.CityId; Personviewmodel.Zipcode = PersonAddress.Zipcode; } var PersonRegistration = (from pp in db.PersonRegistration where pp.PersonId == id select new { PersonRegistrationId = pp.PersonRegistrationID, RregistrationType = pp.RegistrationType, RregistrationNo = pp.RegistrationNo }).ToList(); if (PersonRegistration != null) { foreach (var item in PersonRegistration) { if (item.RregistrationType == PersonRegistrationType.PANNo) { Personviewmodel.PersonRegistrationPanNoID = item.PersonRegistrationId; Personviewmodel.PanNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.GstNo) { Personviewmodel.PersonRegistrationGstNoID = item.PersonRegistrationId; Personviewmodel.GstNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.CstNo) { Personviewmodel.PersonRegistrationCstNoID = item.PersonRegistrationId; Personviewmodel.CstNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.TinNo) { Personviewmodel.PersonRegistrationTinNoID = item.PersonRegistrationId; Personviewmodel.TinNo = item.RregistrationNo; } if (item.RregistrationType == PersonRegistrationType.AadharNo) { Personviewmodel.PersonRegistrationAadharNoID = item.PersonRegistrationId; Personviewmodel.AadharNo = item.RregistrationNo; } } } string Divisions = Personviewmodel.DivisionIds; if (Divisions != null) { Divisions = Divisions.Replace('|', ' '); Personviewmodel.DivisionIds = Divisions; } string Sites = Personviewmodel.SiteIds; if (Sites != null) { Sites = Sites.Replace('|', ' '); Personviewmodel.SiteIds = Sites; } return(Personviewmodel); }