public static List <SelectListItem> GetDropDownList()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.BusinessTypes
                         where p.IsActive
                         select new SelectListItem
             {
                 Text = p.TypeName,
                 Value = p.ID.ToString()
             }).ToList();
             data.Insert(0, new SelectListItem()
             {
                 Text  = "Select Business Type",
                 Value = ""
             });
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static List <BusinessTypeViewModel> GetBusinessTypeViews()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.BusinessTypes
                         select new BusinessTypeViewModel
             {
                 ID = p.ID,
                 TypeCode = p.TypeCode,
                 TypeName = p.TypeName
             }).ToList();
             //var retValue = data.Select(r => new CategoryViewViewModel()
             //{
             //    Id = r.ID,
             //    Name = r.Name,
             //    ParentName = r.Parent == null ? "-" : r.Parent.Name
             //}).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #3
0
 public static bool SaveState(StateCreateViewModel model)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = new State()
             {
                 Name        = model.Name,
                 StateCode   = model.StateCode,
                 CountryID   = model.CountryID,
                 IsActive    = true,
                 CreatedBy   = model.CreatedBy,
                 CreatedDate = DateTime.UtcNow
             };
             context.States.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #4
0
 public static List <StateTableViewModel> GetStateViews()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.States
                         select new StateTableViewModel
             {
                 ID = p.ID,
                 Name = p.Name,
                 StateCode = p.StateCode,
                 CountryID = p.CountryID
             }).ToList();
             //var retValue = data.Select(r => new CategoryViewViewModel()
             //{
             //    Id = r.ID,
             //    Name = r.Name,
             //    ParentName = r.Parent == null ? "-" : r.Parent.Name
             //}).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #5
0
 public static List <SelectListItem> GetStateListByCountryID(int CountryID)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = context.States
                        .Where(r => r.CountryID.Equals(CountryID))
                        .Select(p => new SelectListItem
             {
                 Text  = p.Name,
                 Value = p.ID.ToString()
             }).ToList();
             data.Insert(0, new SelectListItem()
             {
                 Text  = "Select State",
                 Value = ""
             });
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #6
0
 public static List <BusinessTableViewModel> GetBusinessList(int categoryId)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.Businesses
                         where p.CategoryID.Value.Equals(categoryId)
                         select new BusinessTableViewModel
             {
                 ID = p.ID,
                 BusinessName = p.BusinessName,
                 BusinessType = p.BusinessType,
                 CategoryID = p.CategoryID,
                 Country = p.RegisteredCountry,
                 RegistrationNo = p.RegistrationNumber,
                 YearOfIncorporation = p.YearOfIncorporation
             }).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #7
0
 public static bool SaveCountry(CountryCreateViewModel model)
 {
     try
     {
         var data = new Country()
         {
             Name         = model.Name,
             CurrencyName = model.CurrencyName,
             CurrencyCode = model.CurrencyCode,
             Code         = model.Code,
             IsActive     = model.IsActive,
             CreatedBy    = model.CreatedBy,
             CreatedDate  = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.Countries.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
 public static List <SelectListItem> GetParentDropDownList()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.Categories
                         where p.IsActive && p.ParentID == null
                         select new SelectListItem
             {
                 Text = p.Name,
                 Value = p.ID.ToString()
             }).ToList();
             data.Insert(0, new SelectListItem()
             {
                 Text  = "Select Category",
                 Value = ""
             });
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public static string LastRecordSaved()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = context.BusinessTypes.AsEnumerable().LastOrDefault();
             if (data == null)
             {
                 return("none");
             }
             else
             {
                 return(data.TypeName);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #10
0
 public static string LastRecordSaved()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = context.States.AsEnumerable().LastOrDefault();
             if (data == null)
             {
                 return("none");
             }
             else
             {
                 return(data.Name + " (Country : " + data.Country.Name + ")");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #11
0
 public static long SaveBusiness(BusinessCreateViewModel model)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = new Business()
             {
                 BusinessName         = model.BusinessName,
                 BusinessType         = model.BusinessType,
                 CategoryID           = model.CategoryID,
                 CategoryName         = model.CategoryName,
                 CreatedBy            = model.CreatedBy,
                 CreatedDate          = DateTime.UtcNow,
                 DataSourceName       = model.DataSourceName,
                 EmailID              = model.EmailID,
                 IncorporationDate    = model.IncorporationDate,
                 YearOfIncorporation  = model.YearOfIncorporation,
                 NoOfEmployees        = model.NoOfEmployees,
                 RegisteredCountry    = model.RegisteredCountry,
                 RegisteredCountryID  = model.RegisteredCountryID,
                 RegisteredProvince   = model.RegisteredProvince,
                 RegisteredProvinceID = model.RegisteredProvinceID,
                 RegistrationNumber   = model.RegistrationNumber,
                 Status  = model.Status,
                 Tags    = model.Tags,
                 Website = model.Website
             };
             context.Businesses.Add(data);
             context.SaveChanges();
             return(data.ID);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #12
0
 public static List <CityTableViewModel> GetCityByStateID(long stateID)
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.Cities
                         where p.StateID.Value.Equals(stateID)
                         select new CityTableViewModel
             {
                 ID = p.ID,
                 Name = p.Name,
                 CityCode = p.CityCode,
                 StateID = p.StateID.Value
             }).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #13
0
 public static bool SaveBusinessType(BusinessTypeCreateViewModel model)
 {
     try
     {
         var data = new BusinessType()
         {
             TypeName    = model.TypeName,
             TypeCode    = model.TypeCode,
             IsActive    = true,
             CreatedBy   = model.CreatedBy,
             CreatedDate = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.BusinessTypes.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #14
0
 public static List <CountryViewModel> GetCountriesViews()
 {
     try
     {
         using (var context = new IdeaValidationContext())
         {
             var data = (from p in context.Countries
                         orderby p.Name
                         select new CountryViewModel
             {
                 ID = p.ID,
                 Code = p.Code,
                 CurrencyCode = p.CurrencyCode,
                 CurrencyName = p.CurrencyName,
                 Name = p.Name
             }).ToList();
             return(data);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #15
0
 public static bool SaveCategory(CategoryCreateViewModel model)
 {
     try
     {
         var data = new Category()
         {
             Name        = model.Name,
             ParentID    = model.ParentID,
             IsActive    = true,
             CreatedBy   = model.CreatedBy,
             CreatedDate = DateTime.UtcNow
         };
         using (var context = new IdeaValidationContext())
         {
             context.Categories.Add(data);
             context.SaveChanges();
         }
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }