/// <summary> /// Populate the encounter list with all posible encounters /// </summary> public void PopulateEncounterList() { Sprite sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_suicune.png"); PokemonStats stats = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Suicune.asset"); List <MoveModel> moves = new List <MoveModel>(); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Bubble-beam.asset"))); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset"))); AgentModel model = new AgentModel(sprite, stats, moves); EncounterList.Add(model); moves.Clear(); sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_sneasel_front.png"); stats = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Sneasel.asset"); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Slash.asset"))); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset"))); model = new AgentModel(sprite, stats, moves); EncounterList.Add(model); moves.Clear(); sprite = AssetDatabase.LoadAssetAtPath <Sprite>("Assets/Sprite/pkmgsc_geodude_front.png"); stats = AssetDatabase.LoadAssetAtPath <PokemonStats>("Assets/Scriptable Objects/Pokemon Definitions/Geodude.asset"); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Rock-throw.asset"))); moves.Add(new MoveModel(AssetDatabase.LoadAssetAtPath <MoveDefinition>("Assets/Scriptable Objects/Move Definitions/Growl.asset"))); model = new AgentModel(sprite, stats, moves); EncounterList.Add(model); }
public ActionResult Edit(int?id) { _model = _rep.Detail(id, out _res); TempData["InfoMessage"] = _res.ActionMessage; if (_res.ErrNumber == 0) { ViewData["AgentBank"] = _agentdetailsprovider.GetAgentBankList(id.Value); foreach (var AsociatedProductOfAgent in _model.AgentProductList) { ViewData[AsociatedProductOfAgent.ProductName] = new SelectList(_rep.GetAllRolesListonProductWise(AsociatedProductOfAgent.ProductId), "RoleName", "RoleName", ""); } ViewData["Countrylist"] = new SelectList(_rep.GetCountry(), "CountryId", "CountryName", _rep.GetCountryInfo(_model.NativeCountryId)); ViewData["AgentZone"] = new SelectList(_rep.GetZoneList(), "ZoneId", "ZoneName", _model.ZoneId); ViewData["AgentDistrict"] = new SelectList(_rep.GetDistrictListbyZoneId(_model.ZoneId), "DistrictId", "DistrictName", _model.DistrictId); ViewData["Status"] = new SelectList(_rep.GetStatus(), "id", "Name"); ViewData["AgentTypes"] = new SelectList(_rep.GetAgentType(), "AgentTypeId", "AgentTypeName", _model.AgentTypeId); //ViewData["agentClass"] = new SelectList(_rep.GetAgentClass(), "AgentClassId", "AgentClassName", _model.AgentClassId); ViewData["Banks"] = new SelectList(_rep.GetbankInformation(), "BankId", "BankName"); ViewData["BankBranches"] = new SelectList(_rep.GetbankBranchInformation(), "BankBranchId", "BranchName"); ViewData["BankAccountTypes"] = new SelectList(_rep.GetbankAccountType(), "BankAccountTypeId", "AccountTypeName"); ViewData["TimeZones"] = new SelectList(_rep.GetTimeZoneList(), "RecordID", "StandardName"); _model.ReferredByList = _rep.GetAllGetSalesAgentList(); _model.MEsNameList = _rep.GetAllGetSalesAgentList(); return(View(_model)); } else { return(RedirectToAction("Index")); } }
/// <summary> /// 今日稼いだ経験値を表示 /// </summary> /// <returns></returns> public void OnGUI() { if (enableMalkutNotes && AgentInfoWindow.currentWindow != null && AgentInfoWindow.currentWindow.IsEnabled && GameManager.currentGameManager.state != GameState.STOP) { AgentModel target = AgentInfoWindow.currentWindow.CurrentAgent; if (target != null) { var width = 300.0f; var labelHeight = 20.0f; var x = Screen.width - 300.0f; var y = 270.5f + 55; GUI.Box(new Rect(x, y, width, 200.0f), "Malkut Notes"); string[] value = new string[] { target.name + " EXP acquired today", "===========", "Hp:" + target.primaryStatExp.hp, "mental:" + target.primaryStatExp.mental, "work:" + target.primaryStatExp.work, "battle:" + target.primaryStatExp.battle, }; for (int i = 0; i < value.Length; i++) { y += labelHeight; GUI.Label(new Rect(x, y, width, 20.0f), value[i]); } } } }
private void SetGroup(AgentModel agentModel) { KeyId = agentModel.KeyId; AccessId = agentModel.AccessId; FirstName = agentModel.FirstName; LastName = agentModel.LastName; }
public IHttpActionResult Post([FromBody] AgentModel model) { try { Agent agent = Factory.Create(model); UnitOfWork.Agents.Insert(agent); UnitOfWork.Commit(); if (!WebSecurity.Initialized) { WebSecurity.InitializeDatabaseConnection("Billing.Database", "Agents", "Id", "Username", autoCreateTables: true); } WebSecurity.CreateAccount(agent.Username, "billing", false); Roles.AddUserToRole(agent.Username, "user"); return(Ok(Factory.Create(agent))); } catch (DbEntityValidationException ex) { Logger.Log(ex.Message); return(BadRequest(ErrorGeneratorMessage.Generate(ex))); } catch (Exception ex) { Logger.Log(ex.Message, "ERROR"); return(BadRequest(ex.Message)); } }
public ApiResponse Settings(string user_id, string business_id) { ApiResponse response = new ApiResponse(); var access_token = Request.Cookies["access_token"] ?? ""; AgentModel model = null; if (!string.IsNullOrWhiteSpace(user_id) && !string.IsNullOrWhiteSpace(access_token)) { var u = _appSettings.BaseUrls.Api + "brands/agents/single/" + user_id + "/?access_token=" + access_token; model = Core.Helpers.WebHelper.HttpGetAsync <AgentModel>(u).Result; } if (model == null) { return(response); } var url = _appSettings.BaseUrls.Api + "brands/agents/list/" + business_id + "/?access_token=" + access_token; var rs = Core.Helpers.WebHelper.HttpGetAsync <AgentFeed>(url).Result; if (rs == null || rs.Data == null) { return(response); } var result = _viewRenderService.RenderToStringAsync("Agent/Settings", new AgentSettings { admin = model.admin, user_id = model.id, business_id = business_id, Agents = rs.Data }).Result; response.view = result; response.ok = true; return(response); }
private void SwitchAgentType(AgentModel oldModel) { AgentModel newModel; switch (latestData.Item1.AgentType) { case AgentType.Agent: newModel = new AgentModel(oldModel.Name, oldModel.Namespace, oldModel.ConsumingMessages, oldModel.ProducedMessages, oldModel.IncomingEvents, oldModel.ProducedEvents, oldModel.Id); break; case AgentType.Interceptor: newModel = new InterceptorAgentModel(oldModel.Name, oldModel.Namespace, oldModel.ConsumingMessages, oldModel.ProducedMessages, oldModel.IncomingEvents, oldModel.ProducedEvents, oldModel.Id); break; default: throw new InvalidOperationException($"Agent type {latestData.Item1.AgentType} is not known."); } OnMessage(new ModificationRequest(latestData.Item2, new Modification(ModificationType.Change, oldModel, newModel, oldModel.ContainingPackage, new PackageAgentsProperty()))); }
private async Task Create(bool error = false) { if (error) { Error(); } Console.WriteLine(" Create "); Console.WriteLine("++++++++++++++"); Console.WriteLine(""); Console.WriteLine("Enter the agent name:"); var name = Console.ReadLine().Trim(); Console.WriteLine("Enter the agent contact number:"); var contact = Console.ReadLine().Trim(); //Make web call if (int.TryParse(contact, out int contactNumber)) { var request = new AgentModel { Name = name, ContactNumber = contactNumber }; var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new AgentManagerService.AgentManagerServiceClient(channel); var result = await client.CreateAsync(request); await PrintResults(result.Response); } }
private async Task Update(bool error = false) { if (error) { Error(); } Console.WriteLine(" Update "); Console.WriteLine("++++++++++++++"); Console.WriteLine(""); Console.WriteLine("Enter the agent ID# you wish to update:"); var idNumber = Console.ReadLine().Trim(); Console.WriteLine("Enter the new agent name:"); var name = Console.ReadLine().Trim(); Console.WriteLine("Enter the new agent contact number:"); var contact = Console.ReadLine().Trim(); //Make update web call if (int.TryParse(contact, out int contactNumber) && int.TryParse(idNumber, out int id)) { var request = new AgentModel { Id = id, Name = name.Trim(), ContactNumber = contactNumber }; var channel = GrpcChannel.ForAddress("https://localhost:5001"); var client = new AgentManagerService.AgentManagerServiceClient(channel); var reply = await client.UpdateAsync(request); await PrintResults(reply.Response); } }
public async Task <ActionResult> SaveAnswerForm(AgentModel model) { try { var answeredForms = new List <AnsweredForm>(); foreach (var item in model.Record.FormAnswers ?? new List <AnsweredFormModel>()) { if (item.CheckBoxAnswer != null) { foreach (var answer in item.CheckBoxAnswer.Where(x => x.Checked)) { answeredForms.Add(new AnsweredForm { RecordId = 1, Answer = answer.Answer, QuestionId = item.QuestionId, CreationDate = DateTime.Now, LastUpdate = DateTime.Now, IsDeleted = false }); } } else if (!String.IsNullOrEmpty(item.Answer)) { answeredForms.Add(new AnsweredForm { RecordId = 1, Answer = item.Answer, QuestionId = item.QuestionId, CreationDate = DateTime.Now, LastUpdate = DateTime.Now, IsDeleted = false }); } } if (answeredForms.Count > 0) { db.AnsweredForms.AddRange(answeredForms); } await db.SaveChangesAsync(); } catch (Exception e) { AddAlert($"Oops! something went wrong. Error code: {e.HResult}", "SaveForm", this.GetType().ToString(), AlertType.error, e); } if (model.Record.FormId > 0) { return(RedirectToAction("AnswerForm", new { id = model.Record.FormId })); } else { return(RedirectToAction("AnswerForm")); } }
//agent grid view cell click private void agentGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (agentGridView.CurrentRow != null) { selectedAgentModel = (AgentModel)agentGridView.CurrentRow.DataBoundItem; } }
public async Task getChatUserInformation() { _authenticatedAgent = new AgentModel { Agent = _main.Startup.Bl.BlSecurity.GetAuthenticatedUser() }; // load chat user await _main.AgentViewModel.loadAgents(); // close user images foreach (AgentModel agentModel in _main.AgentViewModel.AgentModelList) { if (agentModel.Image != null) { agentModel.Image.closeImageSource(); } } // download chat user's picture var ftpCredentials = _main.Startup.Bl.BlReferential.searchInfo(new Info { Name = "ftp_" }, QOBDCommon.Enum.ESearchOption.AND); foreach (AgentModel agentModel in _main.AgentViewModel.AgentModelList) { agentModel.Image = await Task.Factory.StartNew(() => { return(agentModel.Image.downloadPicture(ConfigurationManager.AppSettings["ftp_profile_image_folder"], ConfigurationManager.AppSettings["local_profile_image_folder"], agentModel.TxtPicture, agentModel.TxtProfileImageFileNameBase + "_" + agentModel.Agent.ID, ftpCredentials)); }); } DiscussionViewModel.ChatAgentModelList = _main.AgentViewModel.AgentModelList.Where(x => x.Agent.ID != _main.Startup.Bl.BlSecurity.GetAuthenticatedUser().ID).OrderByDescending(x => x.IsOnline).ToList(); AuthenticatedAgent.Image = _main.AgentViewModel.AgentModelList.Where(x => x.TxtID == AuthenticatedAgent.TxtID).Select(x => x.Image).SingleOrDefault(); Singleton.getDialogueBox().IsChatDialogOpen = false; }
public void OnDeleteSuppression(AgentModel actor) { SuppressAction suppressAction = null; foreach (SuppressAction ta in this.agentList) { if (actor == ta.model) { suppressAction = ta; break; } } if (suppressAction == null) { print("Error to founding agent"); return; } if (suppressAction.GetControllable() == false) { print("this agent cannot controllable"); return; } this.suppressingAgentList.Remove(suppressAction); }
public void Init(object target, TargetType type) { this.type = type; this.target = target; switch (type) { case TargetType.CREATURE: { CreatureModel model = target as CreatureModel; this.currentUi = creatureUi; agentUi.thisObject.SetActive(false); this.currentUi.Init(target); break; } case TargetType.AGENT: { AgentModel model = target as AgentModel; this.currentUi = agentUi; creatureUi.thisObject.SetActive(false); this.currentUi.Init(target); } break; case TargetType.OFFICER: { OfficerModel model = target as OfficerModel; this.currentUi = agentUi; creatureUi.thisObject.SetActive(false); this.currentUi.Init(target); } break; } }
public List <AgentModel> GetAgents() { List <AgentModel> agents = new List <AgentModel>(); using (SqlConnection conn = new SqlConnection(_connectionStringAdmin)) { conn.Open(); SqlCommand cmd = new SqlCommand("dbo.GetAgents", conn); cmd.CommandType = CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { AgentModel agent = new AgentModel(); agent.Id = reader["Id"] != DBNull.Value ? Convert.ToInt32(reader["Id"]) : 0; agent.Name = reader["Name"] != DBNull.Value ? Convert.ToString(reader["Name"]) : string.Empty; agent.Login = reader["Login"] != DBNull.Value ? Convert.ToString(reader["Login"]) : string.Empty; agent.Query = reader["Query"] != DBNull.Value ? Convert.ToInt32(reader["Query"]) : 0; agent.QueryCount = reader["QueryCount"] != DBNull.Value ? Convert.ToInt32(reader["QueryCount"]) : 0; agent.IsActive = reader["IsActive"] != DBNull.Value ? Convert.ToBoolean(reader["IsActive"]) : false; agent.IsTest = reader["IsTest"] != DBNull.Value ? Convert.ToBoolean(reader["IsTest"]) : false; agents.Add(agent); } } return(agents); }
// GET: Agents/Delete/5 public ActionResult Delete(int id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var a = es.GetById(id); AgentModel am = new AgentModel() { FirstName = a.FirstName, LastName = a.LastName, PhoneNumber = a.PhoneNumber, Type = a.Type, Heure_travail = a.Heure_travail }; if (a == null) { return(HttpNotFound()); } return(View(am)); //var a = es.GetById(id); //es.Delete(a); //es.Commit(); //return RedirectToAction("Index"); }
public string ModifyAgentInfo(AgentModel model) { StringBuilder strSql = new StringBuilder(); strSql.Append("select AgentPassword from Sys_I200.dbo.Sys_agent_mess where id=@id;"); string pwd = DapperHelper.ExecuteScalar <string>(strSql.ToString(), new { id = model.ID }); strSql.Clear(); if (model.AgentPassword != pwd) { model.AgentPassword = CommonLib.Helper.Md5Hash(model.AgentPassword); } strSql.Append("update Sys_I200.dbo.Sys_agent_mess set " + " AgentPassword=@pwd," + " AgentName=@name," + " AgentGrade=@grade," + " AgentPhone=@phone," + " AgentAddress=@address," + " AgentIdCard=@idCard," + " AgentNumber=@number," + " AgentEmail=@email," + " AgentQQ=@qq," + " Remark=@remark ," + " ServiceType=@serviceType " + " where id=@id"); try { int reVal = DapperHelper.Execute(strSql.ToString(), new { pwd = model.AgentPassword, name = model.AgentName, grade = model.AgentGrade, phone = model.AgentPhone, address = model.AgentAddress, idCard = model.AgentIdCard, number = model.AgentNumber, email = model.AgentEmail, qq = model.AgentQQ, remark = model.Remark, serviceType = model.ServiceType, id = model.ID }); if (reVal > 0) { return("1"); } else { return("0"); } } catch (Exception ex) { return("0"); } }
public ActionResult Delete(int id, AgentModel amm) { //try //{ // Agent a = es.GetById(id); // es.Delete(a); // es.Commit(); // return RedirectToAction("Index"); //} //catch //{ // return View(); //} var a = es.GetById(id); AgentModel am = new AgentModel() { FirstName = a.FirstName, LastName = a.LastName, PhoneNumber = a.PhoneNumber, Type = a.Type, Heure_travail = a.Heure_travail }; es.Delete(a); es.Commit(); return(RedirectToAction("Index")); }
public AgentVM() { Review = new List <AgentReviewVM>(); Sort = new List <SortList>(); Agent = new AgentModel(); PastSale = new PastSaleVM(); }
public string AddAgent(string agentId, string agentPwd, string agentPhone, string agentName, string agentAddress, int agentGrade, string agentIdCard, string agentNumber, string agentEmail, string agentQq, string remark, int serviceType) { AgentModel model = new AgentModel(); model.AgentId = agentId; model.AgentPassword = CommonLib.Helper.Md5Hash(agentPwd); model.AgentPhone = agentPhone; model.AgentName = agentName; model.AgentAddress = agentAddress; model.AgentGrade = agentGrade; model.AgentIdCard = agentIdCard; model.AgentNumber = agentNumber; model.AgentEmail = agentEmail; model.AgentQQ = agentQq; model.Remark = remark; model.ServiceType = serviceType; ManageUserModel uM = (ManageUserModel)Session["logUser"]; if (uM != null) { model.Creater = uM.Name; } model.AgentLink = "http://app.i200.cn/LoginReg/Registration.aspx?ag="; //舍弃加密方式的代理商编码 //model.AgentLink += (new Class_Password()).EnCode(agentId); model.AgentLink += agentId; return(AgentCtrl.AddAgent(model)); }
public void SaveAgent() { try { AgentModel agentModel = GetCurrentAgent(); if (_editMode == false) { _agentDataService.Insert(agentModel); } else { agentModel.KeyId = this.KeyId; _agentDataService.Update(agentModel); } Messenger.Default.Send <NotificationMessage>(new NotificationMessage("Agent Saved.")); Clear(); LoadMasterData(); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } Messenger.Default.Send <NotificationMessage>(new NotificationMessage(ex.Message)); } }
public string Post(AgentModel agentModel) { string success = "ERROR: "; try { using (GetaJobContext db = new GetaJobContext()) { Person person = new Person() { Id = Guid.NewGuid().ToString(), FName = agentModel.FName, LName = agentModel.LName, CellPhone = agentModel.Cell, OfficePhone = agentModel.Phone, Email = agentModel.Email }; db.People.Add(person); Agent agent = new Agent() { Id = Guid.NewGuid().ToString(), PersonId = person.Id, AgencyId = agentModel.AgencyId }; db.Agents.Add(agent); db.SaveChanges(); success = agent.Id; } } catch (Exception ex) { success = Helpers.ErrorDetails(ex); } return(success); }
public void SetWorkIcon(AgentModel model) { Sprite[] icons = AgentModel.GetAgentSkillSprite(model); WorkIcon1.sprite = icons[0]; WorkIcon2.sprite = icons[1]; WorkIcon3.sprite = icons[2]; }
public string Put(AgentModel agentModel) { string success = ""; try { using (GetaJobContext db = new GetaJobContext()) { Agent agent = db.Agents.Where(a => a.Id == agentModel.Id).FirstOrDefault(); //agent.AgencyId Person person = db.People.Where(p => p.Id == agent.PersonId).FirstOrDefault(); person.FName = agentModel.FName; person.LName = agentModel.LName; person.CellPhone = agentModel.Cell; person.OfficePhone = agentModel.Phone; person.Email = agentModel.Email; db.SaveChanges(); success = "ok"; } } catch (Exception ex) { success = Helpers.ErrorDetails(ex); } return(success); }
public ActionResult Create() { ViewData["Countrylist"] = new SelectList(_rep.GetCountry(), "CountryId", "CountryName", 0); ViewData["Status"] = new SelectList(_rep.GetStatus(), "id", "Name", 1); ViewData["AirlineGroup"] = new SelectList(_rep.GetAirlineGroup(), "AirlineGroupId", "AirlineGroupName"); AgentModel viewmodel = new AgentModel { agentsettinglist = _rep.GetAllSettingList(), ProductBaseRoleList = _rep.GetProductList(), ReferredByList = _rep.GetAllGetSalesAgentList(), MEsNameList = _rep.GetAllGetSalesAgentList(), // MasterDealNameListOfAirlines = _rep.GetAllDealListOfAirlines(), // MasterDealNameListOfHotels=_rep.GetAllDealListOfHotel(), }; /////// TODO : Repalce View data into Strongly Type Model ViewData ///////////// ViewData["AirlineGroup"] = new SelectList(_rep.GetAirlineGroup(), "AirlineGroupId", "AirlineGroupName"); ViewData["RoleAssign"] = new SelectList("", "RoleName", "RoleName", ""); ViewData["AgentTypes"] = new SelectList(_rep.GetAgentType(), "AgentTypeId", "AgentTypeName"); ViewData["AgentZone"] = new SelectList(_rep.GetZoneList(), "ZoneId", "ZoneName"); ViewData["AgentDistrict"] = new SelectList(_rep.GetDistrictListbyZoneId(1), "DistrictId", "DistrictName"); ViewData["BankAccountTypes"] = new SelectList(_rep.GetbankAccountType(), "BankAccountTypeId", "AccountTypeName"); ViewData["TimeZones"] = new SelectList(_rep.GetTimeZoneList(), "RecordID", "StandardName", 66); return(View(viewmodel)); }
public void SaveAgent(AgentModel modelTosave) { Agents datamodel = new Agents { AgentName = modelTosave.AgentName, NativeCountry = modelTosave.NativeCountryId, ZoneId = modelTosave.ZoneId, Address = modelTosave.Address, DistrictId = modelTosave.DistrictId, Phone = modelTosave.Phone, Email = modelTosave.Email, FaxNo = modelTosave.FaxNo, Web = modelTosave.Web, PanNo = modelTosave.PanNo, AgentStatus = Convert.ToBoolean(modelTosave.AgentStatusid), isApplyMarkup = modelTosave.isApplyMarkup, TotalMarkup = modelTosave.TotalMarkup, AgentTypeId = modelTosave.AgentTypeId, AgentCode = modelTosave.AgentCode, AgentClassId = modelTosave.AgentClassId, AirlineGroupId = modelTosave.AirlineGroupId, MaxNumberOfAgentUser = modelTosave.MaxNumberOfAgentUser, AgentLogo = modelTosave.AgentLogo, CreatedBy = modelTosave.CreatedBy, CreatedDate = modelTosave.CreatedDate }; db.AddToAgents(datamodel); db.SaveChanges(); }
public UpdateAgentForm(AgentModel agentModel) { InitializeComponent(); //change reference updateAgentModel = agentModel; FillData(); }
/// <summary> /// ////// /// </summary> /// <param name="model"></param> public void UpdateAgent(AgentModel model) { Agents tu = db.Agents.Where(u => u.AgentId == model.AgentId).FirstOrDefault(); tu.AgentId = model.AgentId; tu.AgentName = model.AgentName; tu.NativeCountry = model.NativeCountryId; tu.ZoneId = model.ZoneId; tu.DistrictId = model.DistrictId; tu.AgentClassId = model.AgentClassId; tu.AgentTypeId = model.AgentTypeId; tu.AgentCode = model.AgentCode; tu.Address = model.Address; tu.Phone = model.Phone; tu.Email = model.Email; tu.FaxNo = model.FaxNo; tu.PanNo = model.PanNo; tu.Web = model.Web; tu.AgentStatus = Convert.ToBoolean(model.AgentStatusid); tu.isApplyMarkup = model.isApplyMarkup; tu.TotalMarkup = model.TotalMarkup; tu.AirlineGroupId = model.AirlineGroupId; tu.MaxNumberOfAgentUser = model.MaxNumberOfAgentUser; tu.UpdatedDate = model.UpdatedDate; tu.UpdatedBy = model.UpdatedBy; db.ApplyCurrentValues(tu.EntityKey.EntitySetName, tu); db.SaveChanges(); }
/// <summary> /// AddAgentAsync /// </summary> /// <param name="agent"></param> /// <returns></returns> public async Task <AgentModel> AddAgentAsync(AgentModel agent) { try { using (var db = new CosmosUtil <AgentModel>("agents")) { var theAgent = await db.GetItemAsync(agent.Id.ToString(), agent.Id.ToString()); if (theAgent != null) // Agent already exists { return(theAgent); } // Otherwise, add a new agent agent.UpdatedOn = DateTime.UtcNow.ToString(); //Create or replace the Scores document await db.UpsertItemAsync(agent); return(agent); } } catch (Exception e) { Console.WriteLine(e); throw; } }
public IActionResult Logout() { var user_id = Request.Cookies["user_id"] ?? ""; var access_token = Request.Cookies["access_token"] ?? ""; AgentModel model = Framework.CurrentUser(user_id, access_token, _appSettings.BaseUrls.Api); if (model != null) { Framework.SetCurrentUserLoginStatus(user_id, access_token, "offline", _appSettings.BaseUrls.Api); } Response.Cookies.Append("access_token", "", new CookieOptions { HttpOnly = true, Path = "/" }); Response.Cookies.Append("user_id", "", new CookieOptions { HttpOnly = true, Path = "/" }); ViewBag.ApiUrl = _appSettings.BaseUrls.Api; if (!string.IsNullOrWhiteSpace(user_id) && !string.IsNullOrWhiteSpace(access_token)) { ViewBag.UserId = user_id; ViewBag.AccessToken = access_token; ViewBag.BaseUrls_PhoneWeb = _appSettings.BaseUrls.PhoneWeb; ViewBag.BaseUrls_ApiHotline = _appSettings.BaseUrls.ApiHotline; } return(Redirect("/login")); }