//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated from a template.
//
//
Manual changes to this file may cause unexpected behavior in your
application.
//
Manual changes to this file will be overwritten if the code is
regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace POSDemo.DB
{
using System;
using System.Data.Entity;
using
System.Data.Entity.Infrastructure;
public partial class POSTutEntities : DbContext
{
public POSTutEntities()
: base("name=POSTutEntities")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Customer> Customers { get; set; }
public virtual DbSet<Product> Products { get; set; }
public virtual DbSet<Supllier> Suplliers { get; set; }
public virtual DbSet<User> Users { get; set; }
}
}
========================
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated from a template.
//
//
Manual changes to this file may cause unexpected behavior in your
application.
//
Manual changes to this file will be overwritten if the code is
regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace POSDemo.DB
{
using System;
using
System.Collections.Generic;
public partial class User
{
public int Id { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string Image { get; set; }
}
}
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated from a template.
//
//
Manual changes to this file may cause unexpected behavior in your
application.
//
Manual changes to this file will be overwritten if the code is
regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace POSDemo.DB
{
using System;
using
System.Collections.Generic;
public partial class Customer
{
public int id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string Notes { get; set; }
public string Phone { get; set; }
public string Company { get; set; }
public string Email { get; set; }
public Nullable<bool> IsActive { get; set; }
public string Image { get; set; }
}
}
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated from a template.
//
//
Manual changes to this file may cause unexpected behavior in your
application.
//
Manual changes to this file will be overwritten if the code is
regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace POSDemo.DB
{
using System;
using
System.Collections.Generic;
public partial class Product
{
public int Id { get; set; }
public string Name { get; set; }
public string Code { get; set; }
public Nullable<decimal> Price { get; set; }
public Nullable<int> Qty { get; set; }
public string Notes { get; set; }
public string Image { get; set; }
}
}
//------------------------------------------------------------------------------
// <auto-generated>
//
This code was generated from a template.
//
//
Manual changes to this file may cause unexpected behavior in your
application.
//
Manual changes to this file will be overwritten if the code is
regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace POSDemo.DB
{
using System;
using
System.Collections.Generic;
public partial class Supllier
{
public int id { get; set; }
public string Name { get; set; }
public string Address { get; set; }
public string Notes { get; set; }
public string Phone { get; set; }
public string Company { get; set; }
public string Email { get; set; }
public Nullable<bool> IsActive { get; set; }
public string Image { get; set; }
}
}
============
using POSDemo.DB;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
=======================================================
namespace POSDemo.Screens
{
public partial class fusers : Form
{
POSTutEntities db = new POSTutEntities();
public fusers()
{
InitializeComponent();
}
===============================================================
private void fusers_Load(object sender, EventArgs e)
{
}
=======================================================================
private void button1_Click(object sender, EventArgs e)
{
//User u = new User();
//u.UserName = textUser.Text;
//u.Password = textPassword.Text;
//db.Users.Add(u);
db.Users.Add(new User
{
UserName = textUser.Text,
Password= textPassword.Text,
Image= imagePath
});
db.SaveChanges();
MessageBox.Show("New user added");
}
==============================================================================
string imagePath = "";
private void pictureBox1_Click(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
if (dialog.ShowDialog() == DialogResult.OK)
{
imagePath= dialog.FileName;
pictureBox1.ImageLocation =
dialog.FileName;
}
}
}
}