public UpdateBuilder <T> UseTTL(long ttl) { UpdateParameter parameter = new UpdateParameter(UpdateParameter.UpdateParameterTypes.TTL, GetParameterValue(ttl)); CurrentQuery.UpdateParameters.Add(parameter); return(this); }
public UpdateBuilder <T> UseTimestamp(long timestamp) { UpdateParameter parameter = new UpdateParameter(UpdateParameter.UpdateParameterTypes.Timestamp, GetParameterValue(timestamp)); CurrentQuery.UpdateParameters.Add(parameter); return(this); }
private static void UpdateThread(object threadParam) { UpdateParameter up = (UpdateParameter)threadParam; try { string url = up.XmlUrl; WebClient wc = new WebClient(); Stream respStream = wc.OpenRead(url); StreamReader sr = new StreamReader(respStream); string s = sr.ReadToEnd(); s = System.Net.WebUtility.HtmlDecode(s); string start = "<?xml version=\"1.0\" encoding=\"utf-8\"?>"; int p1 = s.IndexOf(start); string end = "</AutoUpdate>"; int p2 = s.IndexOf(end, p1); s = s.Substring(p1, p2 - p1 + end.Length); s = s.Replace("<br />", "\n"); XmlDocument XmlDoc = new XmlDocument(); XmlDoc.LoadXml(s); XmlNode VersionNode = XmlDoc.SelectSingleNode(@"//Version"); string version = VersionNode.InnerText; XmlNode Information = XmlDoc.SelectSingleNode(@"//Information"); string information = Information.InnerText; Version curVersion = Assembly.GetEntryAssembly().GetName().Version; Version newVersion = new Version(version); if (newVersion > curVersion) { string prompt = String.Format("New version detected.\r\nDo you want to update now?\r\n\r\nNew version: {0}\r\nYour version: {1}\r\n\r\nInformation: \r\n{2}\r\n", newVersion.ToString(), curVersion.ToString(), String.IsNullOrEmpty(information) ? "Author is lazy, doesn't leave any information." : information); if (SimpleMessage.Confirm(prompt) == DialogResult.Yes) { Process p = new Process(); p.StartInfo.FileName = up.HomeUrl; p.Start(); } } else { if (!up.Silent) { SimpleMessage.ShowInfo("You already have latest version.", "Check for Update"); } } } catch (Exception ex) { if (!up.Silent) { SimpleMessage.ShowException(ex, SimpleDotNet.ReportUrl); } } } //updateThread()
public static void CheckForUpdate(string xmlUrl, string homeUrl, bool silent) { UpdateParameter up = new UpdateParameter(); up.XmlUrl = xmlUrl; up.HomeUrl = homeUrl; up.Silent = silent; Thread t = new Thread(new ParameterizedThreadStart(UpdateThread)); t.IsBackground = true; t.Start(up); }
public void EditControllerUpdate(int id, int userId, int entityId, UpdateParameter parameterId, ControllerStatus statusId, string value) { using (IUnitOfWork work = UnitOfWork.Begin()) { var cu = _controllerUpdateRepository.FindById(id); cu.DateLastChanged = DateTime.Now; cu.ParameterId = (int)parameterId; cu.Status = (int)statusId; cu.EntityId = entityId; cu.Value = string.IsNullOrEmpty(value) ? "" : value; cu.IsDeleted = false; work.Commit(); } }
public void CreateControllerUpdate(int userId, int entityId, UpdateParameter parameterId, ControllerStatus statusId, string value) { ControllerUpdate cu = _controllerUpdateRepository.FindAll().Where(x => x.ParameterId == (int)parameterId && x.EntityId == entityId). FirstOrDefault(); if (cu == null) { using (IUnitOfWork work = UnitOfWork.Begin()) { cu = new ControllerUpdate { DateAdded = DateTime.Now }; cu.DateLastChanged = cu.DateAdded; cu.ParameterId = (int)parameterId; cu.Status = (int)statusId; cu.EntityId = entityId; cu.Value = string.IsNullOrEmpty(value) ? "" : value; cu.IsDeleted = statusId == ControllerStatus.Deleted; _controllerUpdateRepository.Add(cu); /*var removedEntities = * _controllerUpdateRepository.FindAll().Where(x => x.DateLastChanged.AddDays(_configurationSettings.ControllerUpdateRecordLife) < DateTime.Now); * foreach (var controllerUpdate in removedEntities) * { * _controllerUpdateRepository.Delete(controllerUpdate); * } */ work.Commit(); } } else { if (statusId == ControllerStatus.Deleted) { DeleteControllerUpdate(cu.Id, userId, entityId, parameterId, statusId, value); } else { EditControllerUpdate(cu.Id, userId, entityId, parameterId, ControllerStatus.Edited, value); } } }
internal override void Draw(UpdateParameter updateParameter) { }
public void ProcessRequest(HttpContext context) { try { m_da = new Accudata.Data.Agent.DataAccessAgent(); JavaScriptSerializer serializer = new JavaScriptSerializer(); var data = serializer.DeserializeObject(context.Request.Form[0]); Dictionary <string, object> dictData = (Dictionary <string, object>)data; object[] objData = dictData.Values.ToArray()[4] as object[]; var searchNo = dictData.Values.ToArray()[0].ToString(); var note = dictData.Values.ToArray()[1].ToString(); var userId = dictData.Values.ToArray()[2].ToString(); var empNo = dictData.Values.ToArray()[3].ToString(); List <UDA_D_JOBCONDITION> udjcList = new List <UDA_D_JOBCONDITION>(); List <UDA_D_JOB_OUTCONDITION> udjocList = new List <UDA_D_JOB_OUTCONDITION>(); foreach (Dictionary <string, object> item in objData) { if (item["Type"].ToString() == "UDA_D_CONDITIN") { UDA_D_JOBCONDITION udjc = new UDA_D_JOBCONDITION(); foreach (string key in item.Keys) { PropertyInfo pi = udjc.GetType().GetProperties() .Where(prop => prop.GetCustomAttributes(typeof(NameMappingAttribute), false).Cast <NameMappingAttribute>().Where(attr => attr.JsonName == key).Count() > 0).DefaultIfEmpty(null).First(); if (pi != null) { pi.SetValue(udjc, ConvertType(pi, item[key]), null); } } udjcList.Add(udjc); } else { UDA_D_JOB_OUTCONDITION udjoc = new UDA_D_JOB_OUTCONDITION(); foreach (string key in item.Keys) { PropertyInfo pi = udjoc.GetType().GetProperties() .Where(prop => prop.GetCustomAttributes(typeof(NameMappingAttribute), false).Cast <NameMappingAttribute>().Where(attr => attr.JsonName == key).Count() > 0).DefaultIfEmpty(null).First(); if (pi != null) { pi.SetValue(udjoc, ConvertType(pi, item[key]), null); } } udjocList.Add(udjoc); } } UpdateParameter[] ups = new UpdateParameter[5]; ups[0] = new UpdateParameter("i_SEARCH_NO", "OleDbType.Integer", 10, searchNo, "ParameterDirection.Input"); ups[1] = new UpdateParameter("i_EMP_NO", "OleDbType.VarChar", 30, empNo, "ParameterDirection.Input"); ups[2] = new UpdateParameter("i_USER_ID", "OleDbType.VarChar", 30, userId, "ParameterDirection.Input"); ups[3] = new UpdateParameter("i_NOTE", "OleDbType.VarChar", 100, note, "ParameterDirection.Input"); ups[4] = new UpdateParameter("o_JOB_NO", "OleDbType.Integer", 24, "", "ParameterDirection.Output"); //呼叫SP string[] getData = m_da.Update("sp_create_new_job", ups, m_connectionStringKey); //資料更新 List <string> uCmd = new List <string>(); foreach (var item in udjcList) { uCmd.Add(string.Format(@"UPDATE UDA_D_JOBCONDITION SET COND_VALUE = '{0}' WHERE JOB_NO = '{1}' AND STEP_ID = '{2}' AND COLUMN_SEQ = '{3}' AND CONDTITION_ID = '{4}'", item.COND_VALUE, getData[0], item.STEP_ID, item.COLUMN_SEQ, item.CONDTITION_ID)); } m_da.Update(uCmd.ToArray(), m_connectionStringKey); string agIP = WebConfigurationManager.AppSettings["agentIP"]; int agPort = int.Parse(WebConfigurationManager.AppSettings["agentPort"]); Agent ag = new Agent(agIP, agPort); ag.ExecuteJob(getData[0].ToString()); } catch (Exception) { throw; } }
// PUT: api/ScheduleItem/5 public ReferenceData Put(long id, [FromBody] UpdateParameter updateParameter) => ScheduleItemRepository.UpdateScheduleItem(updateParameter);
// POST: api/ScheduleItem public ReferenceData Post([FromBody] UpdateParameter updateParameter) => ScheduleItemRepository.CreateScheduleItem(updateParameter);