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);
            }
        }
Exemplo n.º 2
0
        public MasterBranchResult GetADMasterBranchByID(long MasterBranchId)
        {
            try
            {
                var _data = (from MB in _Context.ADMasterBranches
                             join MD in _Context.ADMasterDesignations on MB.MasterDesignationId equals MD.MasterDesignationId into MDGroup
                             from MD in MDGroup.DefaultIfEmpty()
                             join AT in _Context.ADMasterAddressTypes on MB.MasterAddressTypeId equals AT.MasterAddressTypeId into ATGroup
                             from AT in ATGroup.DefaultIfEmpty()
                             join CC in _Context.ADMasterCountries on MB.MasterCountryId equals CC.MasterCountryId into CCGroup
                             from CC in CCGroup.DefaultIfEmpty()
                             join MS in _Context.ADMasterStates on MB.MasterStateId equals MS.MasterStateId into MSGroup
                             from MS in MSGroup.DefaultIfEmpty()
                             join MC in _Context.ADMasterCompanies on MB.MasterCompanyId equals MC.MasterCompanyId
                             where MB.MasterBranchId == MasterBranchId
                             select new
                {
                    MB.MasterBranchId,
                    MB.BranchCode,
                    MB.BranchTitle,
                    MB.ContactPerson,
                    MB.MasterDesignationId,
                    MB.DateofRegistration,
                    MB.MasterAddressTypeId,
                    MB.Address1,
                    MB.Address2,
                    MB.MasterCountryId,
                    MB.MasterStateId,
                    MB.City,
                    MB.PinCode,
                    MB.PhoneNumber,
                    MB.MobileNumber,
                    MB.Fax,
                    MB.Email,
                    MB.URL,
                    MB.MasterCompanyId,
                    MB.IsActive,
                    MD.DesignationTitle,
                    AT.AddressTypeTitle,
                    CC.CountryTitle,
                    MS.StateTitle,
                    MC.CompanyTitle
                });


                var _Item = _data.Where(a => a.MasterBranchId == MasterBranchId).FirstOrDefault();

                MasterBranchResult _MasterBranchResult = new MasterBranchResult();
                if (_data != null)
                {
                    _MasterBranchResult.MasterBranchId      = _Item.MasterBranchId;
                    _MasterBranchResult.BranchCode          = _Item.BranchCode;
                    _MasterBranchResult.BranchTitle         = _Item.BranchTitle;
                    _MasterBranchResult.ContactPerson       = _Item.ContactPerson;
                    _MasterBranchResult.MasterDesignationId = _Item.MasterDesignationId;
                    _MasterBranchResult.DesignationTitle    = _Item.DesignationTitle;
                    _MasterBranchResult.DateofRegistration  = _Item.DateofRegistration;
                    _MasterBranchResult.MasterAddressTypeId = _Item.MasterAddressTypeId;
                    _MasterBranchResult.AddressTypeTitle    = _Item.AddressTypeTitle;
                    _MasterBranchResult.Address1            = _Item.Address1;
                    _MasterBranchResult.Address2            = _Item.Address2;
                    _MasterBranchResult.MasterCountryId     = _Item.MasterCountryId;
                    _MasterBranchResult.CountryTitle        = _Item.CountryTitle;
                    _MasterBranchResult.MasterStateId       = _Item.MasterStateId;
                    _MasterBranchResult.StateTitle          = _Item.StateTitle;
                    _MasterBranchResult.City            = _Item.City;
                    _MasterBranchResult.PinCode         = _Item.PinCode;
                    _MasterBranchResult.MobileNumber    = _Item.MobileNumber;
                    _MasterBranchResult.PhoneNumber     = _Item.PhoneNumber;
                    _MasterBranchResult.Fax             = _Item.Fax;
                    _MasterBranchResult.Email           = _Item.Email;
                    _MasterBranchResult.URL             = _Item.URL;
                    _MasterBranchResult.MasterCompanyId = _Item.MasterCompanyId;
                    _MasterBranchResult.CompanyTitle    = _Item.CompanyTitle;
                    _MasterBranchResult.IsActive        = _Item.IsActive;
                    _MasterBranchResult.ActiveColor     = "green";
                    _MasterBranchResult.ActiveIcon      = "glyphicon glyphicon-ok";

                    if (_MasterBranchResult.IsActive == false)
                    {
                        _MasterBranchResult.ActiveColor = "red";
                        _MasterBranchResult.ActiveIcon  = "glyphicon glyphicon-remove";
                    }
                }

                return(_MasterBranchResult);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 3
0
        public IEnumerable <MasterBranchResult> GetAllADMasterBranch()
        {
            try
            {
                var _data = (from MB in _Context.ADMasterBranches
                             join MD in _Context.ADMasterDesignations on MB.MasterDesignationId equals MD.MasterDesignationId into MDGroup
                             from MD in MDGroup.DefaultIfEmpty()
                             join AT in _Context.ADMasterAddressTypes on MB.MasterAddressTypeId equals AT.MasterAddressTypeId into ATGroup
                             from AT in ATGroup.DefaultIfEmpty()
                             join CC in _Context.ADMasterCountries on MB.MasterCountryId equals CC.MasterCountryId into CCGroup
                             from CC in CCGroup.DefaultIfEmpty()
                             join MS in _Context.ADMasterStates on MB.MasterStateId equals MS.MasterStateId into MSGroup
                             from MS in MSGroup.DefaultIfEmpty()
                             join MC in _Context.ADMasterCompanies on MB.MasterCompanyId equals MC.MasterCompanyId
                             select new
                {
                    MB.MasterBranchId,
                    MB.BranchCode,
                    MB.BranchTitle,
                    MB.ContactPerson,
                    MB.MasterDesignationId,
                    MB.DateofRegistration,
                    MB.MasterAddressTypeId,
                    MB.Address1,
                    MB.Address2,
                    MB.MasterCountryId,
                    MB.MasterStateId,
                    MB.City,
                    MB.PinCode,
                    MB.PhoneNumber,
                    MB.MobileNumber,
                    MB.Fax,
                    MB.Email,
                    MB.URL,
                    MB.MasterCompanyId,
                    MB.IsActive,
                    MD.DesignationTitle,
                    AT.AddressTypeTitle,
                    CC.CountryTitle,
                    MS.StateTitle,
                    MC.CompanyTitle
                });

                List <MasterBranchResult> objMasterBranchResultList = new List <MasterBranchResult>();

                foreach (var _Item in _data.ToList())
                {
                    var _MasterBranchResult = new MasterBranchResult();

                    _MasterBranchResult.MasterBranchId      = _Item.MasterBranchId;
                    _MasterBranchResult.BranchCode          = _Item.BranchCode;
                    _MasterBranchResult.BranchTitle         = _Item.BranchTitle;
                    _MasterBranchResult.ContactPerson       = _Item.ContactPerson;
                    _MasterBranchResult.MasterDesignationId = _Item.MasterDesignationId;
                    _MasterBranchResult.DesignationTitle    = _Item.DesignationTitle;
                    _MasterBranchResult.DateofRegistration  = _Item.DateofRegistration;
                    _MasterBranchResult.MasterAddressTypeId = _Item.MasterAddressTypeId;
                    _MasterBranchResult.AddressTypeTitle    = _Item.AddressTypeTitle;
                    _MasterBranchResult.Address1            = _Item.Address1;
                    _MasterBranchResult.Address2            = _Item.Address2;
                    _MasterBranchResult.MasterCountryId     = _Item.MasterCountryId;
                    _MasterBranchResult.CountryTitle        = _Item.CountryTitle;
                    _MasterBranchResult.MasterStateId       = _Item.MasterStateId;
                    _MasterBranchResult.StateTitle          = _Item.StateTitle;
                    _MasterBranchResult.City            = _Item.City;
                    _MasterBranchResult.PinCode         = _Item.PinCode;
                    _MasterBranchResult.MobileNumber    = _Item.MobileNumber;
                    _MasterBranchResult.PhoneNumber     = _Item.PhoneNumber;
                    _MasterBranchResult.Fax             = _Item.Fax;
                    _MasterBranchResult.Email           = _Item.Email;
                    _MasterBranchResult.URL             = _Item.URL;
                    _MasterBranchResult.MasterCompanyId = _Item.MasterCompanyId;
                    _MasterBranchResult.CompanyTitle    = _Item.CompanyTitle;
                    _MasterBranchResult.IsActive        = _Item.IsActive;
                    _MasterBranchResult.ActiveColor     = "green";
                    _MasterBranchResult.ActiveIcon      = "glyphicon glyphicon-ok";

                    if (_MasterBranchResult.IsActive == false)
                    {
                        _MasterBranchResult.ActiveColor = "red";
                        _MasterBranchResult.ActiveIcon  = "glyphicon glyphicon-remove";
                    }

                    objMasterBranchResultList.Add(_MasterBranchResult);
                }

                return(objMasterBranchResultList);
            }
            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);
            }
        }