public static DataTable ExecuteReader(BusinessModel mdl) { DataTable dt = new DataTable(); using (SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["PPFConnectionString"].ToString())) { cn.Open(); SqlCommand cm = new SqlCommand(mdl.StoredProcedureName.ToString(), cn); cm.CommandType = CommandType.StoredProcedure; SqlCommandBuilder.DeriveParameters(cm); foreach (SqlParameter p in cm.Parameters) { if (p.Direction == ParameterDirection.Input || p.Direction == ParameterDirection.InputOutput) { foreach (PropertyInfo pi in mdl.GetType().GetProperties()) { if (p.ParameterName.ToLower().Replace("@", "") == pi.Name.ToLower()) { p.Value = FormatObject(p, pi.GetValue(mdl, null)); break; } } } } if (ConfigurationManager.AppSettings["OutputSqlCommandParameter"] == "1") { Utility.OutputWindow.Write.SQLParameter(cm); } dt.Load(cm.ExecuteReader()); } return dt; }
public static BusinessModel GetClosestBusiness(Client player, float distance = 2.0f) { BusinessModel business = null; foreach (BusinessModel businessModel in businessList) { if (player.Position.DistanceTo(businessModel.position) < distance) { business = businessModel; distance = player.Position.DistanceTo(business.position); } } return(business); }
public ActionResult MyBusiness() { if (!CommonFile.IsUserAuthenticate(this.ControllerContext.HttpContext)) { return(RedirectToAction("Index", "Login")); } var listProfession = CommonFile.GetProfession(); ViewBag.ProfessionList = new SelectList(listProfession, "Id", "Name"); bindCountryStateCity(); BusinessModel objModel = new BusinessModel(); return(View(objModel)); }
public void OnPlayerDeath(Client player, Client killer, uint weapon) { if (player.GetData(EntityData.PLAYER_KILLED) == 0) { DeathModel death = new DeathModel(player, killer, weapon); Vector3 deathPosition = null; string deathPlace = string.Empty; string deathHour = DateTime.Now.ToString("h:mm:ss tt"); // Checking if player died into a house or business if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0) { int houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED); HouseModel house = House.GetHouseById(houseId); deathPosition = house.position; deathPlace = house.name; } else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0) { int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED); BusinessModel business = Business.GetBusinessById(businessId); deathPosition = business.position; deathPlace = business.name; } else { deathPosition = player.Position; } // We add the report to the list FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour); Faction.factionWarningList.Add(factionWarning); // Report message string warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1); // Sending the report to all the emergency department's members foreach (Client target in NAPI.Pools.GetAllPlayers()) { if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && target.GetData(EntityData.PLAYER_ON_DUTY) > 0) { target.SendChatMessage(Constants.COLOR_INFO + warnMessage); } } // Create the emergency report CreateEmergencyReport(death); } }
public static BusinessModel GetBusinessById(int businessId) { BusinessModel business = null; foreach (BusinessModel businessModel in businessList) { if (businessModel.id == businessId) { business = businessModel; break; } } return(business); }
/// <summary> /// /// </summary> /// <param name="fantasyName"></param> /// <param name="societyName"></param> /// <param name="legalCertification"></param> /// <param name="telephone"></param> /// <param name="mainAddress"></param> /// <param name="generalAddress"></param> /// <param name="email"></param> /// <param name="webPage"></param> /// <param name="logo"></param> /// <returns></returns> public static bool InsertBusiness( string fantasyName, string societyName, string legalCertification, string telephone, string mainAddress, string generalAddress, string email, string webPage, byte[] logo ) { try { string[] business = new string[] { fantasyName, societyName, legalCertification, telephone, mainAddress, generalAddress, email, webPage }; if (ValidateData.VerifyFields(business)) { BusinessModel businessModel = new BusinessModel() { FantasyName = fantasyName, SocietyName = societyName, LegalCertification = legalCertification, Telephone = telephone, MainAddress = mainAddress, GeneralAddress = generalAddress, Email = email, WebPage = webPage, Logo = logo }; return(DBBusiness.InsertBusiness(businessModel)); } else { return(false); } } catch (Exception ex) { //Log4Net return(false); } }
public decimal CalculateTotalPrice(BusinessModel businessModel) { foreach (DrumBO drum in businessModel.drumList) { businessModel.CartTotal = businessModel.CartTotal + (drum.DrumPrice * drum.CheckoutQty); } foreach (CymbalBO cymbal in businessModel.cymbalList) { businessModel.CartTotal = businessModel.CartTotal + (cymbal.CymbalPrice * cymbal.CheckoutQty); } return(businessModel.CartTotal); }
public void ClothesItemSelectedEvent(Client player, int clothesId, int type, int slot) { int businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED); int sex = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_SEX); int products = GetClothesProductsPrice(clothesId, sex, type, slot); BusinessModel business = GetBusinessById(businessId); int price = (int)Math.Round(products * business.multiplier); // We check whether the player has enough money int playerMoney = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_MONEY); if (playerMoney >= price) { int playerId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_SQL_ID); // Substracting paid money NAPI.Data.SetEntitySharedData(player, EntityData.PLAYER_MONEY, playerMoney - price); // We substract the product and add funds to the business if (business.owner != String.Empty) { business.funds += price; business.products -= products; Database.UpdateBusiness(business); } // Undress previous clothes Globals.UndressClothes(playerId, type, slot); // We make the new clothes model ClothesModel clothesModel = new ClothesModel(); clothesModel.player = playerId; clothesModel.type = type; clothesModel.slot = slot; clothesModel.drawable = clothesId; clothesModel.dressed = true; // Storing the clothes into database clothesModel.id = Database.AddClothes(clothesModel); Globals.clothesList.Add(clothesModel); // Confirmation message sent to the player String purchaseMessage = String.Format(Messages.INF_BUSINESS_ITEM_PURCHASED, price); NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + purchaseMessage); } else { NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_ENOUGH_MONEY); } }
public async Task <bool> CreateBusiness(BusinessModel model) { _dbcontext.Set <Company>().Add(new Company { Name = model.BusinessCode, BusinessName = model.BusinessName, CorporateId = model.CorporateId, Code = model.Description }); int count = await _dbcontext.SaveChangesAsync(); return(count > 0); }
/// <summary> Process this. </summary> /// /// <remarks> Ken, 10/4/2020. </remarks> /// /// <param name="entityDomainModel"> The entity domain model. </param> /// <param name="businessModel"> The business model. </param> /// <param name="appUIHierarchyNodeObject"> The application UI hierarchy node object. </param> /// <param name="appSettingsObjects"> The application settings objects. </param> /// <param name="projectType"> Type of the project. </param> /// <param name="projectFolderRoot"> The project folder root. </param> /// <param name="generatorConfiguration"> The generator configuration. </param> /// /// <returns> True if it succeeds, false if it fails. </returns> public bool Process(EntityDomainModel entityDomainModel, BusinessModel businessModel, AppUIHierarchyNodeObject appUIHierarchyNodeObject, Dictionary <AppSettingsKind, BusinessModelObject> appSettingsObjects, Guid projectType, string projectFolderRoot, IGeneratorConfiguration generatorConfiguration) { var globalSettingsObject = appSettingsObjects[AppSettingsKind.GlobalSettings]; var userPreferencesObject = appSettingsObjects[AppSettingsKind.UserPreferences]; var appSettingsEntityObject = new EntityObject() { Name = appUIHierarchyNodeObject.Name + "Settings", ParentDataItem = globalSettingsObject.Id, Attributes = new List <AttributeObject>() { new AttributeObject { Name = "Setting", AttributeType = "string", }, new AttributeObject { Name = "Setting Type", AttributeType = "string", }, new AttributeObject { Name = "Setting Value", AttributeType = "string", }, new AttributeObject { Name = "Allow User Customize", AttributeType = "bool", }, new AttributeObject { Name = "Reset Customization", AttributeType = "bool", } }, Properties = new List <EntityPropertyItem>() { new EntityPropertyItem { PropertyName = "AppSettingsKind", PropertyValue = AppSettingsKind.GlobalSettings.ToString() } } }; globalSettingsObject.UIHierarchyNodeObject.Entities.Add(appSettingsEntityObject); userPreferencesObject.UIHierarchyNodeObject.Entities.Add(appSettingsEntityObject.Shadow()); appUIHierarchyNodeObject.AllEntities.Add(appSettingsEntityObject); return(true); }
public Business ModelToEntityByAccountId(BusinessModel model) { var entity = this.Db.GetBusinessByAccountId(model.AccountId); if (entity != null) { entity.BusinessName = Utilities.Trim(model.BusinessName); entity.AccountId = Utilities.Trim(model.AccountId); entity.BusinessTypeId = (BusinessTypeEnum)model.BusinessTypeId; } return(entity); }
public ActionResult Details(Guid businessId, String businessName, String message) { BusinessModel businessModel = new BusinessModel(this.AccountBase, businessId); if (businessModel.IsValid) { this.AccountBase.SetupActionAccount(); return(View(businessModel)); } else { this.AccountBase.SetupActionAccount(); return(View()); } }
public void GetClothesByTypeEvent(Client player, int type, int slot) { int sex = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_SEX); List <BusinessClothesModel> clothesList = GetBusinessClothesFromSlotType(sex, type, slot); if (clothesList.Count > 0) { BusinessModel business = GetBusinessById(NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED)); NAPI.ClientEvent.TriggerClientEvent(player, "showTypeClothes", NAPI.Util.ToJson(clothesList)); } else { NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_BUSINESS_CLOTHES_NOT_AVAILABLE); } }
public void GetClothesByTypeEvent(Client player, int type, int slot) { int sex = player.GetData(EntityData.PLAYER_SEX); List <BusinessClothesModel> clothesList = GetBusinessClothesFromSlotType(sex, type, slot); if (clothesList.Count > 0) { BusinessModel business = GetBusinessById(player.GetData(EntityData.PLAYER_BUSINESS_ENTERED)); player.TriggerEvent("showTypeClothes", NAPI.Util.ToJson(clothesList)); } else { player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.business_clothes_not_available); } }
/// <summary> /// Delete a business from business /// </summary> /// <param name="Business"></param> public static bool DeleteBusiness(BusinessModel Business) { try { using (IDbConnection cnn = new MySqlConnection(LoadConnectionString())) { cnn.Execute("DELETE FROM business WHERE idBusiness = @idBusiness", Business); } return(true); } catch (Exception ex) { throw; } }
// GET: Business/Details/5 public async Task <ActionResult> Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BusinessModel businessModel = await db.BusinessModels.FindAsync(id); if (businessModel == null) { return(HttpNotFound()); } return(View(businessModel)); }
public ActionResult Edit(BusinessModel businessModel) { if (businessModel.ShopID == 0) { businessModel = new BusinessModel(); int shopId = Convert.ToInt32(Request.QueryString["id"]); var shopInfo = ShopInfoBLL.GetInstance().GetAdminSingle(shopId); businessModel.ShopID = shopId; businessModel.ShopTitle = shopInfo.ShopTilte; businessModel.ShopPrice = shopInfo.ShopPrice.ToString(); businessModel.ShopDisc = shopInfo.ShopDisc; businessModel.ShopArea = shopInfo.ShopArea.ToString(); businessModel.PublishTime = shopInfo.PublishTime.ToString(); businessModel.BusinessID = shopInfo.BusinessID; var publisher = PublisherInfoBLL.GetInstance().GetAdminSingle(shopId); if (publisher != null) { businessModel.UserName = publisher.UserName; businessModel.Mobile = publisher.UserMobile; } } else { var shopInfo = ShopInfoBLL.GetInstance().GetAdminSingle(businessModel.ShopID); if (shopInfo != null) { shopInfo.ShopTilte = businessModel.ShopTitle; shopInfo.ShopDisc = businessModel.ShopDisc; shopInfo.BusinessID = businessModel.BusinessID; shopInfo.ModifyStatus = 2; shopInfo.UpdateTime = DateTime.Now; ShopInfoBLL.GetInstance().Update(shopInfo); } var publisher = PublisherInfoBLL.GetInstance().GetAdminSingle(businessModel.ShopID); if (publisher != null) { publisher.UserName = businessModel.UserName; publisher.UserMobile = businessModel.Mobile; PublisherInfoBLL.GetInstance().Update(publisher); } return(RedirectToAction("List", "Business")); } return(View(businessModel)); }
public void UpdateParentBusiness(BusinessModel model) { if (model.BusinessId.Value != model.ParentBusinessId) { BusinessLink entity = businessLinkService.GetBusinessLinkByBusinessId(model.BusinessId.Value); if (entity == null) { this.Db.BusinessLinkCreate(model.BusinessId.Value, model.ParentBusinessId); } else { entity.ParentBusinessId = model.ParentBusinessId; this.Context.Entry(entity).State = EntityState.Modified; } } }
private bool verifyDimensions(BusinessModel item) { bool result = false; Validators ValObj = GetValidator(item.Name); int voulme = Convert.ToInt32(item.Length) * Convert.ToInt32(item.Width) * Convert.ToInt32(item.Height); if (voulme > ValObj.MinVolume && voulme < ValObj.MaxVolume && Convert.ToDouble(item.Weight) < ValObj.MaxWeight) { //&& // Convert.ToBoolean(item.IsFragile) == ValObj.AcceptFragile) result = true; } return(result); }
public ActionResult Edit(int id, BusinessModel businesstModel) { if (ModelState.IsValid) { var businesstParameters = GetCreateOrEditParameters(businesstModel); BusinessCommand.Edit(id, businesstParameters); AddModelSuccess(Translations.EditSuccess.FormatWith(TranslationsHelper.Get <Business>())); return(RedirectToAction("Index")); } else { return(View(businesstModel)); } }
public async Task <BusinessForm> UpdateBusinessAsync(BusinessModel model) { if ((await GetById(model.Id)) is null) { throw new ArgumentException("Cannot locate business"); } var item = DataMapper.Map <Business, BusinessModel>(model); if (item.Status != RegistrationStatus.Start && string.IsNullOrEmpty(item.Code)) { item.Code = GetRandomString(); } await Task.Run(() => repo.Update(item)); return(DataMapper.Map <BusinessForm, Business>(item)); }
public IActionResult GetAddYourStaff(BusinessModel businessModel, int code) { if (CheckModelState(businessModel)) { return(RedirectToAction("NewBusiness")); } businessModel.StaffCollection = new List <StaffModel>(); for (var i = 0; i < businessModel.CountStaff; i++) { businessModel.StaffCollection.Add(new StaffModel()); } _logger.Log(LogLevel.Information, $"GetAddYourStaff {businessModel}"); return(View("AddYourStaff", businessModel)); }
// public IHttpActionResult Registeration(RequestModel requestModel) public IHttpActionResult GetBusiness(RequestModel requestModel) { var data = requestModel.Data; BusinessModel objBusinessModel = JsonConvert.DeserializeObject <BusinessModel>(data); var sendResponse = new ResponseModel() { Response = JsonConvert.SerializeObject(userServices.GetUserbusiness(objBusinessModel)), Success = true }; var sendJson = Json(sendResponse); return(sendJson); }
public void ChangeHairStyleEvent(Client player, string skinJson) { int playerMoney = player.GetSharedData(EntityData.PLAYER_MONEY); int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED); BusinessModel business = GetBusinessById(businessId); int price = (int)Math.Round(business.multiplier * Constants.PRICE_BARBER_SHOP); if (playerMoney >= price) { int playerId = player.GetData(EntityData.PLAYER_SQL_ID); // Getting the new hairstyle from the JSON SkinModel skinModel = NAPI.Util.FromJson <SkinModel>(skinJson); // Saving new entity data player.SetData(EntityData.PLAYER_SKIN_MODEL, skinModel); // Substract money to the player player.SetSharedData(EntityData.PLAYER_MONEY, playerMoney - price); Task.Factory.StartNew(() => { // We update values in the database Database.UpdateCharacterHair(playerId, skinModel); // We substract the product and add funds to the business if (business.owner != string.Empty) { business.funds += price; business.products -= Constants.PRICE_BARBER_SHOP; Database.UpdateBusiness(business); } // Delete the browser player.TriggerEvent("destroyBrowser"); // Confirmation message sent to the player string playerMessage = string.Format(InfoRes.haircut_purchased, price); player.SendChatMessage(Constants.COLOR_INFO + playerMessage); }); } else { // The player has not the required money string message = string.Format(ErrRes.haircut_money, price); player.SendChatMessage(Constants.COLOR_ERROR + message); } }
public async Task <IActionResult> Update([FromRoute] Guid id, [FromBody] BusinessModel model) { try { var response = await _service.Update(model); if (!response.IsSuccessful) { return(BadRequest(response)); } return(Ok(response)); } catch { return(StatusCode(500, "Internal Server Error.")); } }
/// <summary> Process this. </summary> /// /// <remarks> Ken, 10/4/2020. </remarks> /// /// <param name="entityDomainModel"> The entity domain model. </param> /// <param name="businessModel"> The business model. </param> /// <param name="appUIHierarchyNodeObject"></param> /// <param name="appSettingsObjects"> The application settings objects. </param> /// <param name="projectType"> Type of the project. </param> /// <param name="projectFolderRoot"> The project folder root. </param> /// <param name="generatorConfiguration"> The generator configuration. </param> /// /// <returns> True if it succeeds, false if it fails. </returns> public bool Process(EntityDomainModel entityDomainModel, BusinessModel businessModel, AppUIHierarchyNodeObject appUIHierarchyNodeObject, Dictionary <AppSettingsKind, BusinessModelObject> appSettingsObjects, Guid projectType, string projectFolderRoot, IGeneratorConfiguration generatorConfiguration) { var profilePreferencesObject = appSettingsObjects[AppSettingsKind.ProfilePreferences]; var userObject = businessModel.GetDescendants().Single(o => o.Id == profilePreferencesObject.ShadowItem); var userEntity = userObject.UIHierarchyNodeObject.Entities.Single(e => e.HasIdentityEntityKind(IdentityEntityKind.User)); foreach (var attribute in userEntity.Attributes.Where(a => a.HasIdentityFieldKind(IdentityFieldKind.Client) || a.HasIdentityFieldKind(IdentityFieldKind.PasswordHash))) { attribute.Properties.Add(new EntityPropertyItem { PropertyName = "AllowUserEdit", PropertyValue = "true" }); } return(true); }
public async Task <BusinessModel> UpdateBusiness(int businessId, BusinessModel businessModel) { var businessEntity = _mapper.Map <BusinessEntity>(businessModel); await GetBusiness(businessId); businessEntity.Id = businessId; _libraryRepository.UpdateBusiness(businessEntity); var saveResult = await _libraryRepository.SaveChangesAsync(); if (!saveResult) { throw new Exception("Database Error"); } return(businessModel); }
public Listing(BusinessModel business) { Id = business.Id; PartitionKey = business.PartitionKey; BusinessName = business.Name; BusinessType = EnumUtils.GetValue <BusinessType>(business.Category); Hours = EnumUtils.GetValue <BusinessHoursType>(business.Hours); GiftCardUrl = business.GiftCardUrl; Website = business.Website; PhoneNumber = business.PhoneNumber; LivestreamURL = business.LiveStreamUrl; OrderURL = business.OrderUrl; MessageToCustomer = business.Message; Address = business.Address; BusinessChannels = EnumUtils.GetEnumFlag <BusinessChannelType>(business.Interactions); DeliveryApps = EnumUtils.GetEnumFlag <DeliveryAppType>(business.DeliveryApps); }
private BusinessCommand.CreateOrEditParameters GetCreateOrEditParameters(BusinessModel businesstModel) { var businesstParameters = new BusinessCommand.CreateOrEditParameters { Name = businesstModel.Name, Cuit = businesstModel.Cuit, Number = businesstModel.Number, City = businesstModel.City, Province = businesstModel.Province, Street = businesstModel.Street, Zip = businesstModel.Zip, FloorAndDepartament = businesstModel.FloorAndDepartament, }; return(businesstParameters); }
public async Task <bool> UpdateBusiness(BusinessModel model) { var business = await _dbcontext.Set <Company>().FindAsync(model.Id); if (business == null) { throw new BadRequestException("Business can not be found"); } business.Code = model.Description; business.BusinessName = model.BusinessName; business.Name = model.BusinessCode; int count = await _dbcontext.SaveChangesAsync(); return(count > 0); }
public void ClothesSlotSelectedEvent(Client player, params object[] arguments) { int type = Int32.Parse(arguments[0].ToString()); int slot = Int32.Parse(arguments[1].ToString()); int sex = NAPI.Data.GetEntitySharedData(player, EntityData.PLAYER_SEX); List <BusinessClothesModel> clothesList = GetBusinessClothesFromSlotType(sex, type, slot); if (clothesList.Count > 0) { BusinessModel business = GetBusinessById(NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED)); NAPI.ClientEvent.TriggerClientEvent(player, "showClothesFromSelectedType", NAPI.Util.ToJson(clothesList), business.multiplier); } else { NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_BUSINESS_CLOTHES_NOT_AVAILABLE); } }
// Data to model. public static BusinessModel Map( Business data ) { BusinessModel model = null; if (data != null) { model = new BusinessModel { Address = data.Address, Category = data.Category, City = data.City, Id = data.Id, Latitude = data.Latitude, Longitude = data.Longitude, Name = data.Name, PhoneNumber = data.PhoneNumber, State = data.State, }; } return model; }
public ActionResult Portfolio() { var portfilio = new BusinessModel().GetPortfolio(); return View(portfilio); }
public ActionResult BlogItem(int Id) { var blog = new BusinessModel().GetSingleBlog(Id); return View(blog); }
public ActionResult Blog() { var blog = new BusinessModel().GetBlog(); return View(blog); }