private void btnGenInsSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(cmbRiskProfile.Text)) { MessageBox.Show("Please select Risk profile value.", "Risk profile require", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } PlanOption planOpt = new PlanOption(); planOpt.Id = int.Parse(txtOptionName.Tag.ToString()); planOpt.Pid = int.Parse(lblPlanVal.Tag.ToString()); planOpt.Name = txtOptionName.Text; planOpt.RiskProfileId = int.Parse(cmbRiskProfile.Tag.ToString()); planOpt.UpdatedOn = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); planOpt.CreatedOn = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")); planOpt.UpdatedBy = Program.CurrentUser.Id; planOpt.CreatedBy = Program.CurrentUser.Id; planOpt.UpdatedByUserName = Program.CurrentUser.UserName; planOpt.MachineName = System.Environment.MachineName; if (new PlanOptionInfo().Save(planOpt)) { MessageBox.Show("Record save successfully.", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); this.DialogResult = DialogResult.OK; this.Close(); } else { MessageBox.Show("Unable to save record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void AddOption(int planId, int optionId) { var planOption = new PlanOption() { PlanId = planId, OptionId = optionId }; var user = GetCurrentUser(); planOption.InsertDate = DateTime.Now; planOption.InsertUser = user.UserName; var ent = planOption.GetType().Name; _context.PlanOptions.Add(planOption); _context.SaveChanges(); _logger.LogEvent(planOption.GetType().Name, planOption.Id, "Add"); }
public Result Delete(PlanOption planOption) { var result = new Result(); try { PlanOptionService planOptionService = new PlanOptionService(); planOptionService.Delete(planOption); result.IsSuccess = true; } catch (Exception exception) { result.IsSuccess = false; result.ExceptionInfo = exception; } return(result); }
public bool Delete(PlanOption planOption) { try { FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization(); string apiurl = Program.WebServiceUrl + "/" + DELETE_PLANOPTION_API; RestAPIExecutor restApiExecutor = new RestAPIExecutor(); var restResult = restApiExecutor.Execute <PlanOption>(apiurl, planOption, "POST"); return(true); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); MethodBase currentMethodName = sf.GetMethod(); LogDebug(currentMethodName.Name, ex); return(false); } }
public void insertNewMarketPlan(productMarketPlan pro, String[] optionsid) { context.productMarketPlans.Add(pro); context.SaveChanges(); System.Diagnostics.Debug.WriteLine("AAAAAAAA " + pro.id); for (int i = 0; i < optionsid.Length; i++) { try { int id = int.Parse(optionsid[i]); if (context.attributeOptions.Find(id) != null) { PlanOption o = new PlanOption(); o.optionID = id; o.orderItemID = pro.id; context.PlanOptions.Add(o); context.SaveChanges(); } } catch (Exception e) { } } }
public OptionViewModel(PlanOption option) { Option = option; }
public static void Test8(DniproDB db) { PlanOption[] objs = new PlanOption[500000]; for (int i = 0; i < 500000; i++) { objs[i] = new PlanOption() { Prop = Blaha.bla1, ServicePlanID = i, ServicePlanOption = i, IsDefault = true }; } Stopwatch s = new Stopwatch(); s.Start(); db.AddDoc(new { hello = "ok" }); db.AddDocs<PlanOption>(objs); s.Stop(); Console.WriteLine("Inserts: " + s.ElapsedMilliseconds.ToString()); s = new Stopwatch(); s.Start(); objs = db.GetWhere("{'IsDefault':true}").Select<PlanOption>(); s.Stop(); Console.WriteLine("Read all: " + s.ElapsedMilliseconds.ToString()); }