Ejemplo n.º 1
0
        public SyntaxNode VisitDef([NotNull] QtParser.DefContext context)
        {
            DefId         name    = (DefId)context.name.Accept(this);
            List <CtxExt> ctxExts = ParseCtxExts(context._exts);
            Expr          retTy   = (Expr)context.retTy.Accept(this);
            Expr          retExpr = (Expr)context.body.Accept(this);

            return(new Def(name, ctxExts, retTy, retExpr));
        }
Ejemplo n.º 2
0
        public SyntaxNode VisitLetExpr([NotNull] QtParser.LetExprContext context)
        {
            DefId name = (DefId)context.varName.Accept(this);
            Expr  type = (Expr)context.ty.Accept(this);
            Expr  val  = (Expr)context.val.Accept(this);
            Expr  body = (Expr)context.body.Accept(this);

            return(new LetExpr(name, type, val, body));
        }
Ejemplo n.º 3
0
        public IActionResult Addition(string sortOrder, OrderCreateViewModel check, int Bolla, int Bolla2, string Bolla3, List <string> minidef, List <string> maxidef)
        {
            if (User.IsInRole("User"))
            {
                ExamplContext bd  = new ExamplContext();
                PhotouContext bd1 = new PhotouContext();
                ViewBag.Defect = from s in db.Defects
                                 select s;
                ViewBag.Years = (from s in bd.Stagio
                                 orderby s.Expr1 descending
                                 select s);
                string TaskNum = Bolla.ToString() + "/" + Bolla2.ToString();
                var    ord     = (from s in db.Checks
                                  where s.TaskNum == TaskNum && s.Stagione == Bolla3
                                  select s).FirstOrDefault();
                ViewBag.hist = (from s in db.Histories
                                where s.TaskNum == TaskNum && s.Year == Bolla3
                                select s).FirstOrDefault();
                ViewBag.ord = ord;
                if (ord != null)
                {
                    HttpContext.Session.SetString("Status", ord.Status);
                    HttpContext.Session.SetString("Id", ord.Id.ToString());
                }

                if (check.Articolo != null)
                {
                    string        uniqueFileName = null;
                    SqlConnection conn1          = new SqlConnection("Data Source=192.168.204.41\\Bucket;Initial Catalog=UA_Stage;Persist Security Info=True;User ID=swstage;Password=@UAStage2019.");
                    SqlCommand    cmd1           = new SqlCommand();
                    cmd1.Connection = conn1;
                    conn1.Open();
                    cmd1.CommandType = CommandType.Text;
                    cmd1.CommandText = $"SELECT MAX(Id) FROM [dbo].[checks]";
                    object         reader = cmd1.ExecuteScalar();
                    FileInfo       file;
                    MagickImage    image;
                    string         sthj      = check.Date.ToString();
                    ImageOptimizer optimizer = new ImageOptimizer();

                    conn1.Close();
                    Check newCheck = new Check
                    {
                        Date      = check.Date,
                        Articolo  = check.Articolo,
                        Color     = check.Color,
                        TaskNum   = check.TaskNum,
                        Client    = check.Client,
                        Total     = check.Total,
                        Selection = check.Selection,
                        Machine   = check.Machine,
                        UserId    = User.Identity.Name.ToString(),
                        Status    = "d",
                        Date_user = DateTime.Now,
                        Stagione  = check.Stagione,
                        Linea     = check.Linea,
                        Fustella  = check.Fustella
                    };
                    History history = new History();
                    var     status  = HttpContext.Session.GetString("Status");
                    var     idslav  = HttpContext.Session.GetString("Id");

                    if (check.CanGo)
                    {
                        newCheck.Status = "b";
                        newCheck.Defect = '-';
                    }
                    else
                    {
                        newCheck.Defect = '+';
                    }
                    if (status != null && status == "c")
                    {
                        history.Date    = DateTime.Now;
                        history.Status  = "update";
                        history.Action  = User.Identity.Name + " " + "updated " + check.TaskNum + " check";
                        history.TaskNum = check.TaskNum;
                        history.Wuser   = User.Identity.Name;
                        db.Histories.Add(history);
                        newCheck.Status = "d";
                        (from i in db.Checks
                         where i.Id.ToString() == idslav
                         select i).ToList()
                        .ForEach(x => x.Status = newCheck.Status);
                        (from i in db.Checks
                         where i.Id.ToString() == idslav
                         select i).ToList()
                        .ForEach(x => x.MinDef = newCheck.MinDef);
                        (from i in db.Checks
                         where i.Id.ToString() == idslav
                         select i).ToList()
                        .ForEach(x => x.MaxDef = newCheck.MaxDef);
                        db.SaveChanges();
                    }
                    else
                    {
                        history.Date    = DateTime.Now;
                        history.Status  = "add";
                        history.Action  = User.Identity.Name + " " + "added " + check.TaskNum + " check";
                        history.TaskNum = check.TaskNum;
                        history.Wuser   = User.Identity.Name;
                        db.Histories.Add(history);
                        db.Checks.Add(newCheck);
                    }
                    var id = 0;
                    db.SaveChanges();
                    int idLast = (from s in db.Checks
                                  orderby s.Id descending
                                  select s.Id).FirstOrDefault();
                    /*Defect block*/
                    if (minidef != null)
                    {
                        for (int i = 0; i < minidef.Count; i++)
                        {
                            DefId    defio    = new DefId();
                            String[] ArrSplit = minidef[i].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                            defio.DefectId = Convert.ToInt32(ArrSplit[0].Replace(".", ""));
                            for (int j = 1; j < ArrSplit.Length; j++)
                            {
                                defio.Comment += ArrSplit[j] + " ";
                            }
                            defio.Def     = "min";
                            defio.IdCheck = idLast;
                            db.Add(defio);
                        }
                        db.SaveChanges();
                    }
                    if (maxidef != null)
                    {
                        for (int i = 0; i < maxidef.Count; i++)
                        {
                            DefId    defio    = new DefId();
                            String[] ArrSplit = maxidef[i].Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries);
                            defio.DefectId = Convert.ToInt32(ArrSplit[0].Replace(".", ""));
                            for (int j = 1; j < ArrSplit.Length; j++)
                            {
                                defio.Comment += ArrSplit[j] + " ";
                            }
                            defio.Def     = "max";
                            defio.IdCheck = idLast;
                            db.Add(defio);
                        }
                        db.SaveChanges();
                    }

                    /*Photo block*/
                    if (check.Photo != null && check.Photo.Count > 0)
                    {
                        foreach (IFormFile photos in check.Photo)
                        {
                            User   photo         = new User();
                            string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images");
                            uniqueFileName = Guid.NewGuid().ToString() + "_" + photos.FileName;
                            string filePath = Path.Combine(uploadsFolder, uniqueFileName);
                            using (var copy = new FileStream(filePath, FileMode.Create))
                            {
                                photos.CopyTo(copy);
                            }
                            using (image = new MagickImage(filePath))
                            {
                                image.Quality = 75;
                                image.Resize(1920, 1080);
                                image.Format = MagickFormat.Jpeg;
                                image.Write(filePath);
                            }
                            photo.Id   = idLast;
                            photo.Name = uniqueFileName;
                            db.Users.Add(photo);
                            db.SaveChanges();
                        }
                    }


                    return(RedirectToAction("Addition", "Home"));
                }
                var colors = from u in bd.Colori select u;

                var slavik = (from k in bd.News where k.Numord == Bolla && k.Rigord == Bolla2 && k.Codsta.ToString().Contains(Bolla3) && k.Fase == "CONF" select k).FirstOrDefault();

                var slavik2 = (from i in bd.Colori
                               join k in bd.News on i.Valore equals k.Colore
                               where k.Numord == Bolla && k.Rigord == Bolla2 && k.Fase == "CONF"
                               select i).FirstOrDefault();
                var slavik3 = (from i in bd.Clients
                               join k in bd.News on i.Codclf equals k.Codsot
                               where k.Numord == Bolla && k.Rigord == Bolla2 && k.Fase == "CONF"
                               select i).FirstOrDefault();
                ViewBag.History = (from i in db.Histories
                                   orderby i.Date descending
                                   select i).Take(20);
                ViewBag.Machine = from i in bd.Repartis
                                  where i.Jrres == slavik.Reparto
                                  select i;
                ViewBag.HistoryNum = from i in db.Histories
                                     where i.TaskNum == TaskNum && (i.Status == "decline" || i.Status == "accept" || i.Status == "update")
                                     select i;
                ViewBag.Slavik = slavik;
                if (slavik != null)
                {
                    ViewBag.Ispe = Math.Round((decimal)ViewBag.Slavik.QtaOrd / 10);
                }
                ViewBag.Client = slavik3;

                //var colors = from u in bd.Colori where u.Valore==check.Color select u;
                var color = from u in bd.Colori select u;

                ViewBag.Color = slavik2;


                ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : "";
                ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date";


                ViewBag.Bolla = Bolla;


                return(View());
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Ejemplo n.º 4
0
                public override int GetHashCode()
                {
                    int num = 1;

                    if (EntityId != 0)
                    {
                        num ^= EntityId.GetHashCode();
                    }
                    if (EntityType != 0)
                    {
                        num ^= EntityType.GetHashCode();
                    }
                    if (name_ != null)
                    {
                        num ^= Name.GetHashCode();
                    }
                    if (defId_.HasValue)
                    {
                        num ^= DefId.GetHashCode();
                    }
                    if (weaponId_.HasValue)
                    {
                        num ^= WeaponId.GetHashCode();
                    }
                    if (genderId_.HasValue)
                    {
                        num ^= GenderId.GetHashCode();
                    }
                    if (playerIndexInFight_.HasValue)
                    {
                        num ^= PlayerIndexInFight.GetHashCode();
                    }
                    if (ownerId_.HasValue)
                    {
                        num ^= OwnerId.GetHashCode();
                    }
                    if (teamId_.HasValue)
                    {
                        num ^= TeamId.GetHashCode();
                    }
                    if (level_.HasValue)
                    {
                        num ^= Level.GetHashCode();
                    }
                    num ^= ((object)properties_).GetHashCode();
                    if (position_ != null)
                    {
                        num ^= Position.GetHashCode();
                    }
                    if (direction_.HasValue)
                    {
                        num ^= Direction.GetHashCode();
                    }
                    num ^= ((object)Caracs).GetHashCode();
                    if (customSkin_ != null)
                    {
                        num ^= CustomSkin.GetHashCode();
                    }
                    if (actionDoneThisTurn_.HasValue)
                    {
                        num ^= ActionDoneThisTurn.GetHashCode();
                    }
                    if (_unknownFields != null)
                    {
                        num ^= ((object)_unknownFields).GetHashCode();
                    }
                    return(num);
                }