public ActionResult Create(string id) { ViewBag.Title = "购买详情"; int currentUserId = Convert.ToInt32(Session["CurrentUserId"].ToString()); var companySvc = new CompanyService(); ViewBag.AllCompanyList = companySvc.GetCompanyByRelUserId(currentUserId);//初始化购买订单页面 var tradeManagementEditVM = TradeManagementSvc.GetSalesOrderByStockId(Convert.ToInt32(id), currentUserId); ViewBag.PricingType = tradeManagementEditVM.PricingType; return View("Edit", tradeManagementEditVM); }
public void CompanyServiceGetListShouldReturnListOfCompanies() { // Arrange var unitOfWorkMock = new Mock<IUnitOfWork>(MockBehavior.Strict); var expectedData = this.GetSampleData().OrderBy(f => f.Name).ToArray(); unitOfWorkMock.Setup(u => u.Query<Company>(It.IsAny<string>())).Returns(expectedData.AsQueryable()); var service = new CompanyService(unitOfWorkMock.Object); // Act var actual = service.GetAll(); CollectionAssert.AreEqual(expectedData, actual); }
public ActionResult CancelAction(string stockId, string companyId, string qty) { ViewBag.Title = "购买详情"; int currentUserId = Convert.ToInt32(Session["CurrentUserId"].ToString()); var companySvc = new CompanyService(); ViewBag.AllCompanyList = companySvc.GetCompanyByRelUserId(currentUserId);//初始化购买订单页面 var tradeManagementEditVM = TradeManagementSvc.GetSalesOrderByStockId(Convert.ToInt32(stockId), currentUserId); ViewBag.PricingType = tradeManagementEditVM.PricingType; tradeManagementEditVM.CompanyId = Convert.ToInt32(companyId); tradeManagementEditVM.Quantity = Convert.ToDecimal(qty); return View("Edit", tradeManagementEditVM); }
public void InitializeTest() { Stubs.Initialize (); Stubs.CompanyRepository.Add (new Company() { Key = 1 } ); Stubs.CompanyRepository.Add (new Company() { Key = 2 } ); Stubs.CompanyRepository.Add (new Company() { Key = 3 } ); Stubs.CompanyRepository.Add (new Company() { Key = 4 } ); Stubs.UnitOfWork.Commit (); m_target = new CompanyService (); }
public Controller(CountryService countryService, CompanyService companyService, DeliveryService deliveryService, PriceService priceService, RouteService routeService, LocationService locationService, StatisticsService statisticsService, EventService eventService) { this.countryService = countryService; this.companyService = companyService; this.deliveryService = deliveryService; this.priceService = priceService; this.routeService = routeService; this.locationService = locationService; this.statisticsService = statisticsService; this.eventService = eventService; Network.Instance.MessageReceived += new Network.MessageReceivedDelegate(OnReceived); }
public void CompanyServiceGetAllShouldReturnAllForms() { // Arrange var expected = this.GetSampleData(); var unitOfWork = new Mock<IUnitOfWork>(); string[] includeNames = { "Contacts" }; unitOfWork.Setup(u => u.Query<Company>(includeNames)).Returns(expected.AsQueryable()); var service = new CompanyService(unitOfWork.Object); // Act var actual = service.GetAll(); // Assert CollectionAssert.AreEqual(expected, actual); }
public void SetUp() { company = new Company { Name = "Hp", Email = "*****@*****.**", Keywords = keywords, CreationDate = new DateTime(1980, 10, 10), ActivitySectorName = ActivitySectorEnum.Software_engeneering, Address = "36 Terry Street", CompanySize = CompanySizeEnum.small, AcceptSpontanousApplication = false }; unitOfWork = new Mock<IUnitOfWork>(); service = new CompanyService(unitOfWork.Object); }
public void CompanyServiceGetShouldRetrieveSingleCompany() { // Arrange var sampleData = this.GetSampleData(); Company expected = sampleData[1]; // Arbritary Value var unitOfWork = new Mock<IUnitOfWork>(); unitOfWork.Setup(u => u.Query<Company>()).Returns(sampleData.AsQueryable()); var service = new CompanyService(unitOfWork.Object); // Act var actual = service.Get(expected.Id); // Assert Assert.IsNotNull(actual); Assert.AreSame(expected, actual); }
public ActionResult SaveAssignLead(FormCollection form) { var b2bAssignLead = new b2bAssignLead(); svPurchase = new PurchaseService(); svCompany = new CompanyService(); int SupplierCompID = 0; try { int CompID = DataManager.ConvertToInteger(form["hidToCompID"]); var AssignLeadCode = form["hidAssignLeadCode"]; if (CompID > 0) { b2bAssignLead.ToCompID = CompID; } else { b2bAssignLead.ToCompID = null; } #region set ค่า b2bAssignLead b2bAssignLead.AssignLeadCode = AssignLeadCode; b2bAssignLead.AssignLeadName = form["hidProductName"]; b2bAssignLead.ToCompCode = form["hidToCompCode"]; b2bAssignLead.ToCompName = form["ToCompName"]; b2bAssignLead.ToAddrLine1 = form["ToAddress"]; b2bAssignLead.ToDistrictID = DataManager.ConvertToInteger(form["ToDistrictID"]); b2bAssignLead.ToContactName = form["ToContactName"]; b2bAssignLead.ToContactEmail = form["ToContactEmail"]; b2bAssignLead.ToContactTel = form["ToContactTel"]; //b2bAssignLead.IsSentEmail = DataManager.ConvertToBool(form["chkSendEmail"]); b2bAssignLead.OtherEmail = form["ToSendEmail"]; b2bAssignLead.IsDefaultLead = DataManager.ConvertToBool(form["chkSetDefaultLead"]); b2bAssignLead.IsRegisterMember = DataManager.ConvertToBool(form["chkRegMember"]); b2bAssignLead.CompLeadCount = DataManager.ConvertToShort(form["hidCountCompLead"]); #endregion #region Set Email var Email = ""; if (!string.IsNullOrEmpty(form["ToSendEmail"])) { Email = form["ToSendEmail"]; } else if (!string.IsNullOrEmpty(form["ToContactEmail"])) { Email = form["ToContactEmail"]; } b2bAssignLead.IsSentEmail = true; #endregion #region Save AssignLead int AssignLeadID = svPurchase.InsertAssignLead(b2bAssignLead); #endregion #region set and save b2bCompanyLead if (!string.IsNullOrEmpty(form["hidAllSupplierCompID"])) { string supplierID = form["hidAllSupplierCompID"]; string[] subSupplierCompID = supplierID.Split(','); for (int i = 0; i < subSupplierCompID.Length; i++) { var b2bCompanyLead = new b2bCompanyLead(); //Get CompID and CompCode SupplierCompID = DataManager.ConvertToInteger(subSupplierCompID[i]); var Company = svCompany.SelectData <b2bCompany>("CompID,CompCode", "CompID = " + SupplierCompID).First(); b2bCompanyLead.AssignLeadID = AssignLeadID; b2bCompanyLead.CompID = SupplierCompID; b2bCompanyLead.CompCode = Company.CompCode; svPurchase.InsertCompanyLead(b2bCompanyLead); } } #endregion #region Save b2bEmLead and b2bEmCompanyLead if (b2bAssignLead.IsDefaultLead == true) { #region set ค่า b2bEmLead var b2bEmLead = new b2bEmLead(); if (LogonCompID > 0) { svMember = new MemberService(); string sqlWhere = "IsDelete = 0 AND CompID = " + LogonCompID; var Member = svMember.SelectData <view_CompMember>("MemberID,CompID,UserName", sqlWhere).First(); b2bEmLead.MemberID = Member.MemberID; } var EmLeadCode = svPurchase.GenLeadCode(CompID, 2); b2bEmLead.EmLeadCode = EmLeadCode; b2bEmLead.EmLeadName = form["txtSetDefaultLead"]; b2bEmLead.EmLeadKeyword = form["hidProductName"]; b2bEmLead.LeadCount = DataManager.ConvertToShort(form["hidCountCompLead"]); #endregion #region Save EmLead then return EmLeadID int EmLeadID = svPurchase.InsertEmLead(b2bEmLead); #endregion #region set and save b2bEmCompanyLead if (!string.IsNullOrEmpty(form["hidAllSupplierCompID"])) { string supplierID = form["hidAllSupplierCompID"]; string[] subSupplierCompID = supplierID.Split(','); for (int i = 0; i < subSupplierCompID.Length; i++) { var b2bEmCompanyLead = new b2bEmCompanyLead(); SupplierCompID = DataManager.ConvertToInteger(subSupplierCompID[i]); b2bEmCompanyLead.EmLeadID = EmLeadID; b2bEmCompanyLead.CompID = SupplierCompID; b2bEmCompanyLead.EmCompLeadCode = svPurchase.GenLeadCode(SupplierCompID, 3); svPurchase.InsertEmCompanyLead(b2bEmCompanyLead); } } #endregion } #endregion #region Register Member if (b2bAssignLead.IsRegisterMember == true) { RegisterNewMember(form); } #endregion #region Send Email SendEmailToBuyer(Email, AssignLeadID, form, SupplierCompID); #endregion return(Json(true)); } catch (Exception ex) { CreateLogFiles(ex); return(Redirect("~/MyB2B/Purchase/CreateLead")); } }
public async Task Init() { //TODO : REFACTOR var options = new DbContextOptionsBuilder <MISDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; this.dbContext = new MISDbContext(options); var product = new Product() { Name = "testProduct", BarCode = "testBarcode", Price = 2.4m, Quantity = 3, }; await this.dbContext.AddAsync(new MISUser() { UserName = "******", Company = new Company { Name = "test", Address = "test", WareHouses = new List <WareHouse>() { new WareHouse() { Name = "testWareHouse", IsFavorite = true, Categories = new List <Category>() { new Category() { Name = "testCategoryName", Products = new List <Product>() { product } } }, Products = new List <Product>() { product } } }, }, Receipts = new List <Receipt>() { new Receipt() { IssuedOn = DateTime.UtcNow }, new Receipt() }, Reports = new List <Report>() { new Report() { Name = "testReport", From = DateTime.UtcNow.AddDays(-3), To = DateTime.UtcNow.AddDays(-3) } } }); await this.dbContext.SaveChangesAsync(); var store = new Mock <IUserStore <MISUser> >(); var mgr = new Mock <UserManager <MISUser> >(store.Object, null, null, null, null, null, null, null, null); mgr.Object.UserValidators.Add(new UserValidator <MISUser>()); mgr.Object.PasswordValidators.Add(new PasswordValidator <MISUser>()); mgr.Setup(x => x.GetUserAsync(It.IsAny <ClaimsPrincipal>())) .Returns((ClaimsPrincipal x) => this.dbContext.Users.Include(c => c.Company).FirstOrDefaultAsync(z => z.UserName == x.Identity.Name)); mgr.Setup(x => x.GetUserId(It.IsAny <ClaimsPrincipal>())) .Returns((ClaimsPrincipal x) => this.dbContext.Users.Include(c => c.Company).FirstOrDefaultAsync(z => z.UserName == x.Identity.Name).GetAwaiter().GetResult()?.Id); this.userManager = mgr.Object; var userService = new UserService(this.dbContext); var companyService = new CompanyService(this.dbContext, userService); var categoryService = new CategoryService(new WareHouseService(this.dbContext, companyService), this.dbContext); var productService = new ProductService(this.dbContext, categoryService); var receiptService = new ReceiptService(this.dbContext, userService, companyService, productService); this.reportService = new ReportService(this.dbContext, companyService, receiptService); }
public static ICompanyService<Company> GetCompany() { ICompanyService<Company> serviceObj = null; switch (sectionHandler.ConnectionStringName) { case DataBaseType.SKILLSMART_MONGO_DB: serviceObj = new CompanyService(DatabaseFactory.CreateMongoDatabase()); break; default: serviceObj = new CompanyService(DatabaseFactory.CreateMongoDatabase()); break; } return serviceObj; }
public JsonResult GetBuyerName(string id) { var companySvc = new CompanyService(); var companyVM = companySvc.GetCompanyById(Convert.ToInt32(id)); var result = new Dictionary<string, object>{{"id", companyVM.Id}, {"name", companyVM.Name}}; return Json(result,JsonRequestBehavior.AllowGet); }
private void SyncCompanyInfo() { companyService = new CompanyService(); companyService.Init(); var injectService = new InjectService(); injectService.CancellationTokenSource = companyService.CancellationTokenSource; injectService.Sync_D_QY_ZYJSRY(NotifyProcessBar); var syncSettings = new List<string>(); foreach (DataSetting item in clbSyncSettings.CheckedItems) { syncSettings.Add(item.Name); } companyService.Sync(NotifyProcessBar, syncSettings.ToArray()); }
public ActionResult View(int id) { VehicleMasterService objVService = new VehicleMasterService(); VehicleItem objVItem = new VehicleItem(); List <VehicleItem> lstVItem = new List <VehicleItem>(); objVItem = objVService.GetById(id); //Session["Empid"] = objPassItem.EmpId; objVItem.ListVehicle = new List <VehicleItem>(); objVItem.ListVehicle.AddRange(lstVItem); List <VehicleTypeModel> lstVType = new List <VehicleTypeModel>(); lstVType = objVService.getActiveVType(); objVItem.ListVType = new List <VehicleTypeModel>(); objVItem.ListVType.AddRange(lstVType); //Bind Doc Grid List <VehicleDocumentItem> ListVehicle = new List <VehicleDocumentItem>(); ListVehicle = objVService.getVehicleDoc(id); objVItem.ListVehicleDocument = new List <VehicleDocumentItem>(); objVItem.ListVehicleDocument.AddRange(ListVehicle); List <CompanyItem> objCompany = new List <CompanyItem>(); CompanyService objListCompany = new CompanyService(); objCompany = objListCompany.GetALL(); objVItem.ListCompany = new List <CompanyItem>(); objVItem.ListCompany.AddRange(objCompany); int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objVService.GetEmp(cid); objVItem.ListEmp = new List <EmployeeItem>(); objVItem.ListEmp.AddRange(lstEmp); #endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objVService.GetBranch(); objVItem.ListBranch = new List <BranchItem>(); objVItem.ListBranch.AddRange(lstBranch); #endregion PetrolCardService objPCard = new PetrolCardService(); PetrolCardItem objPCardItem = new PetrolCardItem(); #region DDL PaymentType List <clsMasterData> lstMasters1 = new List <clsMasterData>(); lstMasters1 = objPCard.GetPaymentType(); objPCardItem.ListMaster = new List <clsMasterData>(); objPCardItem.ListMaster.AddRange(lstMasters1); objVItem.ListMasterTablePayment = objPCardItem.ListMaster; #endregion #region DDL PCardType List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objPCard.GetPCardType(); objPCardItem.ListMaster1 = new List <clsMasterData>(); objPCardItem.ListMaster1.AddRange(lstMasters); objVItem.ListMasterTableCard = objPCardItem.ListMaster1; #endregion ViewBag.Menuid = Request.QueryString["menuId"]; var aa = ViewBag.Menuid; return(View(objVItem)); }
public CompanyController(CompanyService companyService, StudentService studentService, IEmailSender emailSender) { _companyService = companyService; _studentService = studentService; _emailSender = emailSender; }
public ActionResult List(PagedParam<CompanyQuery> queryCond) { var result = new CompanyService().List(queryCond); return Json(new AjaxResult("查询成功", AjaxResultType.Success, new { rows = result, total = result.TotalItemCount })); }
public ActionResult GetById(int id) { var result = new CompanyService().GetById(id); return Json(new AjaxResult("查询成功", AjaxResultType.Success, result)); }
public CompanyController(CompanyService service) { companyService = service; }
private void MainForm_Load(object sender, EventArgs e) { // initialise logger Logger.Instance.SetOutput(logBox); Logger.WriteLine("Server starting.."); // initialise database Database.Instance.Connect(); // initialise the state object currentState = new CurrentState(); // initialise all the services (they set up the state themselves) and pathfinder countryService = new CountryService(currentState); companyService = new CompanyService(currentState); routeService = new RouteService(currentState); var pathFinder = new PathFinder(routeService); // pathfinder needs the RouteService and state deliveryService = new DeliveryService(currentState, pathFinder); // DeliveryService needs the PathFinder priceService = new PriceService(currentState); locationService = new LocationService(currentState); eventService = new EventService(currentState); statisticsService = new StatisticsService(); // initialise network Network.Network network = Network.Network.Instance; network.Start(); network.Open(); // create controller var controller = new Controller(countryService, companyService, deliveryService, priceService, routeService, locationService, statisticsService, eventService); //BenDBTests(countryService, routeService); //SetUpDatabaseWithData(); /*try { var priceDH = new PriceDataHelper(); var standardPrice = new DomesticPrice(Priority.Standard) { PricePerGram = 3, PricePerCm3 = 5 }; //standardPrice = priceService.CreateDomesticPrice(standardPrice.Priority, standardPrice.PricePerGram, standardPrice.PricePerCm3); standardPrice.PricePerCm3 = 8; //standardPrice = priceService.UpdateDomesticPrice(standardPrice.ID, standardPrice.Priority, standardPrice.PricePerGram, standardPrice.PricePerCm3); var loadedPrice = priceService.GetDomesticPrice(1); var prices = priceService.GetAllDomesticPrices(); var normalPrices = priceService.GetAll(); } catch (DatabaseException er) { Logger.WriteLine(er.Message); Logger.Write(er.StackTrace); }*/ }
protected override void OnActionExecuting(ActionExecutingContext filterContext) { base.OnActionExecuting(filterContext); IActionListService actionService = new ActionListService(); init(); // To get area,controller and action name from http request var routeData = filterContext.RequestContext.RouteData; var module = (string)routeData.DataTokens["area"]; var controller = routeData.GetRequiredString("controller"); var action = routeData.GetRequiredString("action"); // to save Action List var actionList = new ActionList { ModuleName = module, ControllerName = controller, ActionName = action, IsShowInMenu = false, }; actionService.AddActionListFromBaseController(actionList); // Check user type, if owner then he/she can add company. if ((action == "Add" && controller == "Company") || (action == "InvitationConfirm" && controller == "Invitations")) return; // To get ActionList Id actionList = actionService.GetActionListByActionList(actionList); IUserInRoleService userInRoleService = new UserInRoleService(); IRoleVsActionService rvaService = new RoleVsActionService(); ICompanyService cService = new CompanyService(); if (UserId ==0) { filterContext.Result = new RedirectResult(Url.Action("Logout", "Users", new { area = "UserManagement" })); return; } if (CompanyId == 0) { filterContext.Result = new RedirectResult(Url.Action("MyMhasb", "Users", new { area = "UserManagement" })); return; } var myCompany = cService.GetSingleCompany(CompanyId); if (myCompany == null) { filterContext.Result = new RedirectResult(Url.Action("MyMhasb", "Users", new { area = "UserManagement" })); return; } if (!((action == "Update" && controller == "Company") || (action == "Create" && controller == "FinalcialSetting") || (action == "Create" && controller == "Invitations") || (action == "Create" && controller == "ChartOfAccounts") || (action == "Finish" && controller == "Users"))) { //string absUrl; //if (!checkCompanyFlow(out absUrl)) //{ // filterContext.Result = new RedirectResult(absUrl); // return; //} return; } var activatedCompany = cService.GetSingleCompany(CompanyId); if (activatedCompany.Users.Id == UserId) return; var roleList = userInRoleService.GetRoleListByUserAndCompany(UserId, CompanyId); foreach (var role in roleList) { var accessableActionList = rvaService.GetActionByRoleId(role.RoleId); foreach (var accessableAction in accessableActionList) { if (accessableAction.ActionId == actionList.Id) return; } } //filterContext.Result = new RedirectResult("~/Home/AccessDenied"); // Old Block Dont upBlock pls brothers //if (roleList.SelectMany(role => rvaService.GetActionByRoleID(role.RoleId)).Any(accessableAction => accessableAction.ActionId == actionList.Id)) //{ // return; //} }
public HomeController() { companyService = new CompanyService(); }
private void AppendContractor(ChangeOrder co, object contractorKey) { co.Contractor = CompanyService.GetCompany(contractorKey); }
public AuthentificationController(CompanyService cService, StudentService sService) { companyService = cService; studentService = sService; }
public List <NuOrderImportTemp> MapFileToTemp(string businessName, List <Dictionary <string, string> > orderLines, UserModel taskUser) { List <NuOrderImportTemp> nuOrderImportTempList = new List <NuOrderImportTemp>(); CompanyModel company = CompanyService.FindCompanyFriendlyNameModel(businessName); if (orderLines == null) { return(null); } else { foreach (var line in orderLines) { CustomerModel customer = GetCustomer(company, line, taskUser); NuOrderImportTemp noit = new NuOrderImportTemp(); noit.CompanyId = company.Id; noit.SourceId = LookupService.FindLOVItemModel(LOVName.OrderSource, "Nuorder").Id; noit.CustomerId = customer.Id; noit.OrderNumber = null; noit.CustomerPO = line["Order Number"]; noit.RequiredDate = DateTimeOffset.Parse(line["Order Date"]); noit.CompanyName = line["Customer Code"]; noit.EndUserName = line["Buyer"]; noit.ShipAddress1 = line["Shipping Line 1"]; noit.ShipAddress2 = line["Shipping Line 2"]; noit.Filespec = null; noit.Telephone = null; noit.ShipAddress3 = line["Shipping Line 3"]; noit.ShipAddress4 = line["Shipping Line 4"]; noit.ShipSuburb = line["Shipping City"]; noit.ShipState = line["Shipping State"]; noit.ShipPostcode = line["Shipping Zip"]; noit.ShipCountryId = LookupService.FindCountryModel(line["Shipping Country"]).Id; noit.SOStatus = (int)SalesOrderHeaderStatus.ConfirmedOrder; noit.SOSubstatus = (int)SalesOrderHeaderSubStatus.Unpicked; noit.SalesPersonId = MembershipManagementService.FindUserByAliasName(line["Sales Rep"].Replace(" ", ".")).Id; noit.OrderComment = line["Order Notes"]; noit.LocationId = company.DefaultLocationID.Value; noit.TermsId = customer.PaymentTermId; noit.ShippingMethodId = customer.ShippingMethodId; noit.TaxPercent = LookupService.FindTaxCodeModel(customer.TaxCodeId).TaxPercentageRate / 100; noit.TaxCodeId = customer.TaxCodeId; noit.WebsiteOrderNo = line["Order Number"]; noit.EmailAddress = null; noit.Comments = line["Order Notes"]; noit.IsError = false; // Date Fields are in US format, so need to Parse them accordingly string dateFormat = "MM/dd/yyyy"; var orderDate = line["Order Date"]; noit.OrderDate = DateTimeOffsetExtensions.ParseDate(DateTimeOffset.ParseExact(orderDate, dateFormat, CultureInfo.InvariantCulture), TimeZoneInfo.Local.BaseUtcOffset.Hours, OffsetType.Hours); var startDate = line["Ship Date Start"]; noit.DeliveryWindowOpen = (startDate == null || string.IsNullOrWhiteSpace(startDate)) ? noit.OrderDate : DateTimeOffsetExtensions.ParseDate(DateTimeOffset.ParseExact(startDate, dateFormat, CultureInfo.InvariantCulture), TimeZoneInfo.Local.BaseUtcOffset.Hours, OffsetType.Hours); var endDate = line["Ship Date End"]; noit.DeliveryWindowClose = (endDate == null || string.IsNullOrWhiteSpace(endDate) ? LookupService.GetDeliveryWindow(noit.DeliveryWindowOpen.Value) : DateTimeOffsetExtensions.ParseDate(DateTimeOffset.ParseExact(endDate, dateFormat, CultureInfo.InvariantCulture), TimeZoneInfo.Local.BaseUtcOffset.Hours, OffsetType.Hours)); noit.ManualDWO = false; noit.ManualDWC = true; noit.ShippingMethodAccount = null; noit.NextActionId = LookupService.FindSaleNextActionId(Enumerations.SaleNextAction.None); noit.IsConfirmedAddress = true; noit.IsManualFreight = false; noit.FreightRate = customer.FreightRate; noit.MinFreightPerOrder = customer.MinFreightPerOrder; noit.FreightCarrierId = customer.FreightCarrierId; noit.WarehouseInstructions = null; noit.DeliveryInstructions = null; noit.DeliveryContact = null; noit.FreightTermId = null; noit.OrderTypeId = null; noit.SignedBy = "Customer"; noit.DateSigned = noit.OrderDate; noit.MethodSignedId = LookupService.FindMethodSignedModel("NuOrder").Id; //noit.PrintedForm = null; noit.IsMSQProblem = false; noit.IsOverrideMSQ = false; noit.SiteName = "NuOrder"; noit.IsProcessed = false; noit.IsRetailSale = false; noit.IsRetailHoldingOrder = false; noit.LineNumber = null; var product = ProductService.FindProductModel(line["Style Number"], null, company, false); noit.ItemId = product.Id; noit.ItemNumber = line["Style Number"]; noit.ItemDescription = product.ItemDescription; noit.BrandCategoryId = ProductService.FindProductBrandCategoryModel(company.Id, product.Id).Id; noit.UnitPriceExTax = Convert.ToDecimal(line["Price Per"]); noit.UnitPriceTax = Convert.ToDecimal(line["Price Per"]) * noit.TaxPercent; var volumeDiscountPercent = customer.VolumeDiscount / 100; noit.Discount = Convert.ToDecimal(line["Price Per"]) * volumeDiscountPercent; noit.DiscountPercent = customer.VolumeDiscount; noit.OrderQty = Convert.ToInt32(line["Quantity"]); noit.AllocQty = 0; noit.PickQty = 0; noit.InvQty = 0; noit.LineStatusId = (int)SalesOrderLineStatus.Unpicked; noit.DateCreated = DateTimeOffset.Now; noit.DateModified = DateTimeOffset.Now; nuOrderImportTempList.Add(noit); } } if (SaveDataToTempTables(nuOrderImportTempList)) { return(nuOrderImportTempList); } else { return(null); } }
public JsonResult GetAllCompanyList() { int currentUserId = Convert.ToInt32(Session["CurrentUserId"].ToString()); var companySvc = new CompanyService(); var companyList = companySvc.GetCompanyByRelUserId(currentUserId);//初始化购买订单页面 var result = companyList.Select(o => new Dictionary<string, object> { {"id", o.Id}, {"text", o.Name} }).ToList(); return Json(result); }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); var company = CompanyService.GetCompanySettingsInfo(CurrentCompany.CompanyId); if (company != null && company.Parameter.CanHaveSubordinate) { neibuTh.Visible = true; neibufanyong.Visible = true; } else { neibuTh.Visible = false; neibufanyong.Visible = false; } cutomeTh.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; ddlCustomCode.Visible = company != null && company.WorkingSetting != null && company.WorkingSetting.IsImpower; if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!');window.location.href='/Index.aspx';", true); return; } bool allowBrotherPurchases = false; if (company != null) { allowBrotherPurchases = company.Parameter.AllowBrotherPurchase; } dropOffice.DataSource = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId); dropOffice.DataTextField = "Number"; dropOffice.DataValueField = "Impower"; dropOffice.DataBind(); ddlCustomCode.DataSource = CompanyService.GetCustomNumberByEmployee(CurrentUser.Id); ddlCustomCode.DataTextField = "Number"; ddlCustomCode.DataValueField = "Number"; ddlCustomCode.DataBind(); tongTh.Visible = allowBrotherPurchases; tong.Visible = allowBrotherPurchases; var queryList = FoundationService.Airports; this.txtDepartureAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtArrivalAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); //this.txtZhongzhuanAirports.InitData(true, queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); this.txtShifaAirports.InitData(queryList.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); if (Request.QueryString["Id"] != null && Request.QueryString["Type"] != null) { BargainPolicy bargain = PolicyManageService.GetBargainPolicy(Guid.Parse(Request.QueryString["Id"])); if (bargain.VoyageType == VoyageType.OneWay) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainOneWayChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } else if (bargain.VoyageType == VoyageType.RoundTrip) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainRoundTripChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } else if (bargain.VoyageType == VoyageType.TransitWay) { selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayEndorseRegulation); selEndorseRegulation.DataTextField = "Name"; selEndorseRegulation.DataValueField = "Name"; selEndorseRegulation.DataBind(); selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayInvalidRegulation); selInvalidRegulation.DataTextField = "Name"; selInvalidRegulation.DataValueField = "Name"; selInvalidRegulation.DataBind(); selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayRefundRegulation); selRefundRegulation.DataTextField = "Name"; selRefundRegulation.DataValueField = "Name"; selRefundRegulation.DataBind(); selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.BargainTransitWayChangeRegulation); selChangeRegulation.DataTextField = "Name"; selChangeRegulation.DataValueField = "Name"; selChangeRegulation.DataBind(); } if (Request.QueryString["Type"].Trim() == "Update") { tip.InnerText = "修改特价政策"; chkAuto.Visible = false; btnCopy.Visible = false; btnModify.Visible = true; lblAirline.Visible = true; ddlAirline.Visible = false; } if (Request.QueryString["Type"].Trim() == "Copy") { tip.InnerText = "复制特价政策"; lblAirline.Visible = false; ddlAirline.Visible = true; chkAuto.Visible = true; btnCopy.Visible = true; btnModify.Visible = false; string[] strIds = setting.Airlines.Split('/'); ddlAirline.DataSource = from item in FoundationService.Airlines where item.Valid && strIds.Contains(item.Code.Value) select new { Code = item.Code, Name = item.Code + "-" + item.ShortName }; ddlAirline.DataTextField = "Name"; ddlAirline.DataValueField = "Code"; ddlAirline.DataBind(); } //ddlBunks.DataSource = QueryBunks(Bargain.Airline, Bargain.DepartureDateStart, Bargain.DepartureDateEnd); //ddlBunks.DataBind(); InitDataValue(bargain); } } }
public MainWindow() { InitializeComponent(); var companyService = new CompanyService(); }
public ActionResult GetCompany(string q, int page_limit, int page, int companyType) { var CompanySvc = new CompanyService(); int from = (page - 1) * page_limit; int to = from + page_limit - 1; var company = CompanySvc.GetCompanyByRange(from, to, q, companyType).Select(o => new Dictionary<string, object> { {"id", o.Id}, {"text", o.Name} }).ToList(); int count = CompanySvc.GetAllCount(companyType, q); var result = new Dictionary<string, object>{ {"total",count}, {"company",company} }; return Json(result); }
public CompanyController(CompanyService companyService) { this.companyService = companyService; }
// GET: Employee public ActionResult ShowEmployees() { var employees = CompanyService.GetAllTbl_Employees(); return(View(employees)); }
public DemoDataService(CompanyService companyService, OrderService orderService) { _companyService = companyService; _orderService = orderService; }
//根据库存ID生成新增的SaleOrder public TradeManagementEditVM GetSalesOrderByStockId(int stockId, int currentUserId) { var stockDal = new StockDAL(); var stock = stockDal.GetById(stockId, new List<string> { "Commodity","CommodityType","Brand","Warehouse","Company"}); var tradeManagementEditVM = new TradeManagementEditVM { Premium = string.Format("{0:#,##0}", stock.Premium), Price = string.Format("{0:#,##0.00}", stock.Price), CommodityName = stock.Commodity == null ? "" : stock.Commodity.Name, CommodityTypeName = stock.CommodityType == null ? "" : stock.CommodityType.Name, BrandName = stock.Brand == null ? "" : stock.Brand.Name, Warehouse = stock.Warehouse == null ? "" : stock.Warehouse.Name, BuyUnit = stock.BuyUnit, PricingType = stock.PricingType, SalerName = stock.Company.Name, CommodityId = stock.CommodityId, CommodityCode = stock.Commodity.Code, CommodityUnit = stock.Commodity.CommodityUnit, StockId = stock.Id }; var companySvc = new CompanyService(); List<CompanyVM> companyList = companySvc.GetCompanyByRelUserId(currentUserId); if(companyList != null && companyList.Count > 0) { tradeManagementEditVM.CompanyId = companyList.FirstOrDefault().Id; } var sysSettingSvc = new SysSettingService(); var sysSettingVM = sysSettingSvc.GetSysSetting(); tradeManagementEditVM.CountDown = sysSettingVM.CountDown; return tradeManagementEditVM; }
public virtual void LoadSelectLists(List <int> embargoedCountries, Entities.Company company) { Countries.Add(new SelectListItem() { Text = "No public offer", Value = "", Selected = true }); foreach (var country in Persistent.Countries.GetAll()) { if (embargoedCountries.Contains(country.ID)) { continue; } var item = new SelectListItem() { Value = country.ID.ToString(), Text = country.Entity.Name }; Countries.Add(item); } foreach (var item in company.Entity .Equipment .EquipmentItems .Select(e => e.ProductID) .Distinct() .ToList()) { var product = (ProductTypeEnum)item; if (CompanyService.IsSellable(product) == false) { continue; } if (CompanyService.CanSellProduct((CompanyTypeEnum)company.CompanyTypeID, product) == false) { continue; } Products.Add(new SelectListItem() { Value = ((int)product).ToString(), Text = product.ToHumanReadable().FirstToUpper() }); } foreach (var item in company.Entity .Equipment .EquipmentItems .Select(e => new { ProductID = e.ProductID, Quality = e.Quality }) .Distinct() .ToList()) { if (CompanyService.IsSellable((ProductTypeEnum)item.ProductID) == false) { continue; } if (ProductQualities.ContainsKey(item.ProductID.ToString()) == false) { ProductQualities.Add(item.ProductID.ToString(), new List <int>()); } ProductQualities[item.ProductID.ToString()].Add(item.Quality); } }
public ClientsController(TreinandoContext context, CompanyService companyService, ClientService clientService) { _context = context; _companyService = companyService; _clientService = clientService; }
public ActionResult Edit(int id) { UserService objUser = new UserService(); LoginItem objBItem = new LoginItem(); objBItem = objUser.GetById(id); //Session["Empid"] = objPassItem.EmpId; List <LoginItem> lstUser = new List <LoginItem>(); objBItem.ListUser = new List <LoginItem>(); objBItem.ListUser.AddRange(lstUser); //EncDec objEnDec = new EncDec(); //var pwd = objEnDec.Decrypt(objBItem.Password); //objBItem.Password = pwd; List <MenuItem> objlstItem = new List <MenuItem>(); objlstItem = objUser.getModules(id); objBItem.ListModules = new List <MenuItem>(); objBItem.ListModules.AddRange(objlstItem); //#region Bind DropDown comp List <CompanyItem> objCompany = new List <CompanyItem>(); CompanyService objListCompany = new CompanyService(); objCompany = objListCompany.GetALL(); objBItem.ListCompany = new List <CompanyItem>(); objBItem.ListCompany.AddRange(objCompany); //#endregion if (objlstItem.Count == 0) { MenuItem objMenuItem = new MenuItem(); //MenuService objMenuService = new MenuService(); List <MenuItem> objListMenu = new List <MenuItem>(); objListMenu = objUser.GetModules(); objBItem.ListModules = new List <MenuItem>(); objBItem.ListModules.AddRange(objListMenu); } List <LoginItem> lstUForm = new List <LoginItem>(); lstUForm = objUser.GetLeftMenu(id); objBItem.ListForm = new List <LoginItem>(); objBItem.ListForm.AddRange(lstUForm); //return PartialView(); if (lstUForm.Count == 0) { List <LoginItem> lstForm = new List <LoginItem>(); lstForm = objUser.GetFormMenu(); objBItem.ListForm = new List <LoginItem>(); objBItem.ListForm.AddRange(lstForm); } //int UID=Convert.ToInt32(Request.QueryString["id"]); ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objBItem)); }
protected void onGetCompaniesButtonClick() { ConfigureUserForOAuth(); try { // Get the CompanyService. CompanyService companyService = (CompanyService)user.GetService(DfpService.v201602.CompanyService); // Set defaults for page and statement. CompanyPage page = new CompanyPage(); StatementBuilder statementBuilder = new StatementBuilder() .OrderBy("id ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); DataTable dataTable = new DataTable(); dataTable.Columns.AddRange(new DataColumn[] { new DataColumn("N°", typeof(int)), new DataColumn("Comp Id", typeof(long)), new DataColumn("Nombre", typeof(string)), new DataColumn("Tipo", typeof(string)), new DataColumn("Correo Electronico", typeof(string)) }); do { // Get companies by statement. page = companyService.getCompaniesByStatement(statementBuilder.ToStatement()); if (page.results != null && page.results.Length > 0) { int i = page.startIndex; foreach (Company company in page.results) { DataRow dataRow = dataTable.NewRow(); dataRow.ItemArray = new object[] { i + 1, company.id, company.name, company.type, company.email }; dataTable.Rows.Add(dataRow); i++; } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.GetOffset() < page.totalResultSetSize); if (dataTable.Rows.Count > 0) { String vListaCompanias = ""; for (int i = 0; i < dataTable.Rows.Count; i++) { vListaCompanias += "<li><a href=\"Campaigns.aspx?id=123456\">" + dataTable.Rows[i][2].ToString() + "</a></li>"; } LitCompañias.Text = vListaCompanias; } else { Response.Write("No se encontraron compañias"); } } catch (Exception ex) { Response.Write(string.Format("Error en obtener compañias \"{0}\"", ex.Message)); } }
private void initData() { seniorCondition.Style.Add(HtmlTextWriterStyle.Display, "none"); if (DateTime.Now.CompareTo(DateTime.Parse("18:00")) > 0) { this.txtStartDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.txtEndDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); } else { this.txtStartDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); this.txtEndDate.Text = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); } this.hfdProviderCompanyId.Value = this.CurrentCompany.CompanyId.ToString(); BindAriline(this.CurrentCompany.CompanyId); BindCity(this.CurrentCompany.CompanyId); BindEmployee(this.CurrentCompany.CompanyId); //机票状态 var ticketStatus = Enum.GetValues(typeof(TicketState)) as TicketState[]; foreach (var item in ticketStatus) { if (item != TicketState.Change) { this.ddlTicketStatus.Items.Add(new ListItem(item.GetDescription(), ((int)item).ToString())); } } this.ddlTicketStatus.Items.Insert(0, new ListItem("全部", "")); //机票类型 var ticketType = Enum.GetValues(typeof(TicketType)) as TicketType[]; foreach (var item in ticketType) { this.ddlTiketType.Items.Add(new ListItem(item.GetDescription(), ((int)item).ToString())); } this.ddlTiketType.Items.Insert(0, new ListItem("全部", "")); //OFFICE号 this.ddlOffice.DataSource = CompanyService.QueryOfficeNumbers(this.CurrentCompany.CompanyId).Select(o => o.Number); this.ddlOffice.DataBind(); this.ddlOffice.Items.Insert(0, new ListItem("全部", "")); //销售关系 var relationType = Enum.GetValues(typeof(RelationType)) as RelationType[]; foreach (var item in relationType) { this.ddlRelationType.Items.Add(new ListItem(item.GetDescription(), ((int)item).ToString())); } this.ddlRelationType.Items.Insert(0, new ListItem("全部", "")); var companyParameter = CompanyService.GetCompanyParameter(this.CurrentCompany.CompanyId); if (!companyParameter.CanHaveSubordinate) { this.ddlRelationType.Items.Remove(new ListItem(RelationType.Interior.GetDescription(), ((int)RelationType.Interior).ToString())); } if (!companyParameter.AllowBrotherPurchase) { this.ddlRelationType.Items.Remove(new ListItem(RelationType.Brother.GetDescription(), ((int)RelationType.Brother).ToString())); } var companies = CompanyService.GetAllSubordinates(new DataTransferObject.Organization.SubordinateQueryParameter { RelationshipType = RelationshipType.Distribution, Superior = CurrentCompany.CompanyId }, new Pagination { PageIndex = 1, PageSize = int.MaxValue }); if (companies != null) { this.LowerCompany.DataSource = from item in companies select new { Text = item.UserNo + "-" + item.AbbreviateName, Value = item.CompanyId }; this.LowerCompany.DataTextField = "Text"; this.LowerCompany.DataValueField = "Value"; this.LowerCompany.DataBind(); } this.LowerCompany.Items.Insert(0, new ListItem("", "")); var interiorCompanies = CompanyService.GetAllSubordinates(new DataTransferObject.Organization.SubordinateQueryParameter { Superior = CurrentCompany.CompanyId, RelationshipType = RelationshipType.Organization }, new Pagination { PageIndex = 1, PageSize = int.MaxValue }); if (interiorCompanies != null) { this.SubordinateCompany.DataSource = from item in interiorCompanies select new { Text = item.UserNo + "-" + item.AbbreviateName, Value = item.CompanyId }; this.SubordinateCompany.DataTextField = "Text"; this.SubordinateCompany.DataValueField = "Value"; this.SubordinateCompany.DataBind(); } this.SubordinateCompany.Items.Insert(0, new ListItem("", "")); //特殊票类型 if (companyParameter.Singleness) { this.ddlSpecialType.Items.Add(new ListItem("单程控位产品", ((int)SpecialProductType.Singleness).ToString())); } if (companyParameter.Disperse) { this.ddlSpecialType.Items.Add(new ListItem("散冲团产品", ((int)SpecialProductType.Disperse).ToString())); } if (companyParameter.CostFree) { this.ddlSpecialType.Items.Add(new ListItem("免票产品", ((int)SpecialProductType.CostFree).ToString())); } if (companyParameter.Bloc) { this.ddlSpecialType.Items.Add(new ListItem("集团票产品", ((int)SpecialProductType.Bloc).ToString())); } if (companyParameter.Business) { this.ddlSpecialType.Items.Add(new ListItem("商旅卡产品", ((int)SpecialProductType.Business).ToString())); } if (companyParameter.OtherSpecial) { this.ddlSpecialType.Items.Add(new ListItem(SpecialProductType.OtherSpecial.GetDescription(), ((int)SpecialProductType.OtherSpecial).ToString())); } if (companyParameter.LowToHigh) { this.ddlSpecialType.Items.Add(new ListItem(SpecialProductType.LowToHigh.GetDescription(), ((int)SpecialProductType.LowToHigh).ToString())); } this.ddlSpecialType.Items.Insert(0, new ListItem("全部", "")); }
private async void OnOkTapped(object sender, EventArgs e) { CompanyService service = new CompanyService(); try { RequestCheckin requestCheckin = new RequestCheckin(); requestCheckin.CompanyId = _company.Id; requestCheckin.ClientQuantity = txtQtd.Text; requestCheckin.ClientId = Helpers.Settings.DisplayUserId; requestCheckin.Occupation = txtOccupation.Text; requestCheckin.LocationId = _locationId; Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); bool result = false; if (_company.CheckedIn && !string.IsNullOrEmpty(_locationId)) { var sub = new CheckinSub(); sub.LocationId = _locationId; sub.Occupation = requestCheckin.Occupation; sub.ClientQuantity = requestCheckin.ClientQuantity; sub.ClientId = Helpers.Settings.DisplayUserId; result = await service.RequestCheckinSub(sub); } else { if (string.IsNullOrEmpty(txtQtd.Text) && txtQtd.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, "Você precisa informar o número de pessoas.", AppResource.textOk); return; } else if (string.IsNullOrEmpty(txtOccupation.Text) && txtOccupation.IsVisible) { await this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, "Você precisa preencher " + lblOcuupation.Text + ". Por favor contate o atendente.", AppResource.textOk); return; } result = await service.AddRemoveCheckinPost(requestCheckin); } if (result) { await this.DisplayAlert(AppResource.textCheckin, "Checkin feito com sucesso. Aguarde a aprovação realizar pedidos.", AppResource.textOk); await App.AppCurrent.NavigationService.ModalGoBack(); } else { await this.DisplayAlert(AppResource.alertAlert, "Ocorreu um erro. Tente novamente em alguns minutos.", AppResource.textOk); } } catch (Exception ex) { this.DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { var company = CompanyService.GetCompanySettingsInfo(CurrentCompany.CompanyId); if (company != null && company.Parameter.CanHaveSubordinate) { neibuTh.Visible = true; neibufanyong.Visible = true; } else { neibuTh.Visible = false; neibufanyong.Visible = false; } SettingPolicy setting = CompanyService.GetPolicySetting(this.CurrentCompany.CompanyId); if (setting == null) { RegisterScript("alert('还未有任何政策设置信息,不能访问本页面!');window.location.href='/Index.aspx';", true); return; } if (setting.Airlines == "") { RegisterScript("alert('还没有设置航空公司,请先设置航空公司!');window.location.href='/Index.aspx';", true); return; } this.txtDepartureAirports.InitData(true, ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); this.txtArrivalAirports.InitData(true, ChinaPay.B3B.Service.FoundationService.Airports.Where(item => setting.Departure.Split('/').Contains(item.Code.Value))); IEnumerable <OfficeNumber> list = null; var empowermentOffice = CompanyService.GetWorkingSetting(this.CurrentCompany.CompanyId) != null && CompanyService.GetWorkingSetting(this.CurrentCompany.CompanyId).IsImpower; if (empowermentOffice) { list = AccountCombineService.GetOfficeNoByEmployee(this.CurrentUser.Id); } else { list = from item in AccountCombineService.GetOfficeNumbers(this.CurrentCompany.CompanyId) select new OfficeNumber { Impower = false, Company = item.Company, Number = item.Number, Enabled = item.Enabled, Id = item.Id }; } if (list != null) { dropOffice.DataSource = list; dropOffice.DataTextField = "Number"; dropOffice.DataValueField = "Impower"; dropOffice.DataBind(); } //selEndorseRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.EndorseRegulation); //selEndorseRegulation.DataTextField = "Name"; //selEndorseRegulation.DataValueField = "Name"; //selEndorseRegulation.DataBind(); //selInvalidRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.InvalidRegulation); //selInvalidRegulation.DataTextField = "Name"; //selInvalidRegulation.DataValueField = "Name"; //selInvalidRegulation.DataBind(); //selRefundRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.RefundRegulation); //selRefundRegulation.DataTextField = "Name"; //selRefundRegulation.DataValueField = "Name"; //selRefundRegulation.DataBind(); //selChangeRegulation.DataSource = SystemDictionaryService.Query(SystemDictionaryType.ChangeRegulation); //selChangeRegulation.DataTextField = "Name"; //selChangeRegulation.DataValueField = "Name"; //selChangeRegulation.DataBind(); if (Request.QueryString["Id"] != null && Request.QueryString["Type"] != null) { RoundTripPolicy roundTrip = PolicyManageService.GetRoundTripPolicy(Guid.Parse(Request.QueryString["Id"])); if (Request.QueryString["Type"].Trim() == "Update") { tip.InnerText = "修改往返政策"; lblAirline.Visible = true; ddlAirline.Visible = false; chkAuto.Visible = false; btnCopy.Visible = false; btnModify.Visible = true; } if (Request.QueryString["Type"].Trim() == "Copy") { tip.InnerText = "复制往返政策"; lblAirline.Visible = false; ddlAirline.Visible = true; chkAuto.Visible = true; btnCopy.Visible = true; btnModify.Visible = false; string[] strIds = setting.Airlines.Split('/'); ddlAirline.DataSource = from item in ChinaPay.B3B.Service.FoundationService.Airlines where item.Valid && strIds.Contains(item.Code.Value) select new { item.Code, Name = item.Code + "-" + item.ShortName }; ddlAirline.DataTextField = "Name"; ddlAirline.DataValueField = "Code"; ddlAirline.DataBind(); } InitDataValue(roundTrip); } } }
private async void OnCheckinTapped(object sender, EventArgs e) { Image obj = sender as Image; Device.BeginInvokeOnMainThread(() => { try { obj.ScaleTo(1.3, 75).ContinueWith((t) => { try { obj.ScaleTo(1.0, 75); } catch { } }, scheduler: TaskScheduler.FromCurrentSynchronizationContext()); } catch { } }); if (Helpers.Settings.DisplayUserRole == Enums.UserRole.Guest.ToString()) { App.AppCurrent.AlertToGuest(); return; } try { if (_company.HasLocation) { await App.AppCurrent.NavigationService.NavigateModalAsync(new MultiLocationRequestCheckin(_company), null, true); } else if (!_company.CheckedIn) { await App.AppCurrent.NavigationService.NavigateModalAsync(new SingleLocationRequestCheckinPage(_company), null, true); } else { CompanyService service = new CompanyService(); string msg = AppResource.alertWantCloseLocationBill; string title = AppResource.textCheckout; bool answer = await DisplayAlert(title, msg, AppResource.textOk, AppResource.alertCancel); if (!answer) { return; } Acr.UserDialogs.UserDialogs.Instance.ShowLoading(AppResource.alertLoading); try { string result = await service.RequestCheckoutFromClient(_company.Id, 0); Acr.UserDialogs.UserDialogs.Instance.Toast(AppResource.alertRequestSucess); App.AppCurrent.NavigationService.ModalGoBack(); } catch (Exception ex) { DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } } } catch (Exception ex) { DisplayAlert(MocoApp.Resources.AppResource.alertAlert, ex.Message, AppResource.textOk); } finally { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } }
private static WorkingSetting ReturnWorking(Guid id) { return(CompanyService.GetWorkingSetting(id)); }
public void SendEmailToSuppliers(FormCollection form) { if (!string.IsNullOrEmpty(form["hidAllSupplierCompID"])) { #region variable bool IsSend = true; var Detail = ""; var mailCC = new List <string>(); svCompany = new CompanyService(); svEmCompany = new emCompanyService(); Hashtable EmailDetail = new Hashtable(); #endregion #region Set Content & Value For Send Email string Subject = res.Email.lblSubjectSuppliers3 + " : " + form["hidProductName"] + " - " + res.Email.lblWeb_B2BThai; string b2bthai_url = res.Pageviews.UrlWeb; string pathlogo = b2bthai_url + "/Content/Default/logo/Ouikum/img_Logo120x74.png"; string buylead_url = form["txtBuyleadUrl"]; #region Select Suppliers //Convert string to int var getCompID = form["hidAllSupplierCompID"]; string[] strCompID = getCompID.Split(','); string WhereIN = CreateWhereIN(strCompID, "CompID"); string sqlWhere = WhereIN + " AND IsDelete = 0"; string sqlSelect = "CompID,CompName,ContactFirstName,ContactLastName,ContactPhone,ContactEmail,emCompID"; var Companies = svCompany.SelectData <view_Company>(sqlSelect, sqlWhere); #endregion var getAttachCompID = form["hidAttachEmailCompID"]; string[] strAttachCompID = getAttachCompID.Split(','); var mailFrom = res.Config.EmailNoReply; var mailTo = new List <string>(); foreach (var it in Companies) { #region use emCompID to query Username and Password EmailDetail["Username"] = ""; EmailDetail["Password"] = ""; for (int i = 0; i < strAttachCompID.Length; i++) { if (DataManager.ConvertToInteger(strAttachCompID[i]) == it.CompID) { EncryptManager encrypt = new EncryptManager(); sqlWhere = "IsDelete = 0 AND CompID = " + it.emCompID; sqlSelect = "MemberID,CompID,UserName,Password"; var Member = svEmCompany.SelectData <view_emCompanyMember>(sqlSelect, sqlWhere).First(); EmailDetail["Username"] = Member.UserName; EmailDetail["Password"] = encrypt.DecryptData(Member.Password); } } #endregion //string contectname = ""; //if (!string.IsNullOrEmpty(it.ContactFirstName)) //{ // contectname = it.ContactFirstName + " " + it.ContactLastName; //} //else //{ // contectname = it.CompName; //} string CompWebsite_url = b2bthai_url + "/CompanyWebsite/" + Url.ReplaceUrl(it.CompName) + "/Main/Index/" + it.CompID; EmailDetail["b2bthaiUrl"] = b2bthai_url; EmailDetail["pathLogo"] = pathlogo; EmailDetail["buyleadUrl"] = buylead_url; EmailDetail["websiteUrl"] = CompWebsite_url; EmailDetail["compName"] = it.CompName; EmailDetail["ContactFirstName"] = it.ContactFirstName; EmailDetail["ContactLastName"] = it.ContactLastName; EmailDetail["ContactPhone"] = it.ContactPhone; EmailDetail["ContactEmail"] = it.ContactEmail; EmailDetail["keyword"] = form["hidProductName"]; // data for set msg detail ViewBag.Data = EmailDetail; Detail = PartialViewToString("UC/Email/PurchaseToSupplier"); mailTo.Add(it.ContactEmail); // send email } IsSend = OnSendByAlertEmail(Subject, mailFrom, mailTo, mailCC, Detail); #endregion } }
public ActionResult BlogDetail(int id, int BlogID) { if (RedirectToProduction()) { return(Redirect(UrlProduction)); } string page = "Blog"; int countcompany = DefaultWebsite(id, page); if (countcompany > 0) { svArticle = new ArticleService(); svCompany = new CompanyService(); string sqlSelect = "ArticleID, ArticleName, ImgPath, Description, CompID, ViewCount"; string sqlWhere = "IsDelete = 0 AND ArticleID = " + BlogID; var count = svArticle.CountData <b2bArticle>(sqlSelect, sqlWhere); if (count > 0) { AddViewCount(BlogID, "Blog"); GetStatusUser(); var article = svArticle.SelectData <b2bArticle>(sqlSelect, sqlWhere).First(); ViewBag.Article = article; sqlSelect = "ArticleID, ArticleName ,CompID"; sqlWhere = "IsDelete = 0 AND CompID = " + id; var emArticles = svArticle.SelectData <b2bArticle>(sqlSelect, sqlWhere); ViewBag.emArticles = emArticles; ViewBag.blogtitle = article.ArticleName + " " + ViewBag.WebCompName + "-B2BThai.com"; string sqlSelect_comp = "CompID,CompName,CompCode,CompLevel,LogoImgPath,CompAddrLine1,CompPostalCode,CompPhone,CompImgPath,CompShortDes,CompSubDistrict,CompDistrictName,CompProvinceName,ContactEmail,BizTypeOther,BizTypeName,CreatedDate,ServiceType"; string sqlWhere_comp = "CompID =" + id; var company = svCompany.SelectData <view_Company>(sqlSelect_comp, sqlWhere_comp).First(); ViewBag.Company = company; ViewBag.PageType = "Blog"; var articles = svCompany.SelectData <view_b2bArticle>(sqlSelect, sqlWhere).First(); ViewBag.BlogArticles = articles; ViewBag.PageType = "BlogDetail"; GetStatusUser(); if (company.ProvinceName == "กรุงเทพมหานคร") { company.ProvinceName = "กรุงเทพ"; } ViewBag.title = articles.ArticleName + " | " + company.CompName + " | " + company.ProvinceName + " | " + res.Common.lblDomainShortName; ViewBag.MetaDescription = articles.ArticleName + " | " + company.CompName + " | " + company.CompAddrLine1 + " | " + company.ProvinceName; ViewBag.MetaKeyword = ViewBag.title; return(View()); } else { return(Redirect(res.Pageviews.PvNotFound)); } } else { return(Redirect(res.Pageviews.PvNotFound)); } }
public ActionResult Channel2(string ID, string Comp) { if (RedirectToProduction()) { return(Redirect(UrlProduction)); } GetStatusUser(); ViewBag.EnumServiceType = svCommon.SelectEnum(CommonService.EnumType.SearchByServiceType); ViewBag.QtyUnits = svCommon.SelectEnum(CommonService.EnumType.QtyUnits); string SqlSelect, SqlWhere = ""; #region Prepare Edit Buylead int BuyleadID = Convert.ToInt32(ID); int CompID = Convert.ToInt32(Comp); if (LogonCompID > 0) { if (BuyleadID > 0) { if (CompID != LogonCompID) { return(Redirect(res.Pageviews.PvMemberSignIn)); } var Buylead = svBuylead.SelectData <b2bBuylead>(" * ", "BuyleadID=" + ID, null, 1, 1).First(); ViewBag.Buylead = Buylead; ViewBag.BuyleadCode = Buylead.BuyleadCode; ViewBag.Catename = svCategory.SearchCategoryByID((int)Buylead.CateLV3); } else { #region query Company var svCompany = new CompanyService(); var QueryComp = svCompany.SelectData <view_Company>("*", "CompID=" + LogonCompID, "", 1, 1, false).First(); ViewBag.QueryComp = QueryComp; ViewBag.BuyleadCode = GenCode(LogonCompID); #endregion } } else { if (BuyleadID > 0) { RememberURL(); if (!CheckIsLogin()) { return(Redirect(res.Pageviews.PvMemberSignIn)); } } else { ViewBag.BuyleadCode = GenCode(0); } } #endregion //switch (res.Common.lblWebsite) //{ // case "B2BThai": sqlwherein = " AND CategoryType IN (1,2)"; break; // case "AntCart": sqlwherein = " AND CategoryType IN (3)"; break; // case "myOtopThai": sqlwherein = " AND CategoryType IN (5)"; break; // case "AppstoreThai": sqlwherein = " AND CategoryType IN (6)"; break; // default: sqlwherein = ""; break; //} #region Category var cates1 = svCategory.GetCategoryByLevel(1); var cates2 = svCategory.GetCategoryByLevel(2); var cates3 = svCategory.GetCategoryByLevel(3); ViewBag.Category = cates1; #endregion #region query District And Province ViewBag.QueryDistrict = svAddress.ListDistrictByProvinceID(0); ViewBag.QueryProvince = svAddress.GetProvinceAll(); #endregion #region FindCateAll ViewBag.SelectCateLV1 = cates1; ViewBag.SelectCateLV2 = cates2; ViewBag.SelectCateLV3 = cates3; #endregion #region query Buylead #region Set ViewBag ViewBag.BuyleadID = BuyleadID; ViewBag.CompID = CompID; ViewBag.CateID = 0; ViewBag.ProvinceID = 0; ViewBag.CreatedDate = 0; ViewBag.BuyleadExpDate = 0; ViewBag.BuyleadType = 0; ViewBag.PageIndex = 1; ViewBag.PageSize = 20; #endregion #endregion return(View()); }
public void Init() { TestUtils utils = new TestUtils(); companyService = (CompanyService) user.GetService(DfpService.v201511.CompanyService); testCompany1 = utils.CreateCompany(user, CompanyType.ADVERTISER); testCompany2 = utils.CreateCompany(user, CompanyType.ADVERTISER); }
public async Task <IHttpActionResult> RegisterIotUser([FromBody] UserRegisterIotModel user) { if (ModelState.IsValid) { try { var result = await SysUserService.AddAsync(new SysUserDto() { LoginName = user.LoginName, UserName = user.Name, Password = user.Password, Email = user.Email, SysRoleSerialnum = user.RoleCode, SysDepartmentSerialnum = user.DepartmentCode, Status = 0, CreateTime = DateTime.Now }); if (result > 0) { //添加企业 var company = new CompanyDto { Serialnum = user.DepartmentCode + "", //todo 生成企业编码 Name = user.CompanyName, Addr = user.Location, Status = 0, CreateTime = DateTime.Now, SysDepartmentSerialnum = user.DepartmentCode, ContactMan = user.Name, ContactPhone = user.Mobile }; var companyInsertResult = await CompanyService.AddAsync(company); if (companyInsertResult > 0) { //添加基地 var farm = new FarmDto(); farm.Serialnum = company.Serialnum; farm.APIKey = Guid.NewGuid().ToString(); farm.UploadPassword = "******"; //上传密码应随机生成 farm.Name = company.Name + "-默认基地"; farm.CompanySerialnum = company.Serialnum; farm.Address = company.Addr; farm.ContactMan = user.Name; farm.ContactPhone = user.Mobile; farm.Status = false; farm.SysDepartmentSerialnum = user.DepartmentCode; await FarmService.AddAsync(farm); } else { ModelState.AddModelError("farm", "默认基地生成失败"); } } else { ModelState.AddModelError("company", "企业添加失败"); } } catch (AggregateException ex) { if (ex.InnerExceptions.Any()) { ex.InnerExceptions.ForEach(e => { ModelState.AddModelError(e.HResult.ToString(), e); }); } } } else { ModelState.AddModelError("user", "用户添加失败"); } return(new ApiV1Result(ModelState.IsValid ? ResultMessageType.Success : ResultMessageType.InternalError, ModelState.ToString(), null)); }
public CompanyController(ILogger <CompanyController> logger, IOptions <Settings> settings) : base(logger) { var repository = new CompanyRepository(settings); _companyService = new CompanyService(repository); }
public ActionResult Create() { //int Empid = 0; //if (Url.RequestContext.RouteData.Values["id"].ToString() != null) //{ // Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString()); //} int cid = 0; if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } List <VehicleItem> lstVehicle = new List <VehicleItem>(); VehicleMasterService objVehicle = new VehicleMasterService(); lstVehicle = objVehicle.VehicleListData("Active", cid); VehicleItem objVehicleItem = new VehicleItem(); objVehicleItem.ListVehicle = new List <VehicleItem>(); objVehicleItem.ListVehicle.AddRange(lstVehicle); List <VehicleTypeModel> lstVType = new List <VehicleTypeModel>(); lstVType = objVehicle.getActiveVType(); objVehicleItem.ListVType = new List <VehicleTypeModel>(); objVehicleItem.ListVType.AddRange(lstVType); //#region Bind DropDown comp List <CompanyItem> objCompany = new List <CompanyItem>(); CompanyService objListCompany = new CompanyService(); objCompany = objListCompany.GetALL(); objVehicleItem.ListCompany = new List <CompanyItem>(); objVehicleItem.ListCompany.AddRange(objCompany); if (Session["CompID"] != null) { cid = Convert.ToInt32(Session["CompID"].ToString()); } //#endregion #region Bind DropDown Branch List <BranchItem> lstBranch = new List <BranchItem>(); lstBranch = objVehicle.GetBranch(); objVehicleItem.ListBranch = new List <BranchItem>(); objVehicleItem.ListBranch.AddRange(lstBranch); #endregion #region Bind DropDown Emp List <EmployeeItem> lstEmp = new List <EmployeeItem>(); lstEmp = objVehicle.GetEmp(cid); objVehicleItem.ListEmp = new List <EmployeeItem>(); objVehicleItem.ListEmp.AddRange(lstEmp); #endregion PetrolCardService objPCard = new PetrolCardService(); PetrolCardItem objPCardItem = new PetrolCardItem(); #region DDL PaymentType List <clsMasterData> lstMasters1 = new List <clsMasterData>(); lstMasters1 = objPCard.GetPaymentType(); objPCardItem.ListMaster = new List <clsMasterData>(); objPCardItem.ListMaster.AddRange(lstMasters1); objVehicleItem.ListMasterTablePayment = objPCardItem.ListMaster; #endregion #region DDL PCardType List <clsMasterData> lstMasters = new List <clsMasterData>(); lstMasters = objPCard.GetPCardType(); objPCardItem.ListMaster1 = new List <clsMasterData>(); objPCardItem.ListMaster1.AddRange(lstMasters); objVehicleItem.ListMasterTableCard = objPCardItem.ListMaster1; #endregion ViewBag.Menuid = Request.QueryString["menuId"]; return(View(objVehicleItem)); }
public async Task <IActionResult> Create(CompanyModel company) { var newCompany = await CompanyService.CreateCompanyAsync(company.Name, company.Slug); return(Ok(new { CompanyId = newCompany.Id })); }
public CompaniesController(CompanyService companyService) { _companySerivce = companyService; }
public AccountController() { _companyService = new CompanyService(); }