public async Task <IHttpActionResult> PostAdviser(Adviser adviser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Advisers.Add(adviser); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (AdviserExists(adviser.adviserId)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = adviser.adviserId }, adviser)); }
private void seedAdvisers() { Adviser bbaker = new Adviser() { BannerID = 16, FirstName = "Beverley", LastName = "Baker", FlashlineID = "bbaker", ShowApptNotification = true, ShowWalkinNotification = true, NotificationVolume = 10, MinuteAllowedLate = 5, WalkinAdviser = false, CollegeID = 3 }; Adviser cbright = new Adviser() { BannerID = 17, FirstName = "Christine", LastName = "Bright", FlashlineID = "cbright", ShowApptNotification = true, ShowWalkinNotification = true, NotificationVolume = 40, MinuteAllowedLate = 5, WalkinAdviser = false, CollegeID = 3 }; Adviser amckinne = new Adviser() { BannerID = 18, FirstName = "Angie", LastName = "Mckinney", FlashlineID = "amckinne", ShowApptNotification = true, ShowWalkinNotification = true, NotificationVolume = 60, MinuteAllowedLate = 5, WalkinAdviser = false, CollegeID = 3 }; Adviser jdrake = new Adviser() { BannerID = 19, FirstName = "Johnny", LastName = "Drake", FlashlineID = "jdrake", ShowApptNotification = true, ShowWalkinNotification = true, NotificationVolume = 60, MinuteAllowedLate = 5, WalkinAdviser = false, CollegeID = 1 }; context.Advisers.Add(bbaker); context.Advisers.Add(cbright); context.Advisers.Add(amckinne); context.Advisers.Add(jdrake); context.SaveChanges(); }
private void btnDelete_Click(object sender, EventArgs e) { if (MetroFramework.MetroMessageBox.Show(this, "quieres eliminar el adviser?") == DialogResult.OK) { using (DataContext dataContext = new DataContext()) { Adviser adviser = adviserBindingSource.Current as Adviser; if (adviser != null) { if (dataContext.Entry <Adviser>(adviser).State == EntityState.Detached) { dataContext.Set <Adviser>().Attach(adviser); } dataContext.Entry <Adviser>(adviser).State = EntityState.Deleted; dataContext.SaveChanges(); MetroFramework.MetroMessageBox.Show(this, "adviser eliminado"); adviserBindingSource.RemoveCurrent(); pctPhoto.Image = null; pnlDatos.Enabled = false; } } } }
public async Task <IHttpActionResult> PutAdviser(Guid id, Adviser adviser) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != adviser.adviserId) { return(BadRequest()); } db.Entry(adviser).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AdviserExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
/* * public void MigrateAdvisersData() * { * var ds = MainService.thisGlobal.Container.Resolve<DataService>(); * * // List<Adviser> results = new List<Adviser>(); * using (ISession Session = ConnectionHelper.CreateNewSession()) * { * var advisers = Session.Query<DBAdviser>(); * foreach (var dbadv in advisers) * { * //Adviser adv = new Adviser(); * //if (toDTO(dbadv, ref adv)) * // results.Add(adv); * try * { * if (String.IsNullOrEmpty(dbadv.State)) * continue; * Dictionary<string, object> res = JsonConvert.DeserializeObject<Dictionary<string, object>>(dbadv.State); * * Dictionary<string, TDynamicProperty<object> > result = new Dictionary<string, TDynamicProperty<object> >(); * foreach(var prop in res) * { * TDynamicProperty<object> p = new TDynamicProperty<object>(); * if (prop.Value != null) * { * p.type = prop.Value.GetType().ToString(); * switch (p.type) * { * case "System.Int64": * p.type = "integer"; * break; * case "System.Double": * p.type = "double"; * break; * case "System.Boolean": * p.type = "boolean"; * break; * default: * p.type = "string"; * break; * } * * } * else p.type = "string"; * if (prop.Key.Equals("InfoTextColor")) * p.type = "hexinteger"; * * p.value = prop.Value; * result.Add(prop.Key, p); * } * * DynamicProperties dp = new DynamicProperties(); * dp.entityType = (short)EntitiesEnum.Adviser; * dp.objId = dbadv.Id; * dp.updated = DateTime.UtcNow; * dp.Vals = JsonConvert.SerializeObject(result); * ds.SavePropertiesInstance(dp); * * } catch (Exception e) * { * log.Info("Failed to migrate: Adviser: " + dbadv.Id.ToString() + ", " + e.ToString()); * } * } * } * }*/ public List <ExpertsCluster> GetClusters() { List <ExpertsCluster> results = new List <ExpertsCluster>(); using (ISession Session = ConnectionHelper.CreateNewSession()) { var clusters = Session.Query <DBExpertcluster>(); foreach (var dbCluster in clusters) { ExpertsCluster cluster = new ExpertsCluster(); if (toDTO(dbCluster, ref cluster)) { var advisers = Session.Query <DBAdviser>() .Where(x => x.Cluster != null && x.Cluster.Id == cluster.Id); foreach (var dbAdviser in advisers) { Adviser adv = new Adviser(); if (toDTO(dbAdviser, ref adv)) { cluster.Advisers.Add(adv); } } results.Add(cluster); } } } return(results); }
public IEnumerable <Adviser> GetAdvisersByMetaSymbolId(long masterId) { var advisers = new List <Adviser>(); try { using (var Session = ConnectionHelper.CreateNewSession()) { var adv = Session.Query <DBAdviser>() .Where(x => x.Symbol.Metasymbol.Id == (int)masterId); if (adv == null || advisers.Count() == 0) { return(advisers); // it is not master expert } foreach (var adviser in adv) { var a = new Adviser(); if (ExpertsRepository.toDTO(adviser, ref a)) { advisers.Add(a); } } } return(advisers); } catch (Exception e) { log.Error("Error: GetAdvisersByMetaSymbolId: " + e); } return(advisers); }
private void btnSave_Click(object sender, EventArgs e) { using (DataContext dataContext = new DataContext()) { Adviser adviser = bindingSource2.Current as Adviser; if (adviser != null) { if (dataContext.Entry <Adviser>(adviser).State == EntityState.Detached) { dataContext.Set <Adviser>().Attach(adviser); } if (adviser.Id == 0) { dataContext.Entry <Adviser>(adviser).State = EntityState.Added; } else { dataContext.Entry <Adviser>(adviser).State = EntityState.Modified; } dataContext.SaveChanges(); MetroFramework.MetroMessageBox.Show(this, "Datos guardados en la base de datos"); grdAdviser.Refresh(); pnlDatos.Enabled = false; } } }
public ActionResult DeleteConfirmed(Guid id) { Adviser adviser = db.Advisers.Find(id); db.Advisers.Remove(adviser); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool UpdateAdviser(Adviser adviser) { var result = data.UpdateObject(EntitiesEnum.Adviser, adviser.Id, JsonConvert.SerializeObject(adviser)); var signal = CreateSignal(SignalFlags.Expert, adviser.Id, EnumSignals.SIGNAL_UPDATE_EXPERT, 0); signal.Value = result; PostSignalTo(signal); return(result > 0); }
public ActionResult Edit([Bind(Include = "adviserId,fullName,displayName,nric,rns,dob,contactNumber,email,address,aboutMeShort,aboutMe,creditCardNumber,creditCardExpire,password,createdDate,updatedDate,viewCount,activeFlag")] Adviser adviser) { if (ModelState.IsValid) { db.Entry(adviser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(adviser)); }
public async Task <IHttpActionResult> GetAdviser(Guid id) { Adviser adviser = await db.Advisers.FindAsync(id); if (adviser == null) { return(NotFound()); } return(Ok(adviser)); }
public Adviser GetAdviser(string User, string Pass) { var eAdviser = new Adviser(); using (var dbCtx = new SiboSupermarketEntities()) { dbCtx.Configuration.ProxyCreationEnabled = false; eAdviser = dbCtx.Adviser.FirstOrDefault(x => x.Identification == User && x.Password == Pass); } return(eAdviser); }
public AdviserView getAdviserAccountNumber() { var userid = User.Identity.GetUserId(); Adviser adviser = edisRepo.GetAdviserForClient(userid); AdviserView view = new AdviserView { accountNumber = adviser.AdviserNumber, //id==> number name = adviser.FirstName + " " + adviser.LastName }; return(view); //return clientRepo.GetAdviserAccountNumberForClient(userid); }
protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Response.Redirect("default.aspx"); } else { Adviser eClient = (Adviser)Session["User"]; lblUserName.Text = eClient.Name + " " + eClient.LastName; } }
private void Form1_Load(object sender, EventArgs e) { Type[] alltypes = Assembly.GetExecutingAssembly().GetTypes(); foreach (Type currtype in alltypes) { if (currtype.FullName.Contains("MyClasses")) { comboBox2.Items.Add(currtype.Name); } if (currtype.FullName.Contains("Serializers") && !currtype.FullName.Contains("ISerializer")) { Binary b = new Binary(); object someseril = Activator.CreateInstance(currtype); //GetNameSeril(b); comboBox1.Items.Add(someseril); } } comboBox1.SelectedIndex = 0; comboBox2.SelectedIndex = 0; back.Hide(); Man man = new Man("Василий", "Кошкин", 1000, "+37533904804", "Решительный", "Пн-Пт 9:00-17:00"); listBox1.Items.Add(man); Director director = new Director(null, 40, 30, null, man); listBox1.Items.Add(director); man = new Man("Пётр", "Плюшкин", 500, "+37533934534", "Добрый", "Пн-Пт 8:00-17:00"); Adviser adv = new Adviser(70, "По поеданиям пирожков", man); listBox1.Items.Add(adv); director.DirAdviser = adv; Company comp = new Company("Мир сладостей", null, 10000000, director); director.Ownership = comp; listBox1.Items.Add(comp); Product prod = new Product("Пирожки", 100, 5, 30); listBox1.Items.Add(prod); comp.Production = prod; man = new Man("Александр", "Котелков", 200, "+37529544529", "Опытный", "Пн-Пт 7:00-16:00"); Worker worker = new Worker("Повар", 90, man); listBox1.Items.Add(worker); Engineer engineer = new Engineer("Шеф-повар", comp, prod, worker); listBox1.Items.Add(engineer); man = new Man("Виктория", "Волочкова", 300, "+37533553929", "Ленивая", "Вт-Сб 10:00-18:00"); worker = new Worker("Бухгалтер", 40, man); Office_Worker offworker = new Office_Worker("Бухгалтерия", comp, worker); listBox1.Items.Add(offworker); }
public static bool toDTO(DBAdviser adv, ref Adviser result) { try { result.Id = adv.Id; result.Name = adv.Name; result.Running = adv.Running; if (adv.Closereason != null) { result.CloseReason = adv.Closereason.Value; } if (adv.Terminal != null) { result.TerminalId = adv.Terminal.Id; result.CodeBase = adv.Terminal.Codebase; result.Broker = adv.Terminal.Broker; result.FullPath = adv.Terminal.Fullpath; if (adv.Terminal.Accountnumber != null) { result.AccountNumber = adv.Terminal.Accountnumber.Value; } } result.LastUpdate = adv.Lastupdate.Value; result.Disabled = adv.Disabled; if (adv.Symbol != null) { result.Symbol = adv.Symbol.Name; result.SymbolId = adv.Symbol.Id; } if (adv.Cluster != null) { result.ClusterId = adv.Cluster.Id; if (adv.Cluster.Metasymbol != null) { result.MetaSymbol = adv.Cluster.Metasymbol.Name; } else { result.MetaSymbol = adv.Symbol.Name; } } result.Timeframe = adv.Timeframe; // result.State = adv.State; return(true); } catch { return(false); } }
public bool UpdateAdviser(Adviser adviser) { try { return(experts.UpdateAdviser(adviser)); } catch (Exception e) { log.Error("Error: UpdateAdviser: " + e); } return(false); }
private void grdDatos_CellClick(object sender, DataGridViewCellEventArgs e) { Adviser adviser = adviserBindingSource.Current as Adviser; if (adviser != null && adviser.Photo != null) { pctPhoto.Image = Image.FromFile(adviser.Photo); } else { pctPhoto.Image = null; } }
public async Task <IHttpActionResult> DeleteAdviser(Guid id) { Adviser adviser = await db.Advisers.FindAsync(id); if (adviser == null) { return(NotFound()); } db.Advisers.Remove(adviser); await db.SaveChangesAsync(); return(Ok(adviser)); }
// GET: Advisers/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Adviser adviser = db.Advisers.Find(id); if (adviser == null) { return(HttpNotFound()); } return(View(adviser)); }
//public async Task<ActionResult> Index() //{ // HttpClient httpClient = new HttpClient(); // httpClient.DefaultRequestHeaders.Accept.Add( // new MediaTypeWithQualityHeaderValue("application/json")); // HttpResponseMessage response = await httpClient.GetAsync(GET_POIS); // if (response != null || response.IsSuccessStatusCode) // { // string content = await response.Content.ReadAsStringAsync(); // Console.Out.WriteLine("Response Body: \r\n {0}", content); // adviserListData = new List<Adviser>(); // JArray jsonResponse = JArray.Parse(content); // IList <JToken> results = jsonResponse.ToList(); // foreach (JToken token in results) // { // Adviser adviser = token.ToObject<Adviser>(); // adviserListData.Add(adviser); // } // return View(adviserListData); // } // else // { // Console.Out.WriteLine("Failed to fetch data. Try again later!"); // return null; // } //} // GET: Advisers/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Adviser adviser = db.Advisers.Where(a => a.activeFlag == true && a.adviserId == id).FirstOrDefault(); if (adviser == null) { return(HttpNotFound()); } return(View(adviser)); }
public ActionResult AddAdviser(int adviserBannerID, string adviserFirstName, string adviserLastName, string adviserFlashlineID) { var collegeID = (int)Session["collegeID"]; if (collegeID != null) { //adds adviser using passed in data and defaults for notifications and minutes allowed late Adviser newAdviser = new Adviser() { BannerID = adviserBannerID, FirstName = adviserFirstName, LastName = adviserLastName, FlashlineID = adviserFlashlineID, ShowApptNotification = true, ShowWalkinNotification = true, NotificationVolume = 0, MinuteAllowedLate = 0, WalkinAdviser = false, CollegeID = collegeID }; context.Advisers.Add(newAdviser); context.SaveChanges(); } return(RedirectToAction("Index")); }
protected void btnLogin_Click(object sender, EventArgs e) { string strUser = txtUser.Text.Trim(); string strPassword = txtPassword.Text.Trim(); AdviserBLL oAdviser = new AdviserBLL(); Adviser eAdviser = oAdviser.Authenticate(strUser, strPassword); if (eAdviser != null) { Session["User"] = eAdviser; Response.Redirect("home.aspx"); } else { MessageBox("Usuario no autenticado", "Los datos ingresados son incorrectos"); } }
public QUIKExpert(Adviser adv) { Id = adv.Id; Name = adv.Name; Running = adv.Running; CloseReason = adv.CloseReason; TerminalId = adv.TerminalId; CodeBase = adv.CodeBase; Broker = adv.Broker; FullPath = adv.FullPath; AccountNumber = adv.AccountNumber; LastUpdate = adv.LastUpdate; Disabled = adv.Disabled; Symbol = adv.Symbol; SymbolId = adv.SymbolId; MetaSymbol = adv.MetaSymbol; Timeframe = adv.Timeframe; State = adv.State; Volume = 1; PortfolioName = "SPBFUTK3JVN"; Comment = "QUIK"; //ExpertsRepository.toDTO(dbAdviser, ref refThis); Dictionary <string, string> parameters = JsonConvert.DeserializeObject <Dictionary <string, string> >(State); if (parameters != null) { if (parameters.ContainsKey("Volume")) { Volume = short.Parse(parameters["Volume"]); } if (parameters.ContainsKey("PortfolioName")) { PortfolioName = parameters["PortfolioName"]; } if (parameters.ContainsKey("Comment")) { Comment = parameters["Comment"]; } } }
private static QuotationBuilder CreateQuotationBuilder(Adviser adviser = null) { if (adviser == null) { adviser = CreateAdvisor(); } //Arrange var quotationBuilder = new QuotationBuilder(); quotationBuilder.AddMorningStar(new MorningStar()); quotationBuilder.AddProjection(new Projection()); quotationBuilder.AddInvestorDetails(CreateInvestor()); quotationBuilder.AddProduct(CreateProduct()); quotationBuilder.AddAdviser(adviser); quotationBuilder.AddQuoteDetails(new QuoteDetails()); quotationBuilder.AddInvestmentType(CreateBuildInvestment()); return(quotationBuilder); }
private void FrmAdviser_Load(object sender, EventArgs e) { using (DataContext dataContext = new DataContext()) { bindingSource2.DataSource = dataContext.Advisers.ToList(); } pnlDatos.Enabled = false; Adviser adviser = bindingSource2.Current as Adviser; if (adviser != null && adviser.Photo != null) { pctPhoto.Image = Image.FromFile(adviser.Photo); } else { pctPhoto.Image = null; } }
private void btnSearch_Click(object sender, EventArgs e) { using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "archivos JPG|*.jpg|todos los archivos|*.*" }) { if (ofd.ShowDialog() == DialogResult.OK) { pctPhoto.Image = Image.FromFile(ofd.FileName); Adviser adviser = bindingSource2.Current as Adviser; if (adviser != null) { adviser.Photo = ofd.FileName; } } } }
public List <Adviser> GetAdvisers() { List <Adviser> results = new List <Adviser>(); using (ISession Session = ConnectionHelper.CreateNewSession()) { var advisers = Session.Query <DBAdviser>(); foreach (var dbadv in advisers) { Adviser adv = new Adviser(); if (toDTO(dbadv, ref adv)) { results.Add(adv); } } } return(results); }
public bool UpdateAdviser(Adviser adv) { using (ISession Session = ConnectionHelper.CreateNewSession()) { DBAdviser adviser = Session.Get <DBAdviser>(adv.Id); if (adviser == null) { return(false); } using (ITransaction Transaction = Session.BeginTransaction()) { // if (!string.IsNullOrEmpty(adv.State)) // adviser.State = adv.State; Session.Update(adviser); Transaction.Commit(); return(true); } } }
public CardNotepad(Player player) { //Si tiene x tipo de carta cardNumber = new bool[8]; //Retorno de x tipo de carta typeCards = new Card[8]; typeCards[0] = new Guardian(); typeCards[1] = new Spy(); typeCards[2] = new BountyHunter(); typeCards[3] = new Shield(); typeCards[4] = new Captain(); typeCards[5] = new Admiral(); typeCards[6] = new Adviser(); typeCards[7] = new Warmind(); //Tiene que ver con el spotteo y un index creeeeo cardNumberOrigen = new int[8]; Player = player; }