コード例 #1
0
 //
 public NvaAxController(IAxCommon dbcontext, IHttpErrorBuilder _errorBuilder, DataContextHelper _contextHelper, EntytyMetadatasHelper _mdHelper)
 {
     context       = dbcontext;
     errorBuilder  = _errorBuilder;
     contextHelper = _contextHelper;
     mdHelper      = _mdHelper;
 }
コード例 #2
0
        public string BuildResponse(NVAATS_PARAMS _pars, IAxCommon context)
        {
            //var 1 = (1)

            var proc = new Resp <(NVAATS_PARAMS prs, IAxCommon ctx)>(0, (_pars, context))
                       .Step <(NVAATS_PARAMS prs, IAxCommon ctx, NVAATS_SETTING stng)>(
                x => x.ctx.NvaAtsSetting.Access.Reader.GetAll().Count() > 0,
                1,                                                                                              // Не вижу сеттинга
                x => (x.prs, x.ctx, x.ctx.NvaAtsSetting.Access.Reader.GetAll().First(r => true)),
                (null, null, null)
                )
                       .Step(
                x =>
                x.stng.ISAUTHONLY == 0 ||
                (x.prs.uid != null &&
                 ((
                      x.prs.pwd != null &&
                      x.prs.pwd == x.stng.PASS &&
                      x.prs.uid == x.stng.LOGIN
                      ) || (
                      x.prs.pwd != null &&
                      x.prs.pwd == x.stng.PASS2 &&
                      x.prs.uid == x.stng.LOGIN2
                      )
                 )),
                3,                                                                                          // Auth false
                x => x
                )
                       .Step(
                x => x.prs.aNumber != null,
                105,
                x => x
                )
                       .Step <(NVAATS_PARAMS prs, IAxCommon ctx, NVAATS_SETTING stng, NVAATS_PHONES phn)>(
                x => x.ctx.NvaAtsPhones.Access.Reader.Find(x.prs.aNumber) != null,
                4,                                                                                          // Phone not found
                x => (x.prs, x.ctx, x.stng, x.ctx.NvaAtsPhones.Access.Reader.Find(x.prs.aNumber)),
                (null, null, null, null)
                )
                       .Step <string>(
                x => true,
                0,
                x => this.buildBody(x.prs, x.ctx, x.stng, x.phn),
                (null)
                )
                       .Step(
                x => x != null,
                2,
                x => x
                );


            return(this.BuildWrap(proc.Err, proc.Body));
        }
コード例 #3
0
 public MdController(IAxCommon _dbcontext, EntytyMetadatasHelper _mdHelper)
 {
     context  = _dbcontext;
     mdHelper = _mdHelper;
 }
コード例 #4
0
 public NvaSdEventTypeController(IAxCommon _dbcontext)
 {
     context = _dbcontext;
 }
コード例 #5
0
ファイル: EnumController.cs プロジェクト: jsdelivrbot/WebGate
 public EnumController(IAxCommon _dbcontext)
 {
     context = _dbcontext;
 }
コード例 #6
0
        private string buildBody(NVAATS_PARAMS prs, IAxCommon ctx, NVAATS_SETTING stng, NVAATS_PHONES phn)
        {
            try
            {
                var dev   = ctx.NvaAtsDevice.Access.Reader.Find(phn.DEVICEID);
                var devid = (dev == null) ? Guid.Empty.ToString() : dev.GUID.ToString();

                var bld   = ctx.NvaAtsBuilding.Access.Reader.Find(phn.BUILDINGID);
                var bldid = (bld == null) ? Guid.Empty.ToString() : bld.GUID.ToString();


                var doc = new XmlDocument();

                XmlDeclaration xmlDeclaration = doc.CreateXmlDeclaration("1.0", "UTF-8", null);

                XmlElement root = doc.DocumentElement;
                doc.InsertBefore(xmlDeclaration, root);

                //(2) string.Empty makes cleaner code
                XmlElement element1 = doc.CreateElement(string.Empty, "presence", "urn:ietf:params:xml:ns:pidf");

                //slide2XmlWriter.WriteAttributeString("xmlns", "a", null, "http://schemas.openxmlformats.org/drawingml/2006/main");


                var ns_dm = "urn:ietf:params:xml:ns:pidf:data-model";
                var ns_gp = "urn:ietf:params:xml:ns:pidf:geopriv10";
                var ns_cl = "urn:ietf:params:xml:ns:pidf:geopriv10:civicLoc";


                element1.SetAttribute("xmlns:dm", ns_dm);
                element1.SetAttribute("xmlns:gp", ns_gp);
                element1.SetAttribute("xmlns:cl", ns_cl);
                element1.SetAttribute("entity", phn.PHONE);
                doc.AppendChild(element1);

                XmlElement element2 = doc.CreateElement("dm", "device", ns_dm);
                element2.SetAttribute("id", devid);
                element1.AppendChild(element2);

                XmlElement element3 = doc.CreateElement("gp", "geopriv", ns_gp);
                element2.AppendChild(element3);

                XmlElement element4 = doc.CreateElement("gp", "location-info", ns_gp);
                element3.AppendChild(element4);

                XmlElement element5 = doc.CreateElement("cl", "civicAddress", ns_cl);
                element4.AppendChild(element5);

                var el = doc.CreateElement("cl", "HOUSEGUID", ns_cl);
                el.InnerText = bldid;
                element5.AppendChild(el);

                el           = doc.CreateElement("cl", "ENTRANCE", ns_cl);
                el.InnerText = phn.ENTRANCE;
                element5.AppendChild(el);

                el           = doc.CreateElement("cl", "LEVEL", ns_cl);
                el.InnerText = phn.LEVEL_;
                element5.AppendChild(el);

                el           = doc.CreateElement("cl", "ROOM", ns_cl);
                el.InnerText = phn.ROOM;
                element5.AppendChild(el);


                element3           = doc.CreateElement("dm", "deviceID", ns_dm);
                element3.InnerText = phn.PHONE;
                element2.AppendChild(element3);

                element3           = doc.CreateElement("dm", "timestamp", ns_dm);
                element3.InnerText = DateTime.Now.ToString(); //DateTime.Now.fo.ToLongDateString()+ "T"+DateTime.Now.ToLongTimeString()+"Z";
                element2.AppendChild(element3);


                using (var stringWriter = new StringWriter())
                    using (var xmlTextWriter = XmlWriter.Create(stringWriter))
                    {
                        doc.WriteTo(xmlTextWriter);
                        xmlTextWriter.Flush();
                        return(stringWriter.GetStringBuilder().ToString());
                    }
            }
            catch (Exception e)
            {
                return(null);
            }
        }
コード例 #7
0
 public GetAbonentLocationController(IAxCommon _dbcontext, Resp112Helper _atsHelper)
 {
     context   = _dbcontext;
     atsHelper = _atsHelper;
 }