Beispiel #1
0
        public ActionResult UpdateMixingDesign(AddMixDesign mix)
        {
            try
            {
                // TODO: Add insert logic here
                int             uId           = Convert.ToInt32(Session["UserId"].ToString());
                ObjectParameter statusCode    = new ObjectParameter("StatusCode", typeof(int));
                ObjectParameter statusMessage = new ObjectParameter("StatusMessage", typeof(string));

                db.AddUpdateConcMixDesing(mix.Id, mix.FactoryId, mix.ConcreteRank, mix.CementWeight, mix.WaterWeight, mix.WashedSand,
                                          mix.Rubble3by4, mix.Rubble3by8, mix.WhiteSand, mix.Cement, mix.Water, mix.WashedSand2,
                                          mix.Rubble3by42, mix.Rubble3by82, mix.WhiteSand2, mix.C28Day, mix.Landing, mix.Status, null, mix.Comments,
                                          mix.CreatedBy, mix.CreatedDate, uId, null, statusCode, statusMessage);

                if (mix.Status == "Waiting")
                {
                    TempData["AlertMessage"] = "Waiting";
                }

                return(RedirectToAction("ApproveMixingDesign", "MixingDesign", new
                {
                    id = 1
                }));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult AddMixingDesign(AddMixDesign mix)
        {
            try
            {
                // TODO: Add insert logic here

                ObjectParameter statusCode    = new ObjectParameter("StatusCode", typeof(int));
                ObjectParameter statusMessage = new ObjectParameter("StatusMessage", typeof(string));

                db.AddUpdateConcMixDesing(0, mix.FactoryId, mix.ConcreteRank, mix.CementWeight, mix.WaterWeight, mix.WashedSand,
                                          mix.Rubble3by4, mix.Rubble3by8, mix.WhiteSand, "Pending", null, mix.Comments,
                                          null, null, null, null, statusCode, statusMessage);


                return(View("MixingDesign"));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #3
0
        public ActionResult AddMixingDesign(AddMixDesign mix)
        {
            try
            {
                // TODO: Add insert logic here
                int                  uId           = Convert.ToInt32(Session["UserId"].ToString());
                ObjectParameter      statusCode    = new ObjectParameter("StatusCode", typeof(int));
                ObjectParameter      statusMessage = new ObjectParameter("StatusMessage", typeof(string));
                ConcreteMixingDesign mixD          = new ConcreteMixingDesign()
                {
                    C28Day       = mix.C28Day,
                    Cement       = mix.Cement,
                    CementWeight = mix.CementWeight,
                    Comments     = mix.Comments,
                    ConcreteRank = mix.ConcreteRank,
                    CreatedBy    = uId,
                    CreatedDate  = DateTime.Now,
                    ExpiryDate   = DateTime.Now,
                    FactoryId    = mix.FactoryId,
                    Landing      = mix.Landing,
                    Rubble3by4   = mix.Rubble3by4,
                    Rubble3by42  = mix.Rubble3by42,
                    Rubble3by8   = mix.Rubble3by8,
                    Rubble3by82  = mix.Rubble3by82,
                    Status       = "Pending",
                    UpdatedBy    = uId,
                    UpdatedDate  = DateTime.Now,
                    WashedSand   = mix.WashedSand,
                    WashedSand2  = mix.WashedSand2,
                    Water        = mix.Water,
                    WaterWeight  = mix.WaterWeight,
                    WhiteSand    = mix.WhiteSand,
                    WhiteSand2   = mix.WhiteSand2
                };
                db.ConcreteMixingDesigns.Add(mixD);
                db.SaveChanges();
                foreach (HttpPostedFileBase file in mix.files)
                {
                    //Checking file is available to save.
                    if (file != null)
                    {
                        Random   random = new Random();
                        FileInfo fi     = new FileInfo(file.FileName);

                        DateTime d              = DateTime.Now;
                        var      InputFileName  = d.Ticks + random.Next(100, 100000000).ToString();
                        var      ServerSavePath = System.IO.Path.Combine(Server.MapPath("~/Content"), InputFileName + fi.Extension);
                        //Save file to server folder
                        file.SaveAs(ServerSavePath);
                        MaterialResultsPdf mPdf = new MaterialResultsPdf()
                        {
                            MixingDesignId = mixD.Id,
                            PdfPath        = InputFileName + fi.Extension,
                            FileName       = file.FileName
                        };
                        db.MaterialResultsPdfs.Add(mPdf);
                        db.SaveChanges();
                    }
                }

                TempData["AlertMessage"] = "Design Added Successfully";
                return(RedirectToAction("MixingDesign", "MixingDesign", new
                {
                    id = 1
                }));
            }
            catch
            {
                return(View());
            }
        }