Ejemplo n.º 1
0
 private void addMessage()
 {
     if (result.LongLength > 1)
     {
         int fromId = 0;
         int toId   = 0;
         foreach (var item in db.Users)
         {
             if (item.name.Equals(fromUser))
             {
                 fromId = item.Id;
             }
             if (item.name.Equals(toUser))
             {
                 toId = item.Id;
             }
         }
         Messages mess = new Messages
         {
             FromUserId = fromId,
             Date       = DateTime.Now,
             Message    = text,
             ToUserId   = toId
         };
         db.Messages.Add(mess);
         db.SaveChanges();
     }
 }
        public ActionResult Create([Bind(Include = "Id,Name,Username,Email,Mobile,Org_Name,Id_Proof,Password")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
Ejemplo n.º 3
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     using (Database1Entities2 db = new Database1Entities2())
     {
         try
         {
             int    id         = Convert.ToInt32(TextBox1.Text);
             string status     = DropDownList1.Text.ToString();
             var    ord_status = (from o in db.Orders
                                  where o.order_id == id
                                  select o).Single();
             ord_status.status      = status;
             ord_status.status_date = DateTime.Now;
             db.SaveChanges();
             Label3.Text = "updated status at " + DateTime.Now;
         }
         catch (Exception ex)
         {
             Response.Write(ex.Message);
         }
         finally
         {
             GridView1.DataBind();
         }
     }
 }
Ejemplo n.º 4
0
        public ActionResult Index(Customer c)
        {
            if (c.Name != null)
            {
                try
                {
                    de.Customers.Add(c);
                    de.SaveChanges();
                    ViewBag.Name = "You have been successfully registered.Please Log-In";

                    return(View("Index"));
                }
                catch
                {
                    ViewBag.Name = "Failed. Please try again in a few moments";

                    return(View("Index"));
                }
            }

            else
            {
                ViewBag.Name = "Failed. Please try again in a few moments";

                return(View("Index"));
            }

            // return View("Index", "_layout", de.Customers.ToList());
        }
Ejemplo n.º 5
0
        public JsonResult editftagContactdetailJSON(string f, string i)
        {
            int id = Int32.Parse(i);

            if (i != null)
            {
                fTagDetail1 file     = dbnew.fTagDetails1.Find(id);
                string      filename = file.orignalName;
                string      vnam     = file.virtualName;
                string      path     = file.url;
                var         cid      = file.cid;

                ftd = dbnew.fTagDetails1.Where(x => x.cid == file.cid && x.uid == file.uid && x.orignalName.Equals(filename)).ToList();
                foreach (var fi in ftd)
                {
                    dbnew.fTagDetails1.Remove(fi);
                }
                dbnew.SaveChanges();
                var        tagsplits = f.Split(',');
                List <int> ftagids   = new List <int>();
                for (int i1 = 0; i1 < (tagsplits.Length - 1); i1++)
                {
                    ftagids.Add(Int32.Parse(tagsplits[i1]));
                }



                //   Int32.Parse(


                foreach (var x in ftagids)
                {
                    fTagDetail1 fdnew = new fTagDetail1();

                    fdnew.uid         = Int32.Parse(Session["userId"].ToString());
                    fdnew.fid         = x;
                    fdnew.cid         = cid;
                    fdnew.orignalName = filename;
                    fdnew.virtualName = vnam;
                    fdnew.url         = path;
                    dbnew.fTagDetails1.Add(fdnew);
                    dbnew.SaveChanges();
                }
            }

            return(Json(true, JsonRequestBehavior.AllowGet));
        }
        public ActionResult Create([Bind(Include = "Name,Address,Mobile_NO,Age,Email,PWD")] Mem_Tab mem_Tab)
        {
            if (ModelState.IsValid)
            {
                db.Mem_Tab.Add(mem_Tab);
                db.SaveChanges();
                //    return RedirectToAction("Index");
            }

            return(View("Login"));
        }
        public ActionResult Create([Bind(Include = "Id,Name,Certificate_Number,Phone_Number,Password,CPassword,City,Email")] Comapny_Registration comapny_Registration)
        {
            if (ModelState.IsValid)
            {
                db.Comapny_Registration.Add(comapny_Registration);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(comapny_Registration));
        }
Ejemplo n.º 8
0
        public ActionResult validateSignup(login a)
        {
            a.lastName = "Not Available";
            a.isActive = 1;


            db.logins.Add(a);
            db.SaveChanges();



            return(Redirect("../Account/signin"));
        }
Ejemplo n.º 9
0
        public ActionResult Add()
        {
            int     price       = Int32.Parse(Request["price"]);
            string  category    = Request["category"];
            string  description = Request["description"];
            string  src         = Request["source"];
            string  src1        = "~/Images/" + src + ".jpg";
            Product p           = new Product();

            p.Price    = price;
            p.Category = category;
            p.Desc     = description;
            p.Src      = src1;

            de1.Products.Add(p);
            de1.SaveChanges();

            Session["msg"] = " Item Added successfully";
            ViewBag.msg    = " Item added successfully";


            return(RedirectToAction("Index"));
        }
Ejemplo n.º 10
0
        public ActionResult Payment(Payment Tb)
        {
            if (ModelState.IsValid)
            {
                using (Database1Entities2 db = new Database1Entities2())
                {
                    db.Payments.Add(Tb);
                    db.SaveChanges();


                    ModelState.Clear();
                    Tb = null;
                    ViewBag.Message = "Registration Successful";
                }
            }
            return(View());
        }
Ejemplo n.º 11
0
        public ActionResult Patient(Patient_Info a)
        {
            Database1Entities2 D = new Database1Entities2();

            D.Patient_Infoes.Add(a);
            var st = D.SaveChanges();

            if (st > 0)
            {
            }
            else
            {
            }
            ModelState.Clear();


            return(View());
        }
Ejemplo n.º 12
0
        public ActionResult AddCart(int id)
        {
            Session["cart"] = "cart";
            if (Session["Id"] != null)
            {
                int id3 = isExisting(id);
                if (id3 == -1)
                {
                    Product p11 = de1.Products.Find(id);

                    Cart c11 = new Cart();
                    c11.CID      = (Int32)Session["Id"];
                    c11.PID      = p11.Id;
                    c11.Quantity = 1;
                    c11.STotal   = p11.Price * c11.Quantity;
                    de1.Carts.Add(c11);
                    de1.SaveChanges();
                    var v = de1.Carts.Where(a => a.CID == c11.CID).ToList();
                    return(RedirectToAction("IndexC"));
                }
                else
                {
                    Cart c22 = de1.Carts.Find(id3);
                    c22.Quantity = c22.Quantity + 1;
                    Product p22 = de1.Products.Find(c22.PID);
                    c22.STotal           = c22.STotal + p22.Price;
                    de1.Entry(c22).State = System.Data.EntityState.Modified;
                    de1.SaveChanges();



                    return(RedirectToAction("IndexC"));
                }
            }
            else
            {
                Session["ErrorCart"] = "Please Log in first to continue.. ";

                return(RedirectToAction("Index", "Home"));
            }
        }
Ejemplo n.º 13
0
 public ActionResult Create(BOOK_DATA table)
 {
     db.BOOK_DATA.Add(table);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }