public ContactPersonService(IUnitOfWork unitOfWork, IUserResolverService userResolverService) { user = userResolverService; UnitOfWork = unitOfWork; UnitOfWork.ActionBy(user.UserID); Repo = (ContactPersonRepository)UnitOfWork.GetRepository <MS_PIC>(hasCustomRepository: true); }
public DataManager() { cont = new ModelContainer(); branchRepository = new BranchRepository(cont); categoryRepository = new CategoryRepository(cont); checkDishRepository = new CheckDishRepository(cont); checkMerchandiseRepository = new CheckMerchandiseRepository(cont); clientRepository = new ClientRepository(cont); companyOwnerRepository = new CompanyOwnerRepository(cont); companyRepository = new CompanyRepository(cont); contactPersonRepository = new ContactPersonRepository(cont); dishRepository = new DishRepository(cont); documentRepository = new DocumentRepository(cont); ejectionRepository = new EjectionRepository(cont); employeeRepository = new EmployeeRepository(cont); encashmentRepository = new EncashmentRepository(cont); landlordRepository = new LandlordRepository(cont); orderRepository = new OrderRepository(cont); personRepository = new PersonRepository(cont); positionRepository = new PositionRepository(cont); prepackRepository = new PrepackRepository(cont); productRepository = new ProductRepository(cont); purchaseRepository = new PurchaseRepository(cont); recipeDishIngrRepository = new RecipeDishIngrRepository(cont); recipeDishPrepRepository = new RecipeDishPrepRepository(cont); recipePrepIngrRepository = new RecipePrepIngrRepository(cont); recipePrepPrepRepository = new RecipePrepPrepRepository(cont); roomRepository = new RoomRepository(cont); shiftRepository = new ShiftRepository(cont); tableRepository = new TableRepository(cont); warehouseRepository = new WarehouseRepository(cont); }
public static void GenerateFilteredPageReport(string host, string path, string reportName, Func <PageEntity, string, bool> rowFilter) { if (!(path.StartsWith("/sv") || path.StartsWith("/en"))) { Console.WriteLine("URL '" + path + "' not valid. Must start with /sv or /en"); return; } using (SPSite oSite = new SPSite(host)) { using (SPWeb oWeb = oSite.OpenWeb(path)) { reportName = reportName ?? "PageReport"; rowFilter = rowFilter ?? ((p, c) => true); string langCode = path.Substring(1, 2); string langRootUrl = string.Format("/{0}", langCode); Uri siteUri = new Uri(oSite.Url); DateTime datestamp = DateTime.Now; string fileName = string.Format("{0}-{1}-{2}-{3:yyyy-MM-dd-HH-mm-ss}.txt", reportName, siteUri.Host, langCode, datestamp); ContactPersonRepository contactRepository = new ContactPersonRepository(oWeb) { ServerRelativeWebUrl = langRootUrl }; using (CsvFileWriter writer = new CsvFileWriter(fileName, ';')) { CsvRow headerRow = new CsvRow(); headerRow.Add("Title"); headerRow.Add("URL"); headerRow.Add("Page responsible"); headerRow.Add("Created"); headerRow.Add("Modified"); writer.WriteRow(headerRow); using (SPWeb langRootWeb = oSite.OpenWeb(path)) { List <SPWeb> websToProcess = new List <SPWeb>(); websToProcess.Add(langRootWeb); for (int i = 0; i < websToProcess.Count(); i++) { Console.WriteLine(string.Format("Processing web {0}/{1}: {2}", i + 1, websToProcess.Count(), websToProcess[i].Name)); var moreWebs = GetPageReport(rowFilter, siteUri, contactRepository, writer, websToProcess[i]); foreach (SPWeb w in moreWebs) { websToProcess.Add(w); } } } writer.Flush(); } } } }
public UnitOfWork() { if (_context == null) { _context = new FestiSpecEntities(); } Inspectors = new InspectorRepository(_context); NawEmployee = new NAWEmployeeRepository(_context); Employee = new EmployeeRepository(_context); RoleEmployee = new RoleEmployeeRepository(_context); NAWInspectors = new NAWInspector_Repository(_context); Questionnaires = new QuestionnaireRepository(_context); Inspections = new InspectionRepository(_context); InspectionLocations = new LocationRepository(_context); Customers = new CustomerRepository(_context); ContactPersons = new ContactPersonRepository(_context); Certificates = new CertificatesRepository(_context); NAWCustomers = new NAWCustomerRepository(_context); }
public RegisterResponseModel Register(RegisterInputModel data, RoleEnum roleEnum) { UserRepository userRepo = new UserRepository(DbContext); var checkUserName = userRepo.FindByUserName(data.Username); if (checkUserName == null) { Guid id = Guid.NewGuid(); User temp = new User(); temp.ID = id; temp.PasswordHash = data.Password.ConvertToMD5(); temp.FirstName = data.FirstName; temp.LastName = data.LastName; temp.UserName = data.Username; temp.PhoneNumber = data.NoTelp; temp.CreateDate = DateTime.Now; temp.CreateByUserID = id; if (roleEnum == RoleEnum.MediaOwner || roleEnum == RoleEnum.MediaBuyer) { temp.IsActive = false; } else { temp.IsActive = true; } userRepo = new UserRepository(DbContext); var response = userRepo.Insert(temp, false); //insert ke table userRole UserRole userRole = new UserRole(); RoleRepository roleRepo = new RoleRepository(DbContext); userRole.ID = Guid.NewGuid(); userRole.UserID = temp.ID; //RoleID di ambil dari table role userRole.RoleID = roleRepo.GetRole((int)roleEnum).FirstOrDefault().ID; userRole.CreateDate = DateTime.Now; userRole.CreateByUserID = id; UserRoleRepository userRoleRepository = new UserRoleRepository(DbContext); var res2 = userRoleRepository.Insert(userRole, false); //INSERT TO COMPANY TABLE Company dataComp = new Company(); dataComp.ID = Guid.NewGuid(); dataComp.NPWP = data.NPWP; dataComp.Website = data.Website; dataComp.Alamat = data.Alamat; dataComp.CompanyName = data.NamaPerusahaan; dataComp.Email = data.EmailPerusahaan; dataComp.UserID = temp.ID; dataComp.Kategory = data.Kategori; dataComp.CreateByUserID = id; dataComp.CreateDate = DateTime.Now; CompanyRepository comRepo = new CompanyRepository(DbContext); comRepo.Insert(dataComp, false); //INSERT TO TABLE CONTACT ContactPerson temCon = new ContactPerson(); temCon.ID = Guid.NewGuid(); temCon.CompanyID = dataComp.ID; temCon.Email = data.Username; temCon.Name = data.FirstName + " " + data.LastName; temCon.UserID = temp.ID; temCon.CreateDate = DateTime.Now; temCon.CreateByUserID = id; ContactPersonRepository conRepo = new ContactPersonRepository(DbContext); conRepo.Insert(temCon, true); RegisterResponseModel result = new RegisterResponseModel(); result.Message = response.Message; result.Response = response.Result; RegisterOutputModel output = new RegisterOutputModel(); output.FirstName = temp.FirstName; output.LastName = temp.LastName; output.UserName = temp.UserName; output.UserID = temp.ID; result.data = output; result.Message = "Daftar berhasil."; result.Response = true; return(result); } else { RegisterResponseModel result = new RegisterResponseModel(); result.Message = "Email sudah terdaftar!!"; result.Response = false; return(result); } }
public EditProfileOutputModel EditProfile(EditProfileInputModel data) { DateTime?today = DateTime.Now; User user = new User(); user.FirstName = data.FirstName; user.LastName = data.LastName; user.ID = data.UserID; user.UserName = data.UserName; user.PhoneNumber = data.NoTelp; user.LastUpdateByUserID = data.UserID; user.LastUpdateDate = today; UserRepository userRepo = new UserRepository(db); userRepo.Update(user, false); Company comp = new Company(); comp.UserID = data.UserID; comp.NPWP = data.NPWP; comp.Website = data.Website; comp.Alamat = data.Alamat; comp.CompanyName = data.NamaPerusahaan; comp.Email = data.EmailPerusahaan; comp.Note = data.Catatan; comp.Kategory = data.Kategori; CompanyRepository compRepo = new CompanyRepository(db); compRepo.Update(comp, false); ContactPerson cp = new ContactPerson(); cp.Email = data.EmailPIC; cp.Name = data.FirstName + " " + data.LastName; cp.UserID = data.UserID; ContactPersonRepository cpRepo = new ContactPersonRepository(db); cpRepo.Update(cp, true); var query = (from u in db.User join c in db.Company on u.ID equals c.UserID where u.ID == data.UserID select new EditProfileOutputModel() { EmailPerusahaan = c.Email, EmailPIC = u.UserName, Alamat = c.Alamat, Catatan = c.Note, FirstName = u.FirstName, LastName = u.LastName, NamaPerusahaan = c.CompanyName, NoTelp = u.PhoneNumber, NPWP = c.NPWP, PhotoUrl = u.PhotoUrl, UserID = u.ID, UserName = u.UserName, Website = c.Website, Kategori = c.Kategory }); return(query.FirstOrDefault()); }
private static SPWebCollection GetPageReport(Func <PageEntity, string, bool> rowFilter, Uri siteUri, ContactPersonRepository contactRepository, CsvFileWriter writer, SPWeb web) { SingleWebPagesRepository pagesRepository = new SingleWebPagesRepository() { Web = web }; IEnumerable <PageEntity> pages = pagesRepository.GetItems(web.Site).Cast <PageEntity>(); int sida = 0; foreach (PageEntity page in pages.OrderBy(x => x.Title)) { try { ClearCurrentConsoleLine(); Console.Write(string.Format(" Processing page {0}/{1}: {2}", ++sida, pages.Count(), page.FileRef)); string pageRelativeUrl = page.FileRef; int indexSemicHash = pageRelativeUrl.IndexOf(";#"); if (indexSemicHash >= 0 && pageRelativeUrl.Length > 2) { pageRelativeUrl = pageRelativeUrl.Substring(indexSemicHash + 2); } pageRelativeUrl = string.Format("/{0}", pageRelativeUrl.TrimStart(urlTrimChars)); string webRelativeUrl = webRelativeUrlRegex.Replace(pageRelativeUrl, string.Empty); string contact = contactRepository.GetContactAddressForPage(pageRelativeUrl, webRelativeUrl, web.Site); if (!rowFilter(page, contact)) { continue; } Uri pageUri = new Uri(siteUri, pageRelativeUrl); CsvRow row = new CsvRow(); row.Add(page.Title); row.Add(pageUri.ToString()); row.Add(contact); row.Add(page.Created); row.Add(page.Modified); writer.WriteRow(row); } catch (Exception ex) { Console.WriteLine("Could not process page. Continuing with next page."); Console.WriteLine(getStackTraceFromError(ex)); } } Console.WriteLine("\n"); return(web.Webs); }