public ActionResult DeleteConfirmed(int id)
        {
            Customer_Table customer_Table = db.Customer_Table.Find(id);

            db.Customer_Table.Remove(customer_Table);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "CustomerId,CustomerName,ProductId")] Customer_Table customer_Table)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer_Table).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductId = new SelectList(db.ProductTables, "ProductId", "ProductName", customer_Table.ProductId);
     return(View(customer_Table));
 }
        public ActionResult Create([Bind(Include = "CustomerId,CustomerName,ProductId")] Customer_Table customer_Table)
        {
            if (ModelState.IsValid)
            {
                db.Customer_Table.Add(customer_Table);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductId = new SelectList(db.ProductTables, "ProductId", "ProductName", customer_Table.ProductId);
            return(View(customer_Table));
        }
        // GET: Customer_Table/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_Table customer_Table = db.Customer_Table.Find(id);

            if (customer_Table == null)
            {
                return(HttpNotFound());
            }
            return(View(customer_Table));
        }
        // GET: Customer_Table/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer_Table customer_Table = db.Customer_Table.Find(id);

            if (customer_Table == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductId = new SelectList(db.ProductTables, "ProductId", "ProductName", customer_Table.ProductId);
            return(View(customer_Table));
        }
Example #6
0
        //display information of current logged in user in editable text boxes
        public ActionResult UpdateProfile()
        {
            Clist      = userBus.SendCnames();
            ViewBag.CL = Clist;
            int            cid = Convert.ToInt32(Session["user"]);
            Customer_Table C   = DbClass.GetCustomerInfo(cid);
            updateDetails  R   = new updateDetails();

            R.Name    = C.Name;
            R.Address = C.Address;
            R.City    = C.City;
            R.State   = C.State;
            R.Country = C.Country;
            R.Pincode = C.Pincode.ToString();
            R.Email   = C.Email;
            R.Contact = C.Contactno;
            R.Ctype   = C.CustomerType;
            R.Dob     = C.DateOfBirth;
            return(View(R));
        }
Example #7
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            ForceValidation();
            if (Validation.GetHasError(cbRegNo) || Validation.GetHasError(txtName) ||
                Validation.GetHasError(txtPhone) || Validation.GetHasError(txtAddress) ||
                Validation.GetHasError(dpDOI) || Validation.GetHasError(dpDOR) ||
                Validation.GetHasError(txtRPD) || Validation.GetHasError(cbTax))
            {
                MessageBox.Show("Error Some Data is Missing", "ERROR");
                return;
            }
            Customer_Table cObj    = new Customer_Table();
            RCB_Table      rObj    = new RCB_Table();
            CarFactory     cartFac = new CarFactory();

            rObj.CA_ID = int.Parse(cbRegNo.SelectedValue.ToString());
            cartFac.ChangeStatus(rObj.CA_ID, false);
            cObj.C_Name    = txtName.Text.Trim();
            cObj.C_Address = txtAddress.Text.Trim();
            cObj.C_Phone   = txtPhone.Text.Trim();
            RCB_Factory obj    = new RCB_Factory();
            bool        result = obj.insertC(cObj);

            rObj.C_ID = cObj.C_ID;
            DateTime issue, retrn;

            issue = DateTime.Parse(dpDOI.Text);
            retrn = DateTime.Parse(dpDOR.Text);
            if (issue.Date > retrn.Date)
            {
                MessageBox.Show("Issue Date is Greater than Return Date", "Error");
            }
            else
            {
                rObj.RCB_DOI = issue;
                rObj.RCB_DOR = retrn;
            }
            TimeSpan ts = retrn - issue;
            decimal  td = ts.Days;
            decimal  rpd;

            rpd             = decimal.Parse(txtRPD.Text);
            rObj.RCB_RentPD = rpd;
            decimal total;

            total = rpd * td;
            // TotalB.Text = total.ToString();

            rObj.T_ID = int.Parse(cbTax.SelectedValue.ToString());
            decimal tax = decimal.Parse(cbTax.Text.ToString());

            tax /= 100;
            //decimal taxd = decimal.Parse(tax.ToString());
            decimal taxp = (total * tax);

            total += taxp;

            rObj.RCB_TotalBill = total;
            totalTemp          = total;
            TotalB.Text        = totalTemp.ToString();
            bool rResult = obj.insertR(rObj);

            if (rResult && result)
            {
                MessageBox.Show("Data is Added Successfully", "Saved");
                txtName.Text         = null;
                cbRegNo.SelectedItem = null;
                this.Close();
            }
            else
            {
                MessageBox.Show("Data is not Added", "Error");
            }
        }
Example #8
0
 public bool insertC(Customer_Table cArg)
 {
     obj.Customer_Table.Add(cArg);
     return(obj.SaveChanges() > 0);
 }
Example #9
0
 public RCB_DA()
 {
     cobj = new Customer_Table();
     robj = new RCB_Table();
     obj  = new AutoDealershipEntities();
 }