Ejemplo n.º 1
0
        public void GenerateCustomerReport(HttpResponseBase response, HttpServerUtilityBase server)
        {
            using (var db = new InvoiceEntities1())
            {
                var reportModelList = db.tblcustomers.ToList();

                if (reportModelList.Count() > 0)
                {
                    LocalReport localReport = new LocalReport();

                    localReport.ReportPath = server.MapPath("~/Reports/" + "Customer.rdlc");

                    //Passing Parameters

                    ReportDataSource reportDataSource = new ReportDataSource("customerds", reportModelList);
                    localReport.DataSources.Clear();
                    localReport.DataSources.Add(reportDataSource);

                    localReport.Refresh();

                    string extensionString = "Pdf";
                    string outputType      = "Pdf";

                    ReportExportHelper(localReport, outputType, "Invoice", true, extensionString, response);
                }
            }
        }
Ejemplo n.º 2
0
 public ActionResult edit(int id)
 {
     using (var db = new InvoiceEntities1())
     {
         tblcustomer cust = db.tblcustomers.Where(x => x.idcustomer == id).FirstOrDefault();
         return(View(cust));
     }
 }
Ejemplo n.º 3
0
 public ActionResult indexproduct()
 {
     using (var db = new InvoiceEntities1())
     {
         List <tblproduct> pro = db.tblproducts.ToList();
         return(View(pro));
     }
 } // GET: Home
Ejemplo n.º 4
0
 // GET: Home
 public ActionResult Indexcust()
 {
     using (var db = new InvoiceEntities1())
     {
         List <tblcustomer> cust = db.tblcustomers.ToList();
         return(View(cust));
     }
 }
Ejemplo n.º 5
0
 public ActionResult editproduct(int id)
 {
     using (var db = new InvoiceEntities1())
     {
         tblproduct product = db.tblproducts.Where(x => x.idproduct == id).FirstOrDefault();
         return(View(product));
     }
 }
Ejemplo n.º 6
0
 public ActionResult Customer()
 {
     //GenerateCustomerReport(Response);
     using (var db = new InvoiceEntities1())
     {
         List <tblcustomer> cust = db.tblcustomers.ToList();
         return(View(cust));
     }
 }
Ejemplo n.º 7
0
 public ActionResult delete(int id)
 {
     using (var db = new InvoiceEntities1())
     {
         tblcustomer cust = db.tblcustomers.FirstOrDefault(x => x.idcustomer == id);
         db.tblcustomers.Remove(cust);
         db.SaveChanges();
         return(RedirectToAction("Indexcust"));
     }
 }
Ejemplo n.º 8
0
 public ActionResult deleteproduct(int id)
 {
     using (var db = new InvoiceEntities1())
     {
         tblproduct product = db.tblproducts.FirstOrDefault(x => x.idproduct == id);
         db.tblproducts.Remove(product);
         db.SaveChanges();
         return(RedirectToAction("indexproduct"));
     }
 }
Ejemplo n.º 9
0
        public ActionResult editproduct(tblproduct obj)
        {
            using (var db = new InvoiceEntities1())
            {
                tblproduct product = db.tblproducts.Where(x => x.idproduct == obj.idproduct).FirstOrDefault();
                product.name  = obj.name;
                product.price = obj.price;

                db.SaveChanges();
                return(RedirectToAction("indexproduct"));
            }
        }
Ejemplo n.º 10
0
 public ActionResult edit(tblcustomer obj)
 {
     using (var db = new InvoiceEntities1())
     {
         tblcustomer customer = db.tblcustomers.Where(x => x.idcustomer == obj.idcustomer).FirstOrDefault();
         customer.name     = obj.name;
         customer.mobileno = obj.mobileno;
         customer.emailid  = obj.emailid;
         customer.address  = obj.address;
         db.SaveChanges();
         return(RedirectToAction("Indexcust"));
     }
 }
Ejemplo n.º 11
0
        public ActionResult addproduct(tblproduct obj)

        {
            if (ModelState.IsValid)
            {
                InvoiceEntities1 db      = new InvoiceEntities1();
                tblproduct       product = new tblproduct();
                product.name  = obj.name;
                product.price = obj.price;
                product.srno  = obj.srno;
                db.tblproducts.Add(product);
                db.SaveChanges();
            }
            return(View(obj));
        }
Ejemplo n.º 12
0
 public ActionResult addcustomer(tblcustomer obj)
 {
     if (ModelState.IsValid)
     {
         int billno;
         InvoiceEntities1 db       = new InvoiceEntities1();
         tblcustomer      customer = new tblcustomer();
         customer.name     = obj.name;
         customer.mobileno = obj.mobileno;
         customer.emailid  = obj.emailid;
         customer.address  = obj.address;
         customer.billno   = db.tblcustomers.Count() + 1;
         db.tblcustomers.Add(customer);
         db.SaveChanges();
     }
     return(View(obj));
 }
Ejemplo n.º 13
0
        public ActionResult GetCustomerId(int Id)
        {
            using (var db = new InvoiceEntities1())
            {
                List <customerproduct> data     = db.customerproducts.Where(x => x.customer == Id).ToList();
                List <tblproduct>      Products = new List <tblproduct>();
                tblproduct             product;
                double SumOfPrice = 0;
                foreach (customerproduct productmap in data)
                {
                    product = db.tblproducts.Where(x => x.idproduct == productmap.product).FirstOrDefault();
                    if (product != null)
                    {
                        Products.Add(product);
                        SumOfPrice += (double)product.price;
                    }
                }

                List <tblcustomer> customer = db.tblcustomers.Where(x => x.idcustomer == Id).ToList();
                reportservice.GenerateInvoiceReport(SumOfPrice, customer, Products, Response, Server);
                return(RedirectToAction("Customer"));
            }
        }