// GET: /DetailView/ public ActionResult Index() { dynamic uavDetailList = new System.Dynamic.ExpandoObject(); uavDetailList.UAVs = db.UAVs.ToList(); uavDetailList.FlightStates = db.FlightStates.ToList(); uavDetailList.missions = db.Missions.ToList(); uavDetailList.Configurations = db.Configurations.ToList(); uavDetailList.Eventlog = db.EventLogs.ToList(); string name = (string)Session["current_user"]; if(name != null) { var curUser = (from u in db.Users where u.username.Equals(name) select new { username = u.username, user_id = u.user_id, }).FirstOrDefault(); ViewBag.currentUser = curUser; } return View(uavDetailList); }
private object CreateAnonymousObjectFromDictionary(Dictionary<string,object> properties) { var obj = new System.Dynamic.ExpandoObject(); var props = (ICollection<KeyValuePair<string, object>>)obj; foreach (var x in properties) props.Add(x); return obj; }
public ActionResult biogasfullscreen() { dynamic data = new System.Dynamic.ExpandoObject(); string title = WebRequest.GetString("t", true); string w = WebRequest.GetString("w", true); string h = WebRequest.GetString("h", true); string n = WebRequest.GetString("n", true); string m = WebRequest.GetString("m", true); string acl = WebRequest.GetString("acl", true); string acr = WebRequest.GetString("acr", true); string line = WebRequest.GetString("line", true); #region 图表 var one = materialService.GetOneMaterialSpecification(m); var chart = costanalysisService.GetFlexChart("CC10"); chart.charttype = line; chart.title = (one != null ? one.MaterialSpecificationName : "") + title; chart.height = int.Parse(h); chart.width = int.Parse(w); chart.leftprecision = int.Parse(acl); chart.rightprecision = int.Parse(acr); chart.customercode = Masterpage.CurrUser.client_code; chart.url = Utils.GetFlexAddress(); #endregion data.chart = JsonHelper.ToJson(chart); LogHelper.Info(Masterpage.CurrUser.alias, "401032:客户," + Masterpage.CurrUser.client_code + ",查看全屏图表,耗材为:" + m); return View("chartfullscreen", data); }
public static dynamic GetAjaxRet(int result_code, string message) { dynamic ret = new System.Dynamic.ExpandoObject(); ret.result = result_code; ret.message = message; return ret; }
public object LogOn(LoginModel model) { dynamic result = new System.Dynamic.ExpandoObject(); result.success = AuthorityService.Logon(model.UserName, model.Password, model.RememberMe); return result; }
public ActionResult Edit(int id) { //var company = uow.Repository<TBL_COMPANIES>().GetById(id); dynamic model = new System.Dynamic.ExpandoObject(); model.companyId = id; return PartialView("Edit", model); }
public ActionResult canreturntab(string order, string no) { dynamic data = new System.Dynamic.ExpandoObject(); var had = stockinService.ReturnDetailList(no, order); var orderdetail = stockinService.ReturnDetailListByOrder(order).ToList(); if (had != null && had.Count > 0) { foreach (var item in orderdetail) { var h = had.FirstOrDefault(p => p.purchaseDetailSn == item.purchaseDetailSn); if (h != null) { item.returnAmount = h.returnAmount; item.depotId = h.depotId; item.depotName = h.depotName; item.returnSn = h.returnSn; item.returnNo = h.returnNo; item.remark = h.remark; } } } var depots = stockinService.QueryDepot(1).Select(x => new SelectListItem { Text = x.depotName, Value = x.depotId.ToString() }).ToList(); data.depots = depots; data.no = no; data.order = order; data.list = orderdetail; return PartialView(data); }
public ActionResult bioefficiencysop(int? page, int? pagesize) { string unit = WebRequest.GetString("unit", true); string start = WebRequest.GetString("start", true); string end = WebRequest.GetString("end", true); dynamic data = new System.Dynamic.ExpandoObject(); var list = managementService.GetCustomerBioefficiencySop(Masterpage.CurrUser.client_code, unit, start, end); int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 14; var vs = list.ToPagedList(_page, _pagesize); data.list = vs; data.unit = unit; data.start = start; data.end = end; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; data.ddlunit = managementService.GetStandardProcessUnitDDL(Masterpage.CurrUser.client_code); string otherparam = ""; if (unit != "") otherparam += "&unit=" + unit; if (start != "") otherparam += "&start=" + start; if (end != "") otherparam += "&end=" + end; data.otherParam = otherparam; LogHelper.Info(Masterpage.CurrUser.alias, "607011:客户," + Masterpage.CurrUser.client_code + ",生物增效SOP列表,第" + _page + "页"); return View(data); }
public ActionResult canreturnrlist(int? page, int? pagesize, int supplier, string no, string query) { dynamic data = new System.Dynamic.ExpandoObject(); var had = stockoutService.GetReturnHadOut(no); var all = stockoutService.GetCanReturn(supplier,query); #region 合并 if (all != null && had != null) { foreach (var item in all) { var h = had.FirstOrDefault(p => p.text == item.text); if (h == null) had.Add(item); } } #endregion int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 12; var vs = had.ToPagedList(_page, _pagesize); data.no = no; data.query = query; data.supplier = supplier; data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; return PartialView(data); }
// GET: /Map/GoogleMap public ActionResult GoogleMap() { dynamic uav_event_user = new System.Dynamic.ExpandoObject(); uav_event_user.UAVs = db.UAVs.ToList(); uav_event_user.Eventlog = db.EventLogs.ToList(); uav_event_user.Operator = db.Users.ToList(); uav_event_user.missions = db.Missions.ToList(); string name = (string)Session["current_user"]; if(name != null) { var curUser = (from u in db.Users where u.username.Equals(name) select new { username = u.username, user_id = u.user_id, }).FirstOrDefault(); if (curUser != null) { var assignedUavs = (from u in db.UAVs where u.User_user_id == curUser.user_id select u.Id).ToList(); ViewBag.currentUser = curUser; ViewBag.assignedUavs = assignedUavs; } } return View(uav_event_user); }
public ActionResult createpost() { dynamic data = new System.Dynamic.ExpandoObject(); LogHelper.Info(Masterpage.CurrUser.alias, "804012:客户," + Masterpage.CurrUser.client_code + ",创建在线答疑"); return PartialView("createpost", data); }
public ActionResult Login(string url, string v1, string v2, string remember_me) { dynamic data = new System.Dynamic.ExpandoObject(); data.url = url; data.v1 = v1; data.v2 = v2; data.message = SessionHelper.GetSession("AutoNeedLogin");//异地登录时,会有提示信息 Session["WebSessionId"] = Session.SessionID; var sid = SessionHelper.SessionId; SessionHelper.SetSession("SessionHelperSessionId", sid); string uid = ""; bool remember = false; var rmb = CookieHelper.GetCookieValue("remember_me"); if (rmb != null && rmb == "on") { uid = CookieHelper.GetCookieValue("remember_userid"); remember = true; } data.remember = remember; data.uid = uid; #region 加密狗 //Dog dog = new Dog(100); //// Read the string variable from the dog //dog.DogAddr = 0; // The address read //dog.DogBytes = 10; // The number of bytes read //dog.ReadDog(); //bool hdog = (dog.Retcode == 0); bool hdog = true; #endregion data.dog = hdog; return View(data); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.Dynamic.ExpandoObject expandoObject1 = new System.Dynamic.ExpandoObject(); this.browserControl1 = new BinaryAnalysis.UI.Controls.BrowserControl(); this.SuspendLayout(); // // browserControl1 // this.browserControl1.BaseModel = expandoObject1; this.browserControl1.Dock = System.Windows.Forms.DockStyle.Fill; this.browserControl1.Location = new System.Drawing.Point(0, 0); this.browserControl1.Name = "browserControl1"; this.browserControl1.Size = new System.Drawing.Size(686, 552); this.browserControl1.TabIndex = 0; // // BrowserWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(686, 552); this.Controls.Add(this.browserControl1); this.Name = "BrowserWindow"; this.Text = "BrowserWindow"; this.ResumeLayout(false); }
public static dynamic ParseQueryString(this string queryString) { dynamic parsedQueryString = new System.Dynamic.ExpandoObject(); var nameV = new Dictionary<string, string>(); if (string.IsNullOrEmpty(queryString)) return parsedQueryString; var pairs = queryString.Split('&'); foreach (var pair in pairs) { var parts = pair.Split(new []{'='}, 2); var name = System.Uri.UnescapeDataString(parts[0]); var value = parts.Length == 1 ? string.Empty : System.Uri.UnescapeDataString(parts[1]); nameV.Add(name, value); } //DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Dictionary<int, List<int>>)); //using (MemoryStream ms = new MemoryStream()) //{ // serializer.WriteObject(ms, nameV); //} var temp = JsonConvert.SerializeObject(nameV, new KeyValuePairConverter()); return temp; }
public static dynamic CreateExpandoObject() { dynamic bag = new System.Dynamic.ExpandoObject(); bag.Name = "Eddy"; bag.Display = (Action<string>) ((text) => Console.WriteLine(text)); return bag; }
public JsonResult(Gale.REST.Queryable.Primitive.Result response, int offset, int limit) { List<object> _items = new List<object>(); foreach (var data in response.data) { int ordinal = 0; var plainObject = new System.Dynamic.ExpandoObject(); var groupedFields = new SortedList<string, KeyValuePair<Gale.REST.Queryable.Primitive.Reflected.Field, Object>>(); foreach (var field in response.fields) { if (field.Name.IndexOf("_") > 0) { groupedFields.Add(field.Name, new KeyValuePair<Gale.REST.Queryable.Primitive.Reflected.Field, object>(field, data[ordinal])); } else { //Add Direct Property ((IDictionary<String, Object>)plainObject).Add(field.Name, data[ordinal]); } ordinal++; } //Order the Grouped Fields var grouped = groupedFields.GroupBy((field) => { return field.Key.Substring(0, field.Key.IndexOf("_")); ; }); foreach (var group in grouped) { var diggedObject = new System.Dynamic.ExpandoObject(); foreach (var field in group) { var columnKey = field.Key.Substring(field.Key.IndexOf("_") + 1); ((IDictionary<String, Object>)diggedObject).Add(columnKey, field.Value.Value); } //Add Digged Object ((IDictionary<String, Object>)plainObject).Add(group.Key, diggedObject); } _items.Add(plainObject); ordinal = 0; } //Set Values into the Base Response base.offset = offset; base.limit = limit; base.total = response.total; base.items = _items; base.elapsedTime = response.elapsedTime.ToString("t"); }
public ActionResult rolelist() { dynamic data = new System.Dynamic.ExpandoObject(); var list = ucenterService.GetRoleListByCustomerCode(Masterpage.CurrUser.client_code); data.list = list; data.message = SessionHelper.GetSession("rolelistmessage"); SessionHelper.Del("rolelistmessage"); return View(data); }
// GET: ManagerView public ActionResult Index() { dynamic uavManagerList = new System.Dynamic.ExpandoObject(); uavManagerList.UAVs = db.UAVs.ToList(); uavManagerList.Eventlog = db.EventLogs.ToList(); uavManagerList.Operator = db.UserRoles.ToList(); return View(uavManagerList); }
public ActionResult billdetailview(string key, string where) { dynamic data = new System.Dynamic.ExpandoObject(); if (where == null) where = ""; var list = ServiceDB.Instance.QueryModelList<V_BillCostDetail>(" select * from V_BillCostDetail where billNo='" + key + "' " + where + " order by cost desc ").ToList(); data.list = list; return PartialView(data); }
public object StringifyAmount() { dynamic flexible; flexible = new System.Dynamic.ExpandoObject(); var dictionary = (IDictionary<string, object>)flexible; dictionary.Add(Name, Qty); return dictionary; }
public ActionResult Index() { dynamic data = new System.Dynamic.ExpandoObject(); var mslist = _ModuleFunctionRepos.GetModuleByRole(Masterpage.AdminCurrUser.role_guid); var ms = mslist.Where(f => f.ModuleFunctionType == "M" && f.ModuleFunctionId.StartsWith("B")).ToList(); data.list1 = ms; data.person = Masterpage.AdminCurrUser.alias; data.list2 = mslist; return View(data); }
public void MethodGetsDynamicButSpecifiedWithExplicitType() { var sut = Substitute.For<IInterface>(); sut.GetsDynamic(Arg.Any<object>()).Returns(1); dynamic expando = new System.Dynamic.ExpandoObject(); var result = sut.GetsDynamic(expando); Assert.That(result, Is.EqualTo(1)); }
public ActionResult backdetailview() { dynamic data = new System.Dynamic.ExpandoObject(); var no = WebRequest.GetString("no", true); var list = ServiceDB.Instance.QueryModelList<V_DelegateBackDetail>("select * from V_DelegateBackDetail where backNo='" + no + "'"); data.no = no; data.list = list; return PartialView(data); }
public static object ToAnonymousType (this IEnumerable<KeyValuePair<string, object>> dict) { var eo = new System.Dynamic.ExpandoObject (); var eoColl = (ICollection<KeyValuePair<string, object>>)eo; foreach (KeyValuePair<string, object> kvp in dict) { eoColl.Add (kvp); } return (dynamic)eo; }
public void MethodGetsDynamicAsAnArgumentAndReturnsDynamic() { var sut = Substitute.For<IInterface>(); sut.ReturnsAndGetsDynamic(Arg.Any<dynamic>()).Returns(1); dynamic expando = new System.Dynamic.ExpandoObject(); var result = sut.ReturnsAndGetsDynamic(expando); Assert.That(result, Is.EqualTo(1)); }
public InfluxDataSenderConfiguration(bool isEnabled, int maxQueueSize, string url, string databaseName, string userName, string password, TimeSpan? requestTimeout) { IsEnabled = isEnabled; MaxQueueSize = maxQueueSize; Properties = new System.Dynamic.ExpandoObject(); Properties.Url = url; Properties.DatabaseName = databaseName; Properties.UserName = userName; Properties.Password = password; Properties.RequestTimeout = requestTimeout; }
public Task Invoke(IDictionary<string, object> env) { Microsoft.Owin.OwinContext ctx = new Microsoft.Owin.OwinContext(env); string path = ctx.Request.Uri.AbsolutePath; Type t = null; if (!apis.TryGetValue(path, out t)) { return _next(env); } IRequest req = Pioneer.WxSdk.JsonService.FromStream(t, ctx.Request.Body, Encoding.UTF8) as IRequest; if (req == null) { ctx.Response.StatusCode = 400; return ctx.Response.WriteAsync(""); } if (SdkConfig.Instance.Deploy != Deploy.Server) { SdkConfig.Instance.Deploy = Deploy.Server; } dynamic rsp = null; try { rsp = req.GetResponse(); rsp.Successed = true; } catch (WxException we) { rsp = new System.Dynamic.ExpandoObject(); rsp.Successed = false; rsp.ErrorMessage = we.Message; rsp.ErrorCode = we.ErrorCode; } catch (Exception e) { rsp = new System.Dynamic.ExpandoObject(); rsp.Successed = false; rsp.ErrorMessage = e.Message; rsp.ErrorCode = ""; } string retjson = JsonService.ToJson(rsp); ctx.Response.ContentType = "text/json,charset=UTF8"; return ctx.Response.WriteAsync(retjson); }
protected override void Execute() { var response = _elasticClient.Search(sd => sd .Index("logstash*") .MatchAll() .Filter(f => f.Exists("src_ip") && f.Missing("geo_json")) .Size(10) .Scroll("1m")); var cnt = 0; while (response.Documents.Any()) { foreach (var hit in response.DocumentsWithMetaData) { var ip = (string)hit.Source.src_ip; if (string.IsNullOrEmpty(ip) || string.Equals(ip, "127.0.0.1") || string.Equals(ip, "::1")) { continue; } var ipAddress = IPAddress.Parse(ip); var geoIp = _geoIpFetcher.Fetch(ipAddress); var latitude = double.Parse(geoIp.Latitude); var longitude = double.Parse(geoIp.Longitude); dynamic updateDoc = new System.Dynamic.ExpandoObject(); updateDoc.geo_country_name = geoIp.CountryName; updateDoc.geo_country_code = geoIp.CountryCode; updateDoc.geo_city = geoIp.City; updateDoc.geo_longitude = geoIp.Longitude; updateDoc.geo_latitude = geoIp.Latitude; updateDoc.geo_json = new[] { longitude, latitude }; updateDoc.geo_description = string.Format("{0} - {1}", geoIp.CountryName, geoIp.City); _elasticClient.Update<object>(u => u .Index(hit.Index) .Id(hit.Id) .Type(hit.Type) .RetriesOnConflict(4) .Document(updateDoc)); cnt++; } response = _elasticClient.Scroll("1m", response.ScrollId); } if (cnt > 0) { Logger.InfoFormat("Processed {0} new log messages", cnt); } }
public ActionResult MonthWiseTours() { dynamic model = new System.Dynamic.ExpandoObject(); model.result = from tours in db.mst_tour_dates orderby tours.Year, tours.Month,tours.Day select tours; model.resultCount = (from tours in db.mst_tour_dates orderby tours.Year, tours.Month, tours.Day select tours).Count(); return PartialView("_DateOfJourneys", model); }
public ActionResult AddModuleFunction(Entities::Models.ModuleFunction instance, string id, string hidtype) { dynamic data = new System.Dynamic.ExpandoObject(); data.one = new Entities::Models.ModuleFunction(); if (hidtype == "add") { return PartialView(new Entities::Models.ModuleFunction()); } if (hidtype == "update") { return View(_ModuleFunctionRepos.GetModuleFunctionById(id)); } return PartialView(data); }
public static void Execute() { var num1 = 1; Console.WriteLine(num1); num1 = 2; Console.WriteLine(num1); num1 += 3; // num1 = num1 + 3 Console.WriteLine(num1); num1 -= 4; // num1 = num1 - 4 Console.WriteLine(num1); num1 *= 5; // num1 = num1 * 5 Console.WriteLine(num1); num1 /= 6; // num1 = num1 / 6 Console.WriteLine(num1); num1++; // num1 = num1 + 1 Console.WriteLine(num1); num1--; // num1 - 1 Console.WriteLine(num1); // Atribuição por cópia de valor int a = 1; int b = a; Console.WriteLine(b); // Atribuição por referência dynamic c = new System.Dynamic.ExpandoObject(); c.name = "Maria"; dynamic d = c; d.name = "Bruno"; Console.WriteLine(c.name); }
public static void Executar() { dynamic meuObjeto = "teste"; meuObjeto = 3; meuObjeto++; Console.WriteLine(meuObjeto); dynamic aluno = new System.Dynamic.ExpandoObject(); aluno.nome = "Maria"; aluno.nota = 8.9; aluno.idade = 24; Console.WriteLine($"{aluno.nome} {aluno.nota} {aluno.idade}"); }
public static List <dynamic> ObtenerDetalleEjecucion(int idProyecto) { List <dynamic> detalleEjecucion = new List <dynamic>(); var res = _context.SP_TB_PROYECTO_ACTIVIDAD_ObtenerDetalleEjecucion(idProyecto); foreach (var a in res) { dynamic act = new System.Dynamic.ExpandoObject(); act.ID_EJECUCION = a.ID_EJECUCION; act.ID_PROYECTO_ACTIVIDAD = a.ID_PROYECTO_ACTIVIDAD; act.DESCRIPCION = a.DESCRIPCION; act.FECHA = a.FECHA; act.SEMANA_INICIO = a.SEMANA_INICIO.ToShortDateString(); act.SEMANA_FIN = a.SEMANA_FIN.ToShortDateString(); act.MONTO = a.MONTO_EJECUTADO; detalleEjecucion.Add(act); } return(detalleEjecucion); }
public ActionResult CustomerCollectionList(int?page, int?pagesize, string code, string unit, string key) { dynamic data = new System.Dynamic.ExpandoObject(); if (unit == null || unit == "") { unit = "0000"; } var list = _customerRepos.GetCustomerCollection(code, unit, key); int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 10; var vs = list.ToPagedList(_page, _pagesize); data.code = code; data.unit = unit; data.key = key; var pointcates = _customerRepos.GetDDLPointCategory(); var diacates = _customerRepos.GetDDLDiangosticCategory(); data.pointcates = pointcates; data.diacates = diacates; data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; string otherparam = ""; if (code != "") { otherparam += "&code=" + code; } if (unit != "") { otherparam += "&unit=" + unit; } if (key != "") { otherparam += "&key=" + key; } data.otherParam = otherparam; return(PartialView(data)); }
List<object> GetUserOverviewList(List<DBC.User> userList) { var now = DateTime.Now; var todayBegin = new DateTime(now.Year, now.Month, now.Day, 0, 0, 0); var todayEnd = new DateTime(now.Year, now.Month, now.Day, 23, 59, 59); var list = new List<object>(); foreach (var u in userList) { //日投注额 var dayBetting = 0; { var sql = string.Format("select sum(total) from {0},{1} where {1}.id={0}.userid and time>? and time<? and ({0}.userid=? or {1}.parent=?)", DBTables.Betting, DBTables.User); dayBetting =Utility.ToInt32(DB.SExecuteScalar(sql, todayBegin, todayEnd, u.ID, u.ID)); } //日获奖额 var dayWinning = 0; { var sql = string.Format("select sum(winning) from {0},{1} where {1}.id={0}.userid and time>? and time<? and ({0}.userid=? or {1}.parent=?)", DBTables.Betting, DBTables.User); dayWinning = Utility.ToInt32(DB.SExecuteScalar(sql, todayBegin, todayEnd, u.ID, u.ID)); } //累计投注额 var totalBetting = 0; { var sql = string.Format("select sum(total) from {0},{1} where {1}.id={0}.userid and ({0}.userid=? or {1}.parent=?)", DBTables.Betting, DBTables.User); totalBetting = Utility.ToInt32(DB.SExecuteScalar(sql, u.ID, u.ID)); } //累计获奖额 var totalWinning = 0; { var sql = string.Format("select sum(winning) from {0},{1} where {1}.id={0}.userid and ({0}.userid=? or {1}.parent=?)", DBTables.Betting, DBTables.User); totalWinning = Utility.ToInt32(DB.SExecuteScalar(sql, u.ID, u.ID)); } dynamic o = new System.Dynamic.ExpandoObject(); o.user = u; o.dayBetting = dayBetting; o.dayWinning = dayWinning; o.totalBetting = totalBetting; o.totalWinning = totalWinning; list.Add(o); } return list; }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var orderClause = sortName + " " + sortDir; var biz = new GetListQuanLyHopDongByCriteriaBiz(context); biz.HOP_DONG_ID = QuanLyHopDongId; biz.SKIP = _start; biz.TAKE = _length; biz.ORDER_CLAUSE = orderClause; var list = (await biz.Execute()); var total = 0; if (list.Count() > 0) { var obj = list.FirstOrDefault(); total = Protector.Int(obj.MAXCNT); } dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = total; return(ActionHelper.returnActionResult(HttpStatusCode.OK, list, _metaData)); } catch (BaseException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
/// <summary> /// Creates Repository /// </summary> /// <param name="name"></param> /// <param name="projectId"></param> /// <returns></returns> public string[] CreateRepository(string name, string projectId) { try { string[] repository = new string[2]; dynamic objJson = new System.Dynamic.ExpandoObject(); objJson.name = name; objJson.project = new System.Dynamic.ExpandoObject(); objJson.project.id = projectId; string json = Newtonsoft.Json.JsonConvert.SerializeObject(objJson); using (var client = GetHttpClient()) { var jsonContent = new StringContent(json, Encoding.UTF8, "application/json"); var method = new HttpMethod("POST"); var request = new HttpRequestMessage(method, _configuration.UriString + "/_apis/git/repositories?api-version=" + _configuration.VersionNumber) { Content = jsonContent }; var response = client.SendAsync(request).Result; if (response.IsSuccessStatusCode) { var responseDetails = response.Content.ReadAsStringAsync().Result; JObject objResponse = JObject.Parse(responseDetails); repository[0] = objResponse["id"].ToString(); repository[1] = objResponse["name"].ToString(); return(repository); } else { var errorMessage = response.Content.ReadAsStringAsync(); string error = Utility.GeterroMessage(errorMessage.Result.ToString()); this.LastFailureMessage = error; } } } catch (Exception ex) { logger.Debug(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + "CreateRepository" + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n"); } return(new string[] { }); }
public dynamic NODEA73FA1AFE7B6DB2724FAB8904D670723(dynamic param) { System.Collections.Generic.Dictionary <String, Object> GLOBAL_OUTPUT = param.GLOBAL_OUTPUT; object V = null; if (GLOBAL_OUTPUT.ContainsKey("NODEF89B9A17AB067A623D3F02B19BDE1A8B")) { try { V = ((dynamic)GLOBAL_OUTPUT["NODEF89B9A17AB067A623D3F02B19BDE1A8B"]).V; } catch (Exception e) { } } ; Console.Write(V); dynamic d = new System.Dynamic.ExpandoObject(); d.FUNCTIONNAMETOINVOKE = "null"; return(d); }
public void Should_filter_a_list_of_dynamic_types() { dynamic expando = new System.Dynamic.ExpandoObject(); expando.Foo = "Bar"; var enumerable = new System.Dynamic.IDynamicMetaObjectProvider[] { expando }; var data = QueryableFactory.CreateQueryable(enumerable) .Where(new[] { new FilterDescriptor { Member = "Foo", Operator = FilterOperator.IsEqualTo, Value = "Bar" } } ); Assert.NotNull(data.ElementAt(0)); }
public async Task <IActionResult> ResetPassword(ResetPasswordViewModel modal) { bool success = false; string message = string.Empty; ViewData["Title"] = "Reset Password"; if (!ModelState.IsValid) { ModelState.AddModelError(string.Empty, "Please fill the required fields."); return(View(modal)); } var result = await _userRepository.Email_ConfirmationAsync(modal.UserKey, modal.SecurityCode); if (result.Success) { var user = result.Data as User; user.Password = modal.Password; result = await _userRepository.Change_PasswordAsync(user); if (result.Success) { dynamic templeteObj = new System.Dynamic.ExpandoObject(); templeteObj.Message = result.Message; var Templete = _emailSender.GetMailTemplate(templeteObj, "Password_Changed_Successfully.cshtml"); await _emailSender.SendEmailAsync(user.FirstName, user.Email, result.Message, Templete); success = true; message = result.Message; } else { message = result.Message; } } else { message = result.Message; } ViewBag.Success = success; ViewBag.Message = message; return(View(modal)); }
public static List <Object> ObtenerNotificacionesNuevas(int _idUsuario) { List <Object> notificaciones = new List <Object>(); var res = _context.SP_TB_NOTIFICACION_ObtenerNuevasNotificacionesPorIdUsuario(_idUsuario); foreach (var n in res) { dynamic notificacion = new System.Dynamic.ExpandoObject(); notificacion.IdNotificacion = n.ID_NOTIFICACION; notificacion.IdEstadoProceso = n.ID_ESTADO_PROCESO; notificacion.CodigoEstadoProceso = n.CODIGO_ESTADO_PROCESO; notificacion.Descripcion = n.DESCRIPCION_ESTADO_PROCESO; notificacion.Icono = n.ICONO_ESTADO_PROCESO; notificacion.Color = n.COLOR_ESTADO_PROCESO; notificacion.Fecha = n.FECHA_CREA; notificaciones.Add(notificacion); } return(notificaciones); }
public async Task <System.Dynamic.ExpandoObject> HttpContentToVariables(MultipartMemoryStreamProvider req) { dynamic res = new System.Dynamic.ExpandoObject(); foreach (HttpContent contentPart in req.Contents) { var contentDisposition = contentPart.Headers.ContentDisposition; string varname = contentDisposition.Name; if (varname == "\"file\"") { Stream stream = await contentPart.ReadAsStreamAsync(); res.fileName = String.IsNullOrEmpty(contentDisposition.FileName) ? "" : contentDisposition.FileName.Trim('"'); res.excelStream = stream; } } return(res); }
public ActionResult dictionary(int?page) { dynamic data = new System.Dynamic.ExpandoObject(); var key = WebRequest.GetString("key", true); data.key = key; var list = systemService.GetDictionaryList(key); int _page = page.HasValue ? page.Value : 1; int _pagesize = 17; var vs = list.ToPagedList(_page, _pagesize); data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; data.otherParam = "&key=" + key; return(View(data)); }
public ActionResult AddCustomerConstruction(string code, string unit, string hidtype) { dynamic data = new System.Dynamic.ExpandoObject(); data.unit = unit; data.code = code; data.one = new Entities::Models.CustomerConstruction(); //if (hidtype == "add") //{ // return PartialView(new Entities::Models.CustomerConstruction()); //} //if (hidtype == "update") //{ // return PartialView(_CustomerConstructionRepos.GetCustomerConstructionByCode(code)); //} return(PartialView(data)); }
public ActionResult requiredetail(string no) { dynamic data = new System.Dynamic.ExpandoObject(); var list = purchaseService.RequireDetailList(no); List <PurchaseRequireDetailModel> temp = (List <PurchaseRequireDetailModel>)SessionHelper.GetSession("NE" + no + Masterpage.CurrUser.staffid); List <PurchaseRequireDetailModel> newlist = new List <PurchaseRequireDetailModel>(); if (temp != null && temp.Count > 0) { newlist.AddRange(temp); } if (list != null && list.Count > 0) { foreach (var item in list) { var h = newlist.FirstOrDefault(p => p.materialNo == item.materialNo); if (h != null) { continue; } else { newlist.AddRange(list.Select(p => new PurchaseRequireDetailModel { detailSn = p.detailSn, materialNo = p.materialNo, requireNo = p.requireNo, orderAmount = p.orderAmount, materialModel = p.materialModel, materialName = p.materialName, materialTu = p.materialTu, remark = p.remark, createDate = p.createDate, materialUnit = p.materialUnit, needdate = p.needdate, type = "" }).ToList()); } } } data.list = newlist; data.no = no; SessionHelper.SetSession("NE" + no + Masterpage.CurrUser.staffid, newlist); return(PartialView("requiredetail", data)); }
dynamic CreateExpando() { // Need a rounded date as DB can't store millis var now = DateTime.UtcNow; now = new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute, now.Second); // Setup a record dynamic o = new System.Dynamic.ExpandoObject(); o.title = string.Format("insert {0}", r.Next()); o.draft = true; o.content = string.Format("insert {0}", r.Next()); o.date_created = now; o.date_edited = now; o.state = (int)State.Maybe; return(o); }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var biz = new GetListQuanHeGiaDinhByIdBiz(context); biz.FIELD = fields; biz.SEARCH_STRING = search; biz.ORDER_CLAUSE = sortName + " " + sortDir; biz.SKIP = _start; biz.TAKE = _length; biz.LOGIN_ID = _loginId; var result = await biz.Execute(); if (string.IsNullOrEmpty(biz.MESSAGE) == false) { throw new BaseException(biz.MESSAGE.Split('|')[2]); } dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = 0; if (result.Count() > 0) { var obj = result.FirstOrDefault(); _metaData.total = Protector.Int(obj.MAXCNT); } return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData)); } catch (BaseException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public ActionResult IndexToken(int?page, int?pagesize, string name, string first) { dynamic data = new System.Dynamic.ExpandoObject(); if (name == null) { name = ""; } var list = _tokenRepos.GetTokenById(name); int _page = page.HasValue ? page.Value : 1; int _pagesize = pagesize.HasValue ? pagesize.Value : 12; var vs = list.ToPagedList(_page, _pagesize); var firstone = new DynamicToken(); if (first != null && first != "") { firstone = list.FirstOrDefault(p => p.TokenCode == first); var firspage = vs.IndexOf(firstone); if (firspage == -1) { vs.Insert(0, firstone); } else if (firspage > 0) { vs.Remove(firstone); vs.Insert(0, firstone); } } data.name = name; data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; string otherparam = ""; if (name != "") { otherparam += "&name=" + name; } data.otherParam = otherparam; return(PartialView(data)); }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var orderClause = sortName + " " + sortDir; var total = 0; var biz = new GetListNhanVienByCriteriaBiz(context); biz.FIELD = fields; biz.SEARCH_STRING = search; biz.SKIP = _start; biz.TAKE = _length; biz.ORDER_CLAUSE = orderClause; IEnumerable <dynamic> listNhanVien = await biz.Execute(); if (listNhanVien.Count() > 0) { var obj = listNhanVien.FirstOrDefault(); total = Protector.Int(obj.MAXCNT); } dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = total; return(ActionHelper.returnActionResult(HttpStatusCode.OK, listNhanVien, _metaData)); } catch (FormatException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
/// <summary> /// Ham xu ly chinh, chi nhan 1 bien moi truong /// </summary> /// <param name="context">Bien moi truong</param> /// <returns></returns> public async Task <ActionResultDto> Execute(ContextDto context) { try { Init(); Validate(); var total = 0; GetListKhoTonKhoByCriteriaBiz biz = new GetListKhoTonKhoByCriteriaBiz(context); biz.TU_NGAY = _tuNgay; biz.DEN_NGAY = _denNgay; biz.KHO_HANG_ID = _khoHangId; biz.SKIP = _start; biz.TAKE = _length; biz.LOGIN_ID = LoginId; IEnumerable <dynamic> list = await biz.Execute(); if (list.Count() > 0) { var obj = list.FirstOrDefault(); total = Protector.Int(obj.MAXCNT); } dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = total; return(ActionHelper.returnActionResult(HttpStatusCode.OK, list, _metaData)); } catch (FormatException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public dynamic HTML_Select() { try { // -- Objet dynamic -- // dynamic donnee = new System.Dynamic.ExpandoObject(); // -- Valeur vide -- // donnee.html_code = $"<option value=\"\" title=\"{App_Lang.Lang.Select}...\">{App_Lang.Lang.Select}...</option>"; donnee.html_libelle = $"<option value=\"\" title=\"{App_Lang.Lang.Select}...\">{App_Lang.Lang.Select}...</option>"; // -- Ajout des options -- // foreach (var val in Lister()) { donnee.html_code += $"<option value=\"{val.id}\" title=\"{val.code}\">{val.code}</option>"; donnee.html_libelle += $"<option value=\"{val.id}\" title=\"{val.libelle}\">{val.libelle}</option>"; } // -- Retourner l'objet -- // return(donnee); } #region Catch catch (Exception ex) { // -- Vérifier la nature de l'exception -- // if (!GBException.Est_GBexception(ex)) { // -- Log -- // GBClass.Log.Error(ex); // -- Renvoyer l'exception -- // throw new GBException(App_Lang.Lang.Error_message_notification); } else { // -- Renvoyer l'exception -- // throw new GBException(ex.Message); } } #endregion }
public ActionResult materialprice(int?page) { dynamic data = new System.Dynamic.ExpandoObject(); var sup = WebRequest.GetString("sup", true); var mat = WebRequest.GetString("mat", true); var no = WebRequest.GetString("no", true); var type = WebRequest.GetString("type", true); data.mat = mat; data.sup = sup; data.no = no; data.type = type; string where = ""; if (!string.IsNullOrEmpty(sup)) { where += " and supplierName like '%" + sup + "%' "; } if (!string.IsNullOrEmpty(type)) { where += " and type=" + type + " "; } if (!string.IsNullOrEmpty(mat)) { where += " and (materialmodel like '%" + mat + "%' or materialname like '%" + mat + "%' or tunumber like '%" + mat + "%' or pinyin like '%" + mat + "%' )"; } if (!string.IsNullOrEmpty(no)) { where += " and materialNo like '%" + no + "%'"; } var list = ServiceDB.Instance.QueryModelList <V_MaterialPriceModel>("select * from V_MaterialPriceModel where supplierid>0 " + where + " order by supplierName asc,materialname asc "); int _page = page.HasValue ? page.Value : 1; int _pagesize = 17; var vs = list.ToPagedList(_page, _pagesize); data.list = vs; data.pageSize = _pagesize; data.pageIndex = _page; data.totalCount = vs.TotalCount; data.otherParam = "&mat=" + mat + "&sup=" + sup + "&no=" + no + "&type=" + type; return(View(data)); }
static async void GetPageAsyncTest() { var model = new PageInput(); model.OrderStr = "ActionValue"; model.PageIndex = 0; // 当前索引,第一页 model.PageSize = 2; // 每页多少条 model.Offset = model.PageIndex * model.PageSize; var sqlWhere = new System.Text.StringBuilder(); dynamic pms1 = new System.Dynamic.ExpandoObject(); dynamic pms2 = new System.Dynamic.ExpandoObject(); //sqlWhere.Append(" where ActionValue=@ActionValue"); //pms1.ActionValue = 8; //sqlWhere.Append(" and ActionName like @ActionName"); //pms1.ActionName = string.Format("%{0}%", "查询"); pms2 = pms1; pms2.OrderStr = model.OrderStr; var pageOutput = await new DapperRepositoryBase <Action>().GetPageAsync(model, "Act_Action", sqlWhere.ToString(), pms1, pms2) as PageOutput; var list = new List <Action>(); foreach (dynamic item in pageOutput.Records) { list.Add(new Action { ActionId = item.ActionId, ActionName = item.ActionName, ActionValue = item.ActionValue }); } foreach (var item in list) { Console.WriteLine(item.ActionId + " " + item.ActionName + " " + item.ActionValue); } }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var biz = new InsertChiTietBiz(context); biz.PhieuBaoHanhChiTietId = 0; biz.PhieuBaoHanhId = _PhieuBaoHanhId; biz.ThietBi = _ThietBi; biz.TenThietBi = TenThietBi; biz.MoTa = MoTa; biz.ThietBiThayThe = _ThietBiThayThe; biz.TenThietBiThayThe = TenThietBiThayThe; biz.TrangThaiThietBi = TrangThaiThietBi; biz.ChiPhi = _ChiPhi; biz.ThueVAT = _ThueVAT; biz.TienThue = _TienThue; biz.KhuyenMai = _KhuyenMai; biz.LOGIN_ID = _LoginId; var result = await biz.Execute(); if (string.IsNullOrEmpty(biz.MESSAGE) == false) { throw new BaseException(biz.MESSAGE.Split('|')[2]); } dynamic _metaData = new System.Dynamic.ExpandoObject(); return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData)); } catch (BaseException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public IActionResult listUser(string SearchTerm) { List <dynamic> listUserDetails = new List <dynamic>(); try { DataTable dt = Data.User.listUser(SearchTerm); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { dynamic listUser = new System.Dynamic.ExpandoObject(); listUser.userId = (int)dt.Rows[i]["userId"]; listUser.name = (dt.Rows[i]["name"] == DBNull.Value ? "" : dt.Rows[i]["name"].ToString()); listUser.phoneNumber = (dt.Rows[i]["phoneNumber"] == DBNull.Value ? "" : dt.Rows[i]["phoneNumber"].ToString()); listUser.profileImage = (dt.Rows[i]["profileImage"] == DBNull.Value ? "" : dt.Rows[i]["profileImage"].ToString()); listUser.gender = (dt.Rows[i]["gender"] == DBNull.Value ? "" : dt.Rows[i]["gender"].ToString()); listUser.role = (dt.Rows[i]["role"] == DBNull.Value ? "" : dt.Rows[i]["role"].ToString()); listUser.latitude = (dt.Rows[i]["latitude"] == DBNull.Value ? "" : dt.Rows[i]["latitude"].ToString()); listUser.longitude = (dt.Rows[i]["longitude"] == DBNull.Value ? "" : dt.Rows[i]["longitude"].ToString()); listUser.country = (dt.Rows[i]["country"] == DBNull.Value ? "" : dt.Rows[i]["country"].ToString()); listUser.state = (dt.Rows[i]["state"] == DBNull.Value ? "" : dt.Rows[i]["state"].ToString()); listUser.cityName = (dt.Rows[i]["cityName"] == DBNull.Value ? "" : dt.Rows[i]["cityName"].ToString()); listUser.address = (dt.Rows[i]["address"] == DBNull.Value ? "" : dt.Rows[i]["address"].ToString()); listUser.createdDate = (dt.Rows[i]["createdDate"] == DBNull.Value ? "" : dt.Rows[i]["createdDate"].ToString()); listUser.savedDisplay = (dt.Rows[i]["savedDisplay"] == DBNull.Value ? 0 : (int)dt.Rows[i]["savedDisplay"]); listUser.savedRoutes = (dt.Rows[i]["savedRoutes"] == DBNull.Value ? 0 : (int)dt.Rows[i]["savedRoutes"]); listUserDetails.Add(listUser); } return(StatusCode((int)HttpStatusCode.OK, listUserDetails)); } else { return(StatusCode((int)HttpStatusCode.OK, listUserDetails)); } } catch (Exception e) { string SaveErrorLog = Data.Common.SaveErrorLog("listUser", e.Message); return(StatusCode((int)HttpStatusCode.InternalServerError, new { ErrorMessage = e.Message })); } }
public async Task <dynamic> Execute(ContextDto context) { try { if (MaTrangThai == "3") { NgayKetThuc = DateTime.Now; } dynamic result = new System.Dynamic.ExpandoObject(); var repo = new IssueRepository(context); await repo.UpdatePartial(this, nameof(KhachHangId), nameof(NguoiLienHe), nameof(DienThoai), nameof(DiDong), nameof(Email), nameof(TieuDe), nameof(MoTa), nameof(LoaiIssue), nameof(NgayDeNghi), nameof(NgayKetThuc), nameof(NguoiXuLy), nameof(CachXuLy), nameof(HuongXuLy), nameof(DanhGiaId), nameof(MaTrangThai) ); result.data = this; InsertLuocSuAction ls = new InsertLuocSuAction(); ls.InsertLuocSu(context, "Issue", IssueId, "Update", NguoiTao); return(returnActionResult(this, null)); } catch (FormatException ex) { return(returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.Message)); } }
public static object ShapeList <TSource>(this IList <TSource> obj, string fields) { List <string> lstOfFields = new List <string>(); if (string.IsNullOrEmpty(fields)) { return(obj); } lstOfFields = fields.Split(',').ToList(); List <string> lstOfFieldsToWorkWith = new List <string>(lstOfFields); List <System.Dynamic.ExpandoObject> lsobjectToReturn = new List <System.Dynamic.ExpandoObject>(); if (!lstOfFieldsToWorkWith.Any()) { return(obj); } else { foreach (var kj in obj) { System.Dynamic.ExpandoObject objectToReturn = new System.Dynamic.ExpandoObject(); foreach (var field in lstOfFieldsToWorkWith) { try { var fieldValue = kj.GetType() .GetProperty(field.Trim(), BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance) .GetValue(kj, null); ((IDictionary <String, Object>)objectToReturn).Add(field.Trim(), fieldValue); } catch { } } lsobjectToReturn.Add(objectToReturn); } } return(lsobjectToReturn); }
public static string[] GetInfo() { try { dynamic MyObject = new System.Dynamic.ExpandoObject(); MyObject.Username = CurrentUser.Username; MyObject.Name = CurrentUser.Name; MyObject.Family = CurrentUser.Family; MyObject.Address = CurrentUser.Address; MyObject.Email = CurrentUser.Email; MyObject.Mobile = CurrentUser.Mobile; #region GetProfilgePictures var RootPath = HostingEnvironment.MapPath("~/Pictures/Profiles"); var FileName = MethodExtension.GetMd5Hash(CurrentUser.salt.ToString() + CurrentUser.ID) + ".*"; var files = Directory.GetFiles(RootPath, FileName); if (files.Count() > 0) { FileName = Path.GetFileName(files[0]); } else { FileName = "default-profile.png"; } #endregion MyObject.PictureUrl = FileName; return(new string[2] { "1", Newtonsoft.Json.JsonConvert.SerializeObject(MyObject) }); } catch (Exception ex) { return(new string[2] { "0", ex.Message }); } }
private deaths_by_age_enum get_age_classifier(System.Dynamic.ExpandoObject p_source_object) { deaths_by_age_enum result = deaths_by_age_enum.blank;; object val = get_value(p_source_object, "death_certificate/demographics/age"); int value_test = 0; if (val != null && int.TryParse(val.ToString(), out value_test)) { if (value_test < 20) { result = deaths_by_age_enum.age_less_than_20; } else if (value_test < 20) { result = deaths_by_age_enum.age_less_than_20; } else if (value_test >= 20 && value_test <= 24) { result = deaths_by_age_enum.age_20_to_24; } else if (value_test >= 25 && value_test <= 29) { result = deaths_by_age_enum.age_25_to_29; } else if (value_test >= 30 && value_test <= 34) { result = deaths_by_age_enum.age_30_to_34; } else if (value_test >= 35 && value_test <= 44) { result = deaths_by_age_enum.age_35_to_44; } else if (value_test >= 45) { result = deaths_by_age_enum.age_45_and_above; } } return(result); }
private void btnSave_Click(object sender, EventArgs e) { dataGridView1.EndEdit(); Database db = Rmes.DA.Base.DB.GetInstance(); foreach (DataGridViewRow r in dataGridView1.Rows) { if (!r.IsNewRow) { dynamic a = new System.Dynamic.ExpandoObject(); string keyColName = ""; string keyColValue = ""; foreach (DataGridViewCell c in r.Cells) { string key = dataGridView1.Columns[c.ColumnIndex].Name; string val = c.Value.ToString(); if (key.Equals("RMES_ID")) { keyColName = key; keyColValue = val; } ((IDictionary <string, object>)a).Add(key, val); } if (keyColName.Equals(string.Empty)) { return; } string aa = db.ExecuteScalar <string>("select RMES_ID from " + cmbTables.SelectedValue.ToString() + " where RMES_ID=@0", keyColValue); if (aa == null || aa.Equals(string.Empty)) { object b = db.Insert(cmbTables.SelectedValue.ToString(), keyColName, false, a); MessageBox.Show(b.ToString(), "insert"); } else { int kk = db.Update(cmbTables.SelectedValue.ToString(), keyColName, a); MessageBox.Show(kk.ToString(), "udate"); } } } }