示例#1
0
        private void ExecuteButton_Click(object sender, EventArgs e)
        {
            if (ExecuteButton.Text == "დამატება")
            {
                try
                {
                    var NewGroup = new Group();
                    NewGroup.gid   = Convert.ToInt32(gcode.Text);
                    NewGroup.gname = gname.Text;

                    db.Groups.Add(NewGroup);
                    db.SaveChanges();

                    gcode.Text = (Convert.ToInt32(gcode.Text) + 1).ToString();
                    gname.Clear();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (ExecuteButton.Text == "რედაქტირება")
            {
                var group = db.Groups.FirstOrDefault(x => x.gid.ToString() == gcode.Text);
                group.gname = gname.Text;

                db.SaveChanges();
                this.Close();
            }
        }
示例#2
0
        private void ExecuteButton_Click(object sender, EventArgs e)
        {
            if (ExecuteButton.Text == "დამატება")
            {
                try
                {
                    //ახალი საქონლის დამატება
                    var mt = new Product();
                    mt.mid      = Convert.ToInt32(mcode.Text);
                    mt.mname    = mname.Text;
                    mt.mgroup   = db.Groups.FirstOrDefault(z => z.gname == mgroup.Text).gid;
                    mt.munit    = db.MUnits.FirstOrDefault(z => z.muname == munit.Text).mucode;
                    mt.mprice   = Convert.ToDecimal(mprice.Text.Replace(",", "."));
                    mt.mbarcode = barcode.Text;

                    db.Products.Add(mt);
                    db.SaveChanges();

                    ProductsList pl = new ProductsList();
                    pl.ShowAll();

                    mcode.Text = (Convert.ToInt32(mcode.Text) + 1).ToString();
                    mname.Clear();
                    mprice.Value = 0;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else if (ExecuteButton.Text == "რედაქტირება")
            {
                try
                {
                    var product = db.Products.FirstOrDefault(x => x.mid.ToString() == mcode.Text);
                    product.mname  = mname.Text;
                    product.mgroup = db.Groups.Where(x => x.gname == mgroup.Text).Select(x => x.gid).FirstOrDefault();
                    product.munit  = db.MUnits.Where(x => x.muname == munit.Text).Select(x => x.mucode).FirstOrDefault();
                    product.mprice = Convert.ToDecimal(mprice.Value);

                    db.SaveChanges();
                    this.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public ActionResult Register(User us, string ConfirmPassword, HttpPostedFileBase Photo)

        {
            if (Photo != null)
            {
                WebImage image     = new WebImage(Photo.InputStream);
                FileInfo photoInfo = new FileInfo(Photo.FileName);
                string   newPhoto  = Guid.NewGuid().ToString() + photoInfo.Extension;
                image.Save("~/Uploads/UserImage/" + newPhoto);
                //us.Image = "/Uploads/UserImage/" + newPhoto;
            }
            if (us.Username != String.Empty && us.email != String.Empty && us.password != String.Empty && ConfirmPassword != string.Empty)
            {
                if (!(db.Users.Any(u => u.email == us.email || u.Username == us.Username)))
                {
                    if (us.password.Length > 5)
                    {
                        if (us.password == ConfirmPassword)
                        {
                            us.password = Crypto.HashPassword(us.password);
                            db.Users.Add(us);
                            db.SaveChanges();
                            return(RedirectToAction("Index", "Home"));
                        }
                        else
                        {
                            ViewBag.Error = "Password and Confirm password  valid";
                        }
                    }
                    else
                    {
                        ViewBag.Error = "Password length should be consist of 5 Charachters";
                    }
                }
                else
                {
                    ViewBag.Error = "Email or Username already exsist";
                }
            }
            else
            {
                ViewBag.Error = "Please all the fill!!";
            }
            return(View());
        }
示例#4
0
 public override void Create(ProductCategory t)
 {
     db.ProductCategories.Add(t);
     db.SaveChanges();
 }
 public override void Create(JobApplication t)
 {
     db.JobApplications.Add(t);
     db.SaveChanges();
 }
 public override void Create(Customer t)
 {
     db.Customers.Add(t);
     db.SaveChanges();
 }
示例#7
0
 public override void Create(Sale t)
 {
     db.Sales.Add(t);
     db.SaveChanges();
 }
示例#8
0
 public override void Create(Staff t)
 {
     db.Staffs.Add(t);
     db.SaveChanges();
 }
示例#9
0
 public override void Create(Sepet t)
 {
     db.Sepets.Add(t);
     db.SaveChanges();
 }
示例#10
0
 public override void Create(Governance t)
 {
     db.Governances.Add(t);
     db.SaveChanges();
 }
 public override void Create(Product t)
 {
     db.Products.Add(t);
     db.SaveChanges();
 }