Example #1
0
        private async void UpdateCa()
        {
            List <Ca>     ca         = new List <Ca>();
            Task <string> callTaskca = Task.Run(() => GetAllCa());

            callTaskca.Wait();
            string    astrca = callTaskca.Result;
            List <Ca> caan   = JsonConvert.DeserializeObject <List <Ca> >(astrca);

            ca = caan.Where(c => c.tenca == comboBox1.Text).ToList();
            if (ca.Count > 0)
            {
                Ca canew = new Ca();
                canew.ID           = ca.First().ID;
                canew.thucdonid    = ca.First().thucdonid;
                canew.tenca        = ca.First().tenca;
                canew.tongsuatan   = ca.First().tongsuatan;
                canew.suatanconlai = ca.First().suatanconlai - 1;
                using (var client = new HttpClient())
                {
                    var serializedProduct = JsonConvert.SerializeObject(canew);
                    var content           = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
                    var result            = await client.PutAsync(String.Format("{0}/{1}", APIca, canew.ID), content);
                }
            }
        }
Example #2
0
        private void btnVaoCa_Click(object sender, EventArgs e)
        {
            //KHOI TAO THC VA LUU TRU

            if (nhatKy != null || thucHienCaID == null)
            {
                return;
            }
            Ca ca = new Ca();

            ca.maCa     = thucHienCaID;
            ca.thoiGian = "" + DateTime.Now;
            ca.maKip    = cbKip.Text.Substring(0, cbKip.Text.IndexOf(" - "));

            DBCa dbCa     = new DBCa();
            bool isUpdate = false;

            if (dbCa.isExisted(ca.maCa, ca.maKip))
            {
                DialogResult dlr = MessageBox.Show("Bạn có muon doi kip?", "IceTea Việt", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dlr == DialogResult.No)
                {
                    return;
                }
                isUpdate = true;
            }

            dbCa.addNewCa(ca, isUpdate);
            nhatKy         = new NhatKy(thucHienCaID, ca.maKip);
            nhatKy.Closed += nhatKy_Closed;
            nhatKy.Show();
        }
Example #3
0
        static void CheckValidityOfResponse(CertID id, BasicOcspResp responseObject, Ca ca)
        {
            var inputStream  = new MemoryStream(responseObject.GetEncoded());
            var asn1Sequence = (Asn1Sequence) new Asn1InputStream(inputStream).ReadObject();

            var response = BasicOcspResponse.GetInstance(asn1Sequence);

            var ocspChain = CreateOcspCertificateChain(ca);

            if (ocspChain.Length == 0)
            {
                throw new OcspException("OCSP certificate chain is invalid");
            }
            var ocesOcspCertificate = OcesCertificateFactory.Instance.Generate(CompleteOcspChain(response, ocspChain));

            CheckBasicOcspResp(id, responseObject, ocesOcspCertificate, ca);

            var signingCertificate = new X509CertificateParser().ReadCertificate(response.Certs[0].GetEncoded());
            var issuingCertificate = new X509CertificateParser().ReadCertificate(ocspChain[0].GetRawCertData());

            signingCertificate.Verify(issuingCertificate.GetPublicKey());
            if (!responseObject.Verify(signingCertificate.GetPublicKey()))
            {
                throw new OcspException("Signature is invalid");
            }
        }
 public bool Create(CaDTO caDto)
 {
     try
     {
         var ca = new Ca
         {
             MaCa      = Guid.NewGuid(),
             MaBienThe = caDto.MaBienThe,
             TenCa     = caDto.TenCa,
             GioiTinh  = Convert.ToInt32(caDto.GioiTinh),
             NgaySinh  = caDto.NgaySinh,
             KichThuoc = caDto.KichThuoc,
             NgayDo    = caDto.NgayDo,
             DonGia    = Convert.ToDouble(caDto.DonGia),
             Tuoi      = caDto.Tuoi,
             TinhTrang = Convert.ToBoolean(caDto.TinhTrang)
         };
         _caRepository.Insert(ca);
         _unitOfWork.Commit();
         return(true);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
Example #5
0
File: Registro.cs Project: Cdrix/SM
    /// <summary>
    /// Remove item from All, and its spefic list
    /// </summary>
    /// <param name="cat">item category</param>
    /// <param name="myId">item myId</param>
    public void RemoveItem(Ca cat, string myId)
    {
        var build = Brain.GetBuildingFromKey(myId);

        AddToDestroyBuilding(Brain.GetBuildingFromKey(myId));

        //Debug.Log("Registro RemoveItem");
        PersonPot.Control.BuildersManager1.RemoveConstruction(myId);//so its removed from the BuilderManager

        BuildingPot.Control.DockManager1.RemoveFromDockStructure(myId, build.HType);


        ////so its save to AllRegFiles
        AllBuilding[myId].Instruction = H.WillBeDestroy;
        ResaveOnRegistro(myId);

        AllBuilding[myId].UpdateOnBuildControl(H.Remove);//so its remove from build control.
        RemoveRegularOrders(myId);
        AddEvacutationOrder(myId);

        UpdateCurrentVertexRect(m.CurrentHoverVertices);
        if (cat == Ca.Way)
        {
            _ways.Remove(myId);
        }
        else if (cat == Ca.Structure || cat == Ca.Shore)
        {
            _structures.Remove(myId);
        }
        else if (cat == Ca.DraggableSquare)
        {
            _dragSquare.Remove(myId);
        }
    }
        public ActionResult UpisivanjeCasa()
        {
            if (Session["userID"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            var korisnikid   = Convert.ToInt32(Session["KorisnikID"]);
            var idProfesor   = db.Profesors.Where(x => x.id_Korisnik_FK == korisnikid).Select(x => x.ProfesorID).FirstOrDefault();
            var imeProfesora = db.Korisniks.Where(x => x.ID_Korisnik == korisnikid).Select(x => x.Ime).FirstOrDefault();
            var ListaKurseva = new SelectList(db.Kurs, "ID_Kurs", "Ime");

            skolaView.KurseviLista = ListaKurseva;
            skolaView.imeProfesora = imeProfesora;
            Ca cas = new Ca {
                ProfesorID = idProfesor, Datum = DateTime.Today
            };

            skolaView.Cas = cas;

            if (TempData["SuccMsg"] != null)
            {
                ViewBag.SuccMsg = TempData["SuccMsg"];
            }

            return(View(skolaView));
        }
Example #7
0
        public void Ca_ForNotUsedType()
        {
            Ca ca = Ca.For <FooCalculator>();

            ca.Value.Should().Be(0);
            ca.References.Should().Be.Empty();
        }
Example #8
0
    /// <summary>
    /// Will select clicked building and ret true if one was seelected
    /// </summary>
    /// <returns></returns>
    bool SelectClickedBuild()
    {
        if (!Input.GetMouseButtonUp(0))
        {
            return(false);
        }

        List <string> names   = new List <string>();
        var           clicked = ReturnBuildinHit();

        //unselect if was click outise
        if (clicked != null)
        {
            names = UString.ExtractNamesUntilGranpa(clicked);
            Program.InputMain.InputMouse.UnSelectRoutine(names, clicked);
        }
        //select new Build
        if (names.Count > 0)
        {
            for (int i = 0; i < names.Count; i++)
            {
                H  typeL = Program.InputMain.InputMouse.FindType(names[i]);
                Ca cat   = DefineCategory(typeL);
                Program.InputMain.InputMouse.Select(cat, names[i]);
                ManagerReport.AddInput("Selected building: " + names[i]);

                if (BuildingPot.Control.Registro.SelectBuilding != null)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
        public ActionResult upisiCas(Ca cas)
        {
            if (ModelState.IsValid)
            {
                db.Cas.Add(cas);
                db.SaveChanges();

                TempData["SuccMsg"] = "Uspešno unet novi čas";
                return(RedirectToAction("UpisivanjeCasa"));
            }
            else
            {
                ViewBag.ErrMsg = "Cas nije upisan!";
                var korisnikid   = Convert.ToInt32(Session["KorisnikID"]);
                var idProfesor   = db.Profesors.Where(x => x.id_Korisnik_FK == korisnikid).Select(x => x.ProfesorID).FirstOrDefault();
                var imeProfesora = db.Korisniks.Where(x => x.ID_Korisnik == korisnikid).Select(x => x.Ime).FirstOrDefault();
                var ListaKurseva = new SelectList(db.Kurs, "ID_Kurs", "Ime");

                skolaView.KurseviLista = ListaKurseva;
                skolaView.imeProfesora = imeProfesora;
                Materijal materijal = new Materijal {
                    ProfesorID = idProfesor
                };
                skolaView.Materijal = materijal;
                return(View("UpisivanjeCasa", skolaView));
            }
        }
Example #10
0
    /// <summary>
    /// Will add a poly with the seq NW, NE, SE, SW to the _allBuilding List. then will call UpdateCurrentVertexRect()
    /// Adds the file to Registro All that is the save list to file of buildings
    /// </summary>
    public void AddBuildToAll(Building build, List <Vector3> poly, Ca categ, Vector3 iniPosition,
                              Inventory inventory,
                              List <string> PeopleDict,
                              List <VectorLand> LandZone1,
                              List <Vector3> polyHoriz       = null,
                              List <Vector3> tilePosVert     = null, List <Vector3> tilePosHor = null, List <Vector3> planesOnAirPos = null,
                              Vector3 tileScale              = new Vector3(), List <int> parts = null,
                              H dominantSide                 = H.None, H startingStage = H.None, int rotationFacerIndex        = -1, string materialKey = "",
                              List <Vector3> planesOnSoilPos = null, List <int> partsOnSoil = null, Vector3 min                = new Vector3(),
                              Vector3 max                     = new Vector3(), H instructionP = H.None, BookedHome BookedHome1 = null,
                              Dispatch dispatch               = null, Family[] Families       = null,
                              int dollarsPay                  = 0,
                              List <Vector3> anchors          = null, Dock dock = null, string root = "",
                              BuildersManager buildersManager = null
                              )
    {
        // 12 hours to find this OMG!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        // I was creating the recatblgele and not inverting Y.. then I invert Y but didint inverted in
        //IsColliding() chet !!!! And i knew it bz i inverted the big rectangle...
        //with the rectangles inverted works like a charm... we have to do it bz im using North as bigger
        //and south as less... in the Rect cordinates is the other way around

        //this is the usual poly will be filled for eg regular structures only use this one.
        //For ways is the vertic bound
        var to = ReturnDimOnMap(poly);

        Rect toHoriz = new Rect();

        if (polyHoriz != null)
        {
            toHoriz = U2D.FromPolyToRect(polyHoriz);
            toHoriz = U2D.ReturnRectYInverted(toHoriz);
        }

        //ading to All
        RegFile regFile = new RegFile(build, to, categ, iniPosition,
                                      inventory,
                                      PeopleDict, LandZone1,
                                      toHoriz, tilePosVert: tilePosVert, tilePosHor: tilePosHor,
                                      planesOnAirPos: planesOnAirPos, tileScale: tileScale, partsOnAir: parts, dominantSide: dominantSide, startingStage: startingStage, rotationFacerIndex: rotationFacerIndex,
                                      materialKey: materialKey, planesOnSoilPos: planesOnSoilPos, partsOnSoil: partsOnSoil, min: min, max: max,
                                      instructionP: instructionP, bookedHome: BookedHome1, dispatch: dispatch, familes: Families,
                                      dollarsPay: dollarsPay,
                                      anchors: anchors, dock: dock, root: root,
                                      buildersManager: buildersManager);

        //UVisHelp.CreateHelpers(anchors, Root.blueCube);
        AddToAll(regFile);
        AddToBuilderManager(build.MyId);

        AddSpecToList(categ);
        if (_locHoverVert.Count > 0)
        {
            UpdateCurrentVertexRect(_locHoverVert);
        }
        //use on the drawing debug functionalitie only:
        //toDraw.Add(to);
        //toDraw.Add(toHoriz);
    }
Example #11
0
    public RegFile(Building build, Rect dimOnMap, Ca category, Vector3 iniPosition,
                   Inventory InventoryP,
                   List <string> peopleDict,
                   List <VectorLand> LandZone1,
                   Rect dimOnMapHor               = new Rect(),
                   List <Vector3> tilePosVert     = null, List <Vector3> tilePosHor      = null, List <Vector3> planesOnAirPos = null,
                   Vector3 tileScale              = new Vector3(), List <int> partsOnAir = null,
                   H dominantSide                 = H.None, H startingStage = H.None, int rotationFacerIndex       = -1, string materialKey = "",
                   List <Vector3> planesOnSoilPos = null, List <int> partsOnSoil = null, Vector3 min               = new Vector3(),
                   Vector3 max                     = new Vector3(), H instructionP = H.None, BookedHome bookedHome = null,
                   Dispatch dispatch               = null, Family[] familes        = null,
                   int dollarsPay                  = 0,
                   List <Vector3> anchors          = null, Dock dock = null, string root = "",
                   BuildersManager buildersManager = null
                   )
    {
        MyId         = build.MyId;
        HType        = build.HType;
        _dimOnMap    = dimOnMap;
        Category     = category;
        _iniPos      = iniPosition;
        _dimOnMapHor = dimOnMapHor;
        _tilePosVert = tilePosVert;
        _tilePosHor  = tilePosHor;
        _tileScale   = tileScale;
        //bridge stuff
        _partsOnAir    = partsOnAir;
        _dominantSide  = dominantSide;
        _planeOnAirPos = planesOnAirPos;
        _planesOnSoil  = planesOnSoilPos;
        _partsOnSoil   = partsOnSoil;

        _startingStage      = startingStage;
        _rotationFacerIndex = rotationFacerIndex;
        _materialKey        = materialKey;
        _min        = min;
        _max        = max;
        Instruction = instructionP;

        Inventory      = InventoryP;
        PeopleDict     = peopleDict;
        this.LandZone1 = LandZone1;
        BookedHome1    = bookedHome;

        Dispatch1  = dispatch;
        Familes    = familes;
        DollarsPay = dollarsPay;
        Anchors    = anchors.ToArray();
        Dock1      = dock;

        Root = root;

        ProductionReport = build.ProductionReport;
        MaxPeople        = build.MaxPeople;
        Decoration       = build.Decoration1;
        Name             = build.NameBuilding();

        BuildersManager = buildersManager;
    }
Example #12
0
        public ActionResult DeleteConfirmed(string id)
        {
            Ca ca = db.Cas.Find(id);

            db.Cas.Remove(ca);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Example #13
0
 public bool IsRevoked(Ca ca)
 {
     if (ca.IsRoot)
     {
         return(false);
     }
     return(DownloadCrl(ca).IsRevoked(ca) || IsRevoked(ca.IssuingCa));
 }
Example #14
0
        public void Ca_ForTypeThatIsReferencedByOtherTypes()
        {
            Ca ca = Ca.For <FooException>();

            ca.Value.Should().Be(2);
            ca.References.Should().Have.SameValuesAs(new Type[] {
                typeof(TryToCatchFooException), typeof(FooCalculator)
            });
        }
Example #15
0
        public void GetContentsOfTagTest()
        {
            Ca.TestName = "GetContentsOfTagTest";

            string value = Ca.GetContentsOfTag("body");

            TestContext.WriteLine(value);
            Assert.IsTrue(value.Length > 0);
        }
Example #16
0
        public void CheckPublic()
        {
            Ca.TestName = "PublicUI";
            Ca.WaitTillElementFound("//ul[@id='jetmenu']/li[3]/a", GeneralActions.FindBy.XPath, GeneralActions.MyAction.Click);
            Ca.WaitTillElementFound("My Gun Collection", GeneralActions.FindBy.LinkText, GeneralActions.MyAction.Click);

            Ca.WaitTillElementFound("//ul[@id='jetmenu']/li[3]/a", GeneralActions.FindBy.XPath, GeneralActions.MyAction.Click);
            Ca.WaitTillElementFound("My Loaders Log", GeneralActions.FindBy.LinkText, GeneralActions.MyAction.Click);
            Ca.WaitTillElementFound("//ul[@id='jetmenu']/li[3]/a", GeneralActions.FindBy.XPath, GeneralActions.MyAction.Click);
        }
Example #17
0
 public ActionResult Edit([Bind(Include = "SoCa,Ngay")] Ca ca)
 {
     if (ModelState.IsValid)
     {
         db.Entry(ca).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(ca));
 }
        public bool IsRevoked(Ca ca)
        {
            if (ca.IsRoot)
            {
                return(false);
            }
            OcesEnvironment environment = RootCertificates.GetEnvironment(ca.IssuingCa);

            return(DownloadCrl(ca, environment).IsRevoked(ca) || IsRevoked(ca.IssuingCa));
        }
Example #19
0
    // Use this for initialization
    protected void Start()
    {
        _category = DefineCategory(_hType);

        if (AudioCollector.Roots.ContainsKey(HType + ""))
        {
            _audioReporter = new AudioReporter(this);
        }

        StartCoroutine("TwoSecUpdate");
    }
Example #20
0
        public ActionResult Create([Bind(Include = "SoCa,Ngay")] Ca ca)
        {
            if (ModelState.IsValid)
            {
                db.Cas.Add(ca);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(ca));
        }
Example #21
0
        private static X509Certificate2[] CreateOcspCertificateChain(Ca ca)
        {
            var chain = new List <X509Certificate2> ();

            while (ca != null)
            {
                chain.Add(ca.Certificate);
                ca = ca.IssuingCa;
            }
            return(chain.ToArray());
        }
Example #22
0
        public void NumberOfExpectedLinksTest()
        {
            Ca.TestName = "NumberOfExpectedLinksTest";
            Ca.GoToAnotherPage($"{MainUrl}/Pages/Software_OpenSource.aspx");
            bool value = Ca.NumberOfExpectedLinks("My Gun Collection", out var err);

            if (err?.Length > 0)
            {
                TestContext.WriteLine(err);
            }
            TestContext.WriteLine($"{value}");
            Assert.IsTrue(value);
        }
Example #23
0
        public void LinkIsPresentByIdTest()
        {
            Ca.TestName = "LinkIsPresentByIdTest";
            Ca.GoToAnotherPage($"{MainUrl}/Pages/Software_OpenSource.aspx");
            bool value = Ca.LinkIsPresentById("MainContent_TreeView1t2", out var err);

            if (err?.Length > 0)
            {
                TestContext.WriteLine(err);
            }
            TestContext.WriteLine($"{value}");
            Assert.IsTrue(value);
        }
Example #24
0
        public void GetTextFromElementByIdTest()
        {
            Ca.TestName = "GetTextFromElementByIdTest";
            Ca.GoToAnotherPage($"{MainUrl}/Pages/Sitemap.aspx");
            string value = Ca.GetTextFromElementById("MainContent_TreeView1t5", out var err);

            if (err?.Length > 0)
            {
                TestContext.WriteLine(err);
            }
            TestContext.WriteLine($"{value}");
            Assert.IsTrue(value.Length > 0);
        }
Example #25
0
        // GET: Cas/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Ca ca = db.Cas.Find(id);

            if (ca == null)
            {
                return(HttpNotFound());
            }
            return(View(ca));
        }
Example #26
0
 public void Close()
 {
     if (Ca.ErrorList.Count > 0)
     {
         foreach (string err in Ca.ErrorList)
         {
             TestContext.WriteLine(err);
         }
     }
     if (Ca != null)
     {
         Ca.Dispose();
     }
 }
Example #27
0
 public void Initiaze()
 {
     try
     {
         errorInfo = "";
         objCa200.AutoConnect();
         objCa    = objCa200.SingleCa;
         objProbe = objCa.SingleProbe;
         this.ChangeMode(Ca310TestMode.DSP_LXY);
     }
     catch
     {
         errorInfo = "Can't init Ca310.";
     }
 }
Example #28
0
        public CaModule() : base("/ca")
        {
            Post["/apply"] = x => {
                Ca.Apply();
                return(HttpStatusCode.OK);
            };

            Post["/set"] = x => {
                string data    = Request.Form.Data;
                var    objects = JsonConvert.DeserializeObject <CaModel>(data);
                Application.CurrentConfiguration.Services.Ca = objects;
                ConfigRepo.Save();
                return(HttpStatusCode.OK);
            };
        }
Example #29
0
        /// <summary>
        /// Initial approve to elastic search model.
        /// </summary>
        /// <param name="result"></param>
        /// <param name="item"></param>
        /// <returns></returns>
        private CaSearchViewModel InitialApprove(CaSearchViewModel result, Ca item)
        {
            var workflowLog = new List <WorkflowActivityLog>();
            var process     = _unitOfWork.GetRepository <WorkflowProcessInstance>().Get(x => x.DataId == item.Id &&
                                                                                        x.ProcessCode == CaViewModel.ProcessCode).FirstOrDefault();

            if (process != null)
            {
                workflowLog = _unitOfWork.GetRepository <WorkflowActivityLog>().Get(x => x.ProcessInstanceId == process.ProcessInstanceId).ToList();
            }
            workflowLog = workflowLog.Where(x => x.Step > 1).ToList();
            foreach (var workItem in workflowLog)
            {
                result = SetApproveElastic(result, workItem);
            }
            return(result);
        }
Example #30
0
File: Crl.cs Project: svast/OOAPI
        internal bool IsRevoked(Ca ca)
        {
            if (ca.IsRoot)
            {
                throw new InvalidOperationException("Cannot check revocation for root CA");
            }

            try {
                VerifyCrl(ca.IssuingCa.Certificate);
            }
            catch (SignatureException e)
            {
                throw new InvalidSignatureException("CRL Issued by" + _crl.IssuerDN
                                                    + " does not have valid signature by ca's issuer certificate "
                                                    + ca.IssuingCa.Certificate.SubjectName.Name, e);
            }
            return(IsRevoked(ca.Certificate));
        }
Example #31
0
 /// <see cref="Log.WriteEntry"/>
 protected override bool WriteEntry(Ca.Roop.TestHarness.Core.ITestable testable)
 {
     return output.Write(builder.GetInsertStatement(testable));
 }
Example #32
0
 /// <see cref="Log.WriteEntry"/>
 protected override bool WriteEntry(Ca.Roop.TestHarness.Core.ITestable testable)
 {
     return this.WriteToOutput(RowBuilderFactory.GetRowBuilder(testable, logInfo));
 }