public MasterEmployeeResult GetADMasterEmployeeByID(long MasterEmployeeId) { try { var _data = (from ME in _Context.ADMasterEmployees join SA in _Context.ADMasterSalutations on ME.MasterSalutationId equals SA.MasterSalutationId into SAGroup from SA in SAGroup.DefaultIfEmpty() join MG in _Context.ADMasterGenders on ME.Gender equals MG.MasterGenderId into MGGroup from MG in MGGroup.DefaultIfEmpty() join MD in _Context.ADMasterDesignations on ME.MasterDesignationId equals MD.MasterDesignationId into MDGroup from MD in MDGroup.DefaultIfEmpty() join DA in _Context.ADMasterDepartments on ME.MasterDepartmentId equals DA.MasterDepartmentId into DAGroup from DA in DAGroup.DefaultIfEmpty() join ME2 in _Context.ADMasterEmployees on ME.ReportingHeadId equals ME2.MasterEmployeeId into ME2Group from ME2 in ME2Group.DefaultIfEmpty() join MD2 in _Context.ADMasterDesignations on ME2.MasterDesignationId equals MD2.MasterDesignationId into MD2Group from MD2 in MD2Group.DefaultIfEmpty() join ET in _Context.ADMasterEmployeeTypes on ME.MasterEmployeeTypeId equals ET.MasterEmployeeTypeId into ETGroup from ET in ETGroup.DefaultIfEmpty() join TZ in _Context.ADMasterTimeZones on ME.MasterTimeZoneId equals TZ.MasterTimeZoneId into TZGroup from TZ in TZGroup.DefaultIfEmpty() join ES in _Context.ADMasterEmployeeStatus on ME.MasterEmployeeStatusId equals ES.MasterEmployeeStatusId into ESGroup from ES in ESGroup.DefaultIfEmpty() join CC in _Context.ADMasterCountries on ME.MasterCountryId equals CC.MasterCountryId into CCGroup from CC in CCGroup.DefaultIfEmpty() join MS in _Context.ADMasterStates on ME.MasterStateId equals MS.MasterStateId into MSGroup from MS in MSGroup.DefaultIfEmpty() join PT in _Context.ADMasterPaymentTypes on ME.MasterPaymentTypeId equals PT.MasterPaymentTypeId into PTGroup from PT in PTGroup.DefaultIfEmpty() join BA in _Context.ADMasterBankAccountTypes on ME.MasterBankAccountTypeId equals BA.MasterBankAccountTypeId into BAGroup from BA in BAGroup.DefaultIfEmpty() join MB in _Context.ADMasterBranches on ME.MasterBranchId equals MB.MasterBranchId into MBGroup from MB in MBGroup.DefaultIfEmpty() join MC in _Context.ADMasterCompanies on MB.MasterCompanyId equals MC.MasterCompanyId into MCGroup from MC in MCGroup.DefaultIfEmpty() where ME.MasterEmployeeId == MasterEmployeeId select new { ME.MasterEmployeeId, ME.EmployeeCode, ME.MasterSalutationId, SA.SalutationTitle, ME.EmployeeName, ME.DateOfBirth, ME.DateOfJoining, ME.Gender, MG.GenderTitle, ME.PANNo, ME.AadhaarNo, ME.MasterDesignationId, MD.DesignationTitle, ME.MasterDepartmentId, DA.DepartmentTitle, ME.ReportingHeadId, ReportingHeadTitle = ME2.EmployeeName, ReportingHeadDesignationTitle = MD2.DesignationTitle, ME.MasterEmployeeTypeId, ET.EmployeeTypeTitle, ME.MasterTimeZoneId, TZ.TimeZoneTitle, ME.MasterEmployeeStatusId, ES.EmployeeStatusTitle, ME.DateOfLeavingOrganisation, ME.Address1, ME.Address2, ME.MasterCountryId, CC.CountryTitle, ME.MasterStateId, MS.StateTitle, ME.City, ME.PinCode, ME.PhoneNumber, ME.MobileNumber, ME.Email, ME.MasterPaymentTypeId, PT.MasterPaymentTitle, ME.PaypalID, ME.PaypalLink, ME.IsPaypalAccountVerified, ME.MasterBankAccountTypeId, BA.MasterBankAccountTypeTitle, ME.BankName, ME.BankAccountNumber, ME.IFCSCode, ME.ShiftCode_RoutingNo_IBAN, ME.BankBranch, ME.BankCity, ME.BankAddress, ME.UploadBankDetail, ME.IsBankAccountVerified, ME.MasterBranchId, MB.BranchTitle, MB.MasterCompanyId, MC.CompanyTitle, MC.CompanyLogo, ME.IsActive }); var _Item = _data.Where(a => a.MasterEmployeeId == MasterEmployeeId).FirstOrDefault();; MasterEmployeeResult _MasterEmployeeResult = new MasterEmployeeResult(); if (_data != null) { _MasterEmployeeResult.MasterEmployeeId = _Item.MasterEmployeeId; _MasterEmployeeResult.EmployeeCode = _Item.EmployeeCode; _MasterEmployeeResult.MasterSalutationId = _Item.MasterSalutationId; _MasterEmployeeResult.SalutationTitle = _Item.SalutationTitle; _MasterEmployeeResult.EmployeeName = _Item.EmployeeName; _MasterEmployeeResult.DateOfJoining = _Item.DateOfJoining; _MasterEmployeeResult.DateOfBirth = _Item.DateOfBirth; _MasterEmployeeResult.Gender = _Item.Gender; _MasterEmployeeResult.GenderTitle = _Item.GenderTitle; _MasterEmployeeResult.PANNo = _Item.PANNo; _MasterEmployeeResult.AadhaarNo = _Item.AadhaarNo; _MasterEmployeeResult.MasterDesignationId = _Item.MasterDesignationId; _MasterEmployeeResult.DesignationTitle = _Item.DesignationTitle; _MasterEmployeeResult.MasterDepartmentId = _Item.MasterDepartmentId; _MasterEmployeeResult.DepartmentTitle = _Item.DepartmentTitle; _MasterEmployeeResult.ReportingHeadId = _Item.ReportingHeadId; _MasterEmployeeResult.ReportingHeadTitle = _Item.ReportingHeadTitle; _MasterEmployeeResult.ReportingHeadDesignationTitle = _Item.ReportingHeadDesignationTitle; _MasterEmployeeResult.MasterEmployeeTypeId = _Item.MasterEmployeeTypeId; _MasterEmployeeResult.EmployeeTypeTitle = _Item.EmployeeTypeTitle; _MasterEmployeeResult.MasterTimeZoneId = _Item.MasterTimeZoneId; _MasterEmployeeResult.TimeZoneTitle = _Item.TimeZoneTitle; _MasterEmployeeResult.MasterEmployeeStatusId = _Item.MasterEmployeeStatusId; _MasterEmployeeResult.EmployeeStatusTitle = _Item.EmployeeStatusTitle; _MasterEmployeeResult.DateOfLeavingOrganisation = _Item.DateOfLeavingOrganisation; _MasterEmployeeResult.Address1 = _Item.Address1; _MasterEmployeeResult.Address2 = _Item.Address2; _MasterEmployeeResult.MasterCountryId = _Item.MasterCountryId; _MasterEmployeeResult.CountryTitle = _Item.CountryTitle; _MasterEmployeeResult.MasterStateId = _Item.MasterStateId; _MasterEmployeeResult.StateTitle = _Item.StateTitle; _MasterEmployeeResult.City = _Item.City; _MasterEmployeeResult.PinCode = _Item.PinCode; _MasterEmployeeResult.MobileNumber = _Item.MobileNumber; _MasterEmployeeResult.PhoneNumber = _Item.PhoneNumber; _MasterEmployeeResult.Email = _Item.Email; _MasterEmployeeResult.MasterPaymentTypeId = _Item.MasterPaymentTypeId; _MasterEmployeeResult.PaymentTypeTitle = _Item.MasterPaymentTitle; _MasterEmployeeResult.PaypalID = _Item.PaypalID; _MasterEmployeeResult.PaypalLink = _Item.PaypalLink; _MasterEmployeeResult.IsPaypalAccountVerified = _Item.IsPaypalAccountVerified; _MasterEmployeeResult.MasterBankAccountTypeId = _Item.MasterBankAccountTypeId; _MasterEmployeeResult.BankName = _Item.BankName; _MasterEmployeeResult.BankAccountNumber = _Item.BankAccountNumber; _MasterEmployeeResult.IFCSCode = _Item.IFCSCode; _MasterEmployeeResult.ShiftCode_RoutingNo_IBAN = _Item.ShiftCode_RoutingNo_IBAN; _MasterEmployeeResult.BankBranch = _Item.BankBranch; _MasterEmployeeResult.BankCity = _Item.BankCity; _MasterEmployeeResult.BankAddress = _Item.BankAddress; _MasterEmployeeResult.UploadBankDetail = _Item.UploadBankDetail; _MasterEmployeeResult.IsBankAccountVerified = _Item.IsBankAccountVerified; _MasterEmployeeResult.MasterBranchId = _Item.MasterBranchId; _MasterEmployeeResult.BranchTitle = _Item.BranchTitle; _MasterEmployeeResult.MasterCompanyId = _Item.MasterCompanyId; _MasterEmployeeResult.CompanyTitle = _Item.CompanyTitle; _MasterEmployeeResult.CompanyLogo = _Item.CompanyLogo; _MasterEmployeeResult.IsActive = _Item.IsActive; _MasterEmployeeResult.ActiveColor = "green"; _MasterEmployeeResult.ActiveIcon = "glyphicon glyphicon-ok"; if (_MasterEmployeeResult.IsActive == false) { _MasterEmployeeResult.ActiveColor = "red"; _MasterEmployeeResult.ActiveIcon = "glyphicon glyphicon-remove"; } } return(_MasterEmployeeResult); } catch (Exception ex) { throw new Exception(ex.Message); } }
public IEnumerable <MasterCompanyResult> GetAllADMasterCompany() { try { var _data = (from MC in _Context.ADMasterCompanies join MD in _Context.ADMasterDesignations on MC.MasterDesignationId equals MD.MasterDesignationId into MDGroup from MD in MDGroup.DefaultIfEmpty() join CT in _Context.ADMasterCompanyTypes on MC.MasterCompanyTypeId equals CT.MasterCompanyTypeId into CTGroup from CT in CTGroup.DefaultIfEmpty() join TZ in _Context.ADMasterTimeZones on MC.MasterTimeZoneId equals TZ.MasterTimeZoneId into TZGroup from TZ in TZGroup.DefaultIfEmpty() join CR in _Context.ADMasterCurrencies on MC.MasterCurrencyId equals CR.MasterCurrencyId into CRGroup from CR in CRGroup.DefaultIfEmpty() join AT in _Context.ADMasterAddressTypes on MC.MasterAddressTypeId equals AT.MasterAddressTypeId into ATGroup from AT in ATGroup.DefaultIfEmpty() join CC in _Context.ADMasterCountries on MC.MasterCountryId equals CC.MasterCountryId into CCGroup from CC in CCGroup.DefaultIfEmpty() join MS in _Context.ADMasterStates on MC.MasterStateId equals MS.MasterStateId into MSGroup from MS in MSGroup.DefaultIfEmpty() select new { MC.MasterCompanyId, MC.CompanyTitle, MC.ContactPerson, MC.MasterDesignationId, MC.DateofRegistration, MC.MasterCompanyTypeId, MC.RegistrationNumber, MC.PANNumber, MC.GSTNumber, MC.TANNumber, MC.SEZRegistrationNumber, MC.SAC_Code, MC.LUT_AppliactionReference, MC.CompanyLogo, MC.ReportLogo, MC.MasterCurrencyId, MC.MasterTimeZoneId, MC.MasterAddressTypeId, MC.Address1, MC.Address2, MC.MasterCountryId, MC.MasterStateId, MC.City, MC.PinCode, MC.PhoneNumber, MC.MobileNumber, MC.Fax, MC.Email, MC.URL, MC.IsActive, MD.DesignationTitle, CT.CompanyTypeTitle, TZ.TimeZoneTitle, CR.CurrencyTitle, AT.AddressTypeTitle, CC.CountryTitle, MS.StateTitle }); List <MasterCompanyResult> objMasterCompanyResultList = new List <MasterCompanyResult>(); foreach (var _Item in _data.ToList()) { var _MasterCompanyResult = new MasterCompanyResult(); _MasterCompanyResult.MasterCompanyId = _Item.MasterCompanyId; _MasterCompanyResult.CompanyTitle = _Item.CompanyTitle; _MasterCompanyResult.ContactPerson = _Item.ContactPerson; _MasterCompanyResult.MasterDesignationId = _Item.MasterDesignationId; _MasterCompanyResult.DesignationTitle = _Item.DesignationTitle; _MasterCompanyResult.DateofRegistration = _Item.DateofRegistration; _MasterCompanyResult.MasterCompanyTypeId = _Item.MasterCompanyTypeId; _MasterCompanyResult.CompanyTypeTitle = _Item.CompanyTypeTitle; _MasterCompanyResult.RegistrationNumber = _Item.RegistrationNumber; _MasterCompanyResult.PANNumber = _Item.PANNumber; _MasterCompanyResult.GSTNumber = _Item.GSTNumber; _MasterCompanyResult.TANNumber = _Item.TANNumber; _MasterCompanyResult.SEZRegistrationNumber = _Item.SEZRegistrationNumber; _MasterCompanyResult.SAC_Code = _Item.SAC_Code; _MasterCompanyResult.LUT_AppliactionReference = _Item.LUT_AppliactionReference; _MasterCompanyResult.CompanyLogo = _Item.CompanyLogo; _MasterCompanyResult.ReportLogo = _Item.ReportLogo; _MasterCompanyResult.MasterCurrencyId = _Item.MasterCurrencyId; _MasterCompanyResult.CurrencyTitle = _Item.CurrencyTitle; _MasterCompanyResult.MasterTimeZoneId = _Item.MasterTimeZoneId; _MasterCompanyResult.TimeZoneTitle = _Item.TimeZoneTitle; _MasterCompanyResult.MasterAddressTypeId = _Item.MasterAddressTypeId; _MasterCompanyResult.AddressTypeTitle = _Item.AddressTypeTitle; _MasterCompanyResult.Address1 = _Item.Address1; _MasterCompanyResult.Address2 = _Item.Address2; _MasterCompanyResult.MasterCountryId = _Item.MasterCountryId; _MasterCompanyResult.CountryTitle = _Item.CountryTitle; _MasterCompanyResult.MasterStateId = _Item.MasterStateId; _MasterCompanyResult.StateTitle = _Item.StateTitle; _MasterCompanyResult.City = _Item.City; _MasterCompanyResult.PinCode = _Item.PinCode; _MasterCompanyResult.MobileNumber = _Item.MobileNumber; _MasterCompanyResult.PhoneNumber = _Item.PhoneNumber; _MasterCompanyResult.Fax = _Item.Fax; _MasterCompanyResult.Email = _Item.Email; _MasterCompanyResult.URL = _Item.URL; _MasterCompanyResult.IsActive = _Item.IsActive; _MasterCompanyResult.ActiveColor = "green"; _MasterCompanyResult.ActiveIcon = "glyphicon glyphicon-ok"; if (_MasterCompanyResult.IsActive == false) { _MasterCompanyResult.ActiveColor = "red"; _MasterCompanyResult.ActiveIcon = "glyphicon glyphicon-remove"; } objMasterCompanyResultList.Add(_MasterCompanyResult); } return(objMasterCompanyResultList); } catch (Exception ex) { throw new Exception(ex.Message); } }
public MasterVendorResult GetADMasterVendorByID(long MasterVendorId) { try { var _data = (from MC in _Context.ADMasterVendors join MD in _Context.ADMasterDesignations on MC.MasterDesignationId equals MD.MasterDesignationId into MDGroup from MD in MDGroup.DefaultIfEmpty() join CT in _Context.ADMasterCompanyTypes on MC.MasterCompanyTypeId equals CT.MasterCompanyTypeId into CTGroup from CT in CTGroup.DefaultIfEmpty() join TZ in _Context.ADMasterTimeZones on MC.MasterTimeZoneId equals TZ.MasterTimeZoneId into TZGroup from TZ in TZGroup.DefaultIfEmpty() join CR in _Context.ADMasterCurrencies on MC.MasterCurrencyId equals CR.MasterCurrencyId into CRGroup from CR in CRGroup.DefaultIfEmpty() join AT in _Context.ADMasterAddressTypes on MC.MasterAddressTypeId equals AT.MasterAddressTypeId into ATGroup from AT in ATGroup.DefaultIfEmpty() join CC in _Context.ADMasterCountries on MC.MasterCountryId equals CC.MasterCountryId into CCGroup from CC in CCGroup.DefaultIfEmpty() join MS in _Context.ADMasterStates on MC.MasterStateId equals MS.MasterStateId into MSGroup from MS in MSGroup.DefaultIfEmpty() where MC.MasterVendorId == MasterVendorId select new { MC.MasterVendorId, MC.VendorTitle, MC.ContactPerson, MC.MasterDesignationId, MC.DateofRegistration, MC.MasterCompanyTypeId, MC.RegistrationNumber, MC.PANNumber, MC.GSTNumber, MC.TANNumber, MC.SEZRegistrationNumber, MC.SAC_Code, MC.LUT_AppliactionReference, MC.CompanyLogo, MC.ReportLogo, MC.MasterCurrencyId, MC.MasterTimeZoneId, MC.MasterAddressTypeId, MC.Address1, MC.Address2, MC.MasterCountryId, MC.MasterStateId, MC.City, MC.PinCode, MC.PhoneNumber, MC.MobileNumber, MC.Fax, MC.Email, MC.URL, MC.IsActive, MD.DesignationTitle, CT.CompanyTypeTitle, TZ.TimeZoneTitle, CR.CurrencyTitle, AT.AddressTypeTitle, CC.CountryTitle, MS.StateTitle }); var _Item = _data.Where(a => a.MasterVendorId == MasterVendorId).FirstOrDefault(); MasterVendorResult _MasterVendorResult = new MasterVendorResult(); if (_data != null) { _MasterVendorResult.MasterVendorId = _Item.MasterVendorId; _MasterVendorResult.VendorTitle = _Item.VendorTitle; _MasterVendorResult.ContactPerson = _Item.ContactPerson; _MasterVendorResult.MasterDesignationId = _Item.MasterDesignationId; _MasterVendorResult.DesignationTitle = _Item.DesignationTitle; _MasterVendorResult.DateofRegistration = _Item.DateofRegistration; _MasterVendorResult.MasterCompanyTypeId = _Item.MasterCompanyTypeId; _MasterVendorResult.CompanyTypeTitle = _Item.CompanyTypeTitle; _MasterVendorResult.RegistrationNumber = _Item.RegistrationNumber; _MasterVendorResult.PANNumber = _Item.PANNumber; _MasterVendorResult.GSTNumber = _Item.GSTNumber; _MasterVendorResult.TANNumber = _Item.TANNumber; _MasterVendorResult.SEZRegistrationNumber = _Item.SEZRegistrationNumber; _MasterVendorResult.SAC_Code = _Item.SAC_Code; _MasterVendorResult.LUT_AppliactionReference = _Item.LUT_AppliactionReference; _MasterVendorResult.CompanyLogo = _Item.CompanyLogo; _MasterVendorResult.ReportLogo = _Item.ReportLogo; _MasterVendorResult.MasterCurrencyId = _Item.MasterCurrencyId; _MasterVendorResult.CurrencyTitle = _Item.CurrencyTitle; _MasterVendorResult.MasterTimeZoneId = _Item.MasterTimeZoneId; _MasterVendorResult.TimeZoneTitle = _Item.TimeZoneTitle; _MasterVendorResult.MasterAddressTypeId = _Item.MasterAddressTypeId; _MasterVendorResult.AddressTypeTitle = _Item.AddressTypeTitle; _MasterVendorResult.Address1 = _Item.Address1; _MasterVendorResult.Address2 = _Item.Address2; _MasterVendorResult.MasterCountryId = _Item.MasterCountryId; _MasterVendorResult.CountryTitle = _Item.CountryTitle; _MasterVendorResult.MasterStateId = _Item.MasterStateId; _MasterVendorResult.StateTitle = _Item.StateTitle; _MasterVendorResult.City = _Item.City; _MasterVendorResult.PinCode = _Item.PinCode; _MasterVendorResult.MobileNumber = _Item.MobileNumber; _MasterVendorResult.PhoneNumber = _Item.PhoneNumber; _MasterVendorResult.Fax = _Item.Fax; _MasterVendorResult.Email = _Item.Email; _MasterVendorResult.URL = _Item.URL; _MasterVendorResult.IsActive = _Item.IsActive; _MasterVendorResult.ActiveColor = "green"; _MasterVendorResult.ActiveIcon = "glyphicon glyphicon-ok"; if (_MasterVendorResult.IsActive == false) { _MasterVendorResult.ActiveColor = "red"; _MasterVendorResult.ActiveIcon = "glyphicon glyphicon-remove"; } } return(_MasterVendorResult); } catch (Exception ex) { throw new Exception(ex.Message); } }