예제 #1
0
        void YeniKaydet()
        {
            try
            {
                bgSira sira = db.bgSiralar.First(x => x.Sadi == "GenelNo");
                sira.Sno = int.Parse(txtGenelNo.Text);



                Liste.AllowUserToAddRows = false;
                stUrunKayitUst ust = new stUrunKayitUst();
                ust.Aciklama    = txtAcik.Text;
                ust.AraToplam   = decimal.Parse(txtAraToplam.Text);
                ust.FirmaId     = int.Parse(txtFno.Text);
                ust.GenelNo     = int.Parse(txtGenelNo.Text);
                ust.GenelToplam = decimal.Parse(txtGenelToplam.Text);
                ust.GirisKodu   = firmaFid;
                ust.GirisTarih  = txtTarih.Value;
                ust.KDVToplam   = decimal.Parse(txtKdv.Text);
                ust.Saat        = txtSaat.Text;
                ust.SaveDate    = DateTime.Now;
                ust.SaveUser    = -1;
                ust.UpdateDate  = DateTime.Now;
                ust.UpdateUser  = -1;
                ust.yazi        = txtYazi.Text;

                db.stUrunKayitUsts.Add(ust);
                db.SaveChanges();
                Temizle();

                stUrunKayitAlt[] alt = new stUrunKayitAlt[Liste.RowCount];
                for (int i = 0; i < Liste.RowCount; i++)
                {
                    alt[i]            = new stUrunKayitAlt();
                    alt[i].Aciklama   = Liste.Rows[i].Cells[3].Value.ToString();
                    alt[i].Adet       = int.Parse(Liste.Rows[i].Cells[4].Value.ToString());
                    alt[i].bFiyat     = decimal.Parse(Liste.Rows[i].Cells[5].Value.ToString());
                    alt[i].GenelNo    = int.Parse(txtGenelNo.Text);
                    alt[i].GirisKod   = firmaFid;
                    alt[i].LotSeriNo  = Liste.Rows[i].Cells[2].Value.ToString();
                    alt[i].Nott       = Liste.Rows[i].Cells[7].Value.ToString();
                    alt[i].SaveDate   = DateTime.Now;
                    alt[i].SaveUser   = -1;
                    alt[i].UpdateDate = DateTime.Now;
                    alt[i].UpdateUser = -1;
                    alt[i].UrunId     = int.Parse(Liste.Rows[i].Cells[8].Value.ToString());
                    alt[i].UrunKodu   = Liste.Rows[i].Cells[1].Value.ToString();

                    db.stUrunKayitAlts.Add(alt[i]);
                }
                db.SaveChanges();
                m.YeniKayit("Kayıt Basarıyla Gerceklestirildi.");
                Temizle();
            }
            catch (Exception e)
            {
                m.Hata(e);
            }
        }
 public ActionResult Create([Bind(Include = "Id,First_name,Last_name,Phone,Email,DOB,Sex,Weight,Height,type,password")] UserTable userTable)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.UserTables.Add(userTable);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     catch (Exception genericException)
     {
         ViewBag.ExceptionMessage = genericException;
     }
     return(View());
 }
        public ActionResult Create([Bind(Include = "Symptom_Id,Symptom_Desc,User_Id,C_Time")] Symptom symptom)
        {
            try
            {
                symptom.User_Id = Convert.ToInt32(Session["userId"].ToString());
                if (ModelState.IsValid)
                {
                    db.Symptoms.Add(symptom);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                ViewBag.User_Id = new SelectList(db.UserTables, "Id", "First_name", symptom.User_Id);
                ViewBag.User_Id = new SelectList(db.UserTables, "Id", "First_name", symptom.User_Id);
            }
            catch (Exception genericException)
            {
                ViewBag.ExceptionMessage = genericException;
            }
            return(RedirectToAction("Index", "Symptoms"));
        }
 public ActionResult Index([Bind(Include = "Id,First_name,Last_name,Phone,Email,DOB,Sex,Weight,Height,type,password")] UserTable userTable)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.UserTables.Add(userTable);
             db.SaveChanges();
             Session["userId"] = userTable.Id;
             Session["name"]   = userTable.First_name;
             //add formauth...
             FormsAuthentication.SetAuthCookie(userTable.Email, false);
             return(RedirectToAction("Create", "Symptoms"));
         }
     }
     catch (Exception genericException)
     {
         ViewBag.ExceptionMessage = genericException;
     }
     return(View("Index", "Symptoms"));
 }
예제 #5
0
 private void btnSil_Click(object sender, EventArgs e)
 {
     db.bgUrunGirisler.Remove(db.bgUrunGirisler.Find(int.Parse(txtUno.Text)));
     db.SaveChanges();
 }
예제 #6
0
 public int SaveChanges()
 {
     return(_context.SaveChanges());
 }