Example #1
0
        public ActionResult ExportToExcel(bool?isProductCard, bool?isDeliveryStatus)
        {
            var fileName = "INWARDMATERIALSTATUS_JOBWORK.xls";

            if (isProductCard ?? false)
            {
                fileName = "ProductionCard.xls";
            }
            if (isDeliveryStatus ?? false)
            {
                fileName = "DeliverySttaus.xls";
            }
            var gv = new GridView();

            using (VGBEntities vgb = new VGBEntities())
            {
                gv.DataSource = db.JobWorks.ToList();
            }
            gv.DataBind();
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
            Response.ContentType = "application/ms-excel";
            Response.Charset     = "";
            StringWriter   objStringWriter   = new StringWriter();
            HtmlTextWriter objHtmlTextWriter = new HtmlTextWriter(objStringWriter);

            gv.RenderControl(objHtmlTextWriter);
            Response.Output.Write(objStringWriter.ToString());
            Response.Flush();
            Response.End();
            return(View(db.JobWorks.ToList()));
        }
Example #2
0
        public JsonResult InsertCustomers(List <PackingList> customers)
        {
            decimal?Weights = 0;

            using (VGBEntities entities = new VGBEntities())
            {
                //Loop and insert records.
                foreach (PackingList customer in customers)
                {
                    customer.RollStatus = "Open";
                    customer.RollStatus.Trim();
                    Weights = Weights + customer.NetWt;
                    //entities.PackingLists.Add(customer);
                }
                TempData["Weights"]    = Weights;
                TempData["PakingList"] = customers;
                Session["PakingList"]  = customers;
                //TempData["rolls"] = entities.SaveChanges();
                TempData["rolls"] = customers.Count;
                return(Json(Weights));

                // return RedirectToAction("newpage", "ProductionCard");
            }
        }