public async Task <ActionResult> SingleFile(XMLModel file) { var QRImage = await _QRCodeSvc.GetQRImage(file); // ReturnFileFromBitmap(); //Isto kao sto bi se inace vratio View, na ovaj nacin pretrazivac izbaci sirovi file(u ovom slucaju QR kod) return(File(QRImage.QRImageInBytes, "image/jpeg")); //return RedirectToAction("Index"); }
public static bool ValidateXMLFormat(string xml) { XMLModel xmlModel = GetModelFromXML(xml); if (xmlModel == null) { return(false); } return(true); }
public int GetCount(XMLModel model) { if (model != null && model.CustomFieldModelList != null) { return(GetEntities().Count(item => model.CustomFieldModelList.Any(obj => obj.Name == item.Name))); } else { return(0); } }
public int GetCount(XMLModel model) { if (model != null && model.ProjectModelList != null) { return(GetEntities().Count(item => model.ProjectModelList.Any(obj => item.Name.StartsWith(obj.NamePrefix)))); } else { return(0); } }
private static bool CheckXMLModelTaskCount(XMLModel model) { if (model != null) { if (model.CustomFieldModelList.Count != 0 || model.LookupTableModelList.Count != 0 || model.ProjectModelList.Count != 0 || model.ResourcePoolModelList.Count != 0) { return(true); } } return(false); }
public static string ReadModelToString(XMLModel model) { XmlSerializerNamespaces xns = new XmlSerializerNamespaces(); XmlSerializer xml = new XmlSerializer(typeof(XMLModel)); xns.Add(string.Empty, string.Empty); using (StringWriter textWriter = new StringWriter()) { xml.Serialize(textWriter, model, xns); string modelStr = textWriter.ToString(); modelStr = modelStr.Substring(modelStr.IndexOf(">") + 1, modelStr.Length - modelStr.IndexOf(">") - 1); textWriter.Close(); return(modelStr); } }
public string TxtProcess(XMLModel model) { string msg = ""; if (Regex.Match(model.Content, @"^(\d{3})$").Success) { msg = GetBusInfo(model.Content); } else if (model.Content.Length > 4 && model.Content.Substring(0, 4) == "/yys") { string ss = model.Content.Substring(4); msg = GetYYS(ss); } else { msg = TuLing.tuling_reply(model.Content); } model.Content = msg; return(MsgOperate.PassiveRecovery(model)); }
/// <summary> /// LoadXML /// Loading Data From XML File. /// </summary> /// <param name="XMLPath">DATA path for XML Extension</param> public XMLModel LoadXML(string XMLPath) { if (string.IsNullOrWhiteSpace(XMLPath)) { throw new FileNotFoundException($"File not found : {XMLPath}"); } try { XmlReader reader = XmlReader.Create(XMLPath); XmlSerializer serializer = new XmlSerializer(typeof(XMLModel)); XMLModel xmlModel = (XMLModel)serializer.Deserialize(reader); reader.Close(); reader.Dispose(); return(xmlModel); } catch (Exception ex) { throw new Exception("XML Loading Exception\r\n" + ex.Message); } }
public string WatchEvent(XMLModel model) { switch (model.Event) { case "subscribe": RedisUtil.Instance.HashSet("WatchUser", model.FromUserName, JsonConvert.SerializeObject(new { NickName = "", WatchTime = model.CreateTime })); BaseD.UserList.Clear(); Common.WriteLog($"{model.FromUserName} 关注了你"); Passive Reply = new Passive { Content = "您好!欢迎关注,有什么需求可以留言", FromUserName = model.ToUserName, ToUserName = model.FromUserName }; return(Reply.ToString()); case "unsubscribe": RedisUtil.Instance.RemoveHashItem("WatchUser", model.FromUserName); BaseD.UserList.Clear(); Common.WriteLog($"{model.FromUserName} 取消关注了你"); return(""); default: return(""); } }
public IActionResult GenerateXML(XMLModel model) { MemoryStream ms = new MemoryStream(); XmlWriterSettings xws = new XmlWriterSettings(); xws.OmitXmlDeclaration = true; xws.Indent = true; using (XmlWriter xw = XmlWriter.Create(ms, xws)) { XDocument doc = new XDocument( new XElement("Kafa", new XElement("NazivLokala", model.Name), new XElement("Koordinate", model.Coordinates) ) ); doc.WriteTo(xw); } ms.Position = 0; return(File(ms, "text/xml")); // return RedirectToAction(ms, "text/xml", "Sample.xml"); }
public static XMLModel ResolveXML(XDocument xmldoc) { XMLModel model = new XMLModel(); XElement xmlele = xmldoc.Root; var ps = typeof(XMLModel).GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance); for (var i = 0; i < ps.Length; i++) { var a = xmlele.Element(ps[i].Name); try { if (a != null) { ps[i].SetValue(model, Convert.ChangeType(a.Value, ps[i].PropertyType)); } } catch (Exception ex) { var aa = a; string msg = ex.Message + "!!具体:" + ex.InnerException; } } return(model); }
public int GetCount(XMLModel model) { return(ExecuteAPITask <XMLModel, int>(this.baseClient.GetCount, model)); }
public int GetCount(XMLModel model) { return(this.bc.GetCount(model)); }