private void button6_Click(object sender, EventArgs e) { DataInformationContext db = new DataInformationContext(); DialogResult rs = MessageBox.Show("Are u sure u want to delete?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); int i = (int)dataGridView1.SelectedCells[0].Value; if (rs == DialogResult.OK) { if (i > -1) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = " DELETE FROM OrderInfoes WHERE Id='" + i + "'"; MessageBox.Show("Customer Order Deleted Successfully"); cmd.ExecuteNonQuery(); con.Close(); } } else { MessageBox.Show("Not Deleted Any Value"); } }
private void ViewStockLayer_Load(object sender, EventArgs e) { var context = new DataInformationContext(); var AllMedicine = (from Medicine in context.MedicineInfos select Medicine); dataGridView1.DataSource = AllMedicine.ToList(); }
private void button1_Click(object sender, EventArgs e) { if (textBox1.Text != "" && textBox2.Text != "") { using (DataInformationContext db = new DataInformationContext()) { var user = db.UserInfos.SingleOrDefault(u => u.UserName == textBox1.Text); if (user == null) { MessageBox.Show("UserName or Password is Wrong"); } else if (user.UserName == textBox1.Text && user.Password == textBox2.Text) { var type = user.UserType.ToString(); var password = user.Password.ToString(); if (password == user.Password && type == "Admin") { AdminLayer al = new AdminLayer(); al.Show(); this.Hide(); } else if (password == user.Password && type == "User") { UserLayer ul = new UserLayer(); ul.Show(); } } else { MessageBox.Show("UserName or Password Wrong"); } } } else { MessageBox.Show("Please Fill UserName and Password"); } }
public static void InsertOrderData(int Order_Id5, int Customer_Id5, int Medicine_Id5, DateTime OrderDate5) { var context = new DataInformationContext(); context.OrderInfos.Add(new OrderInfo() { Order_Id = Order_Id5, Customer_Id = Customer_Id5, Medicine_Id = Medicine_Id5, OrderDate = OrderDate5 }); context.SaveChanges(); }
public static void InsertCustomerData(int Customer_Id3, string CustomerName3, string Phone3, string Address3, string City3, string PostalCode3, string Country3) { var context = new DataInformationContext(); context.CustomerInfos.Add(new CustomerInfo() { Customer_Id = Customer_Id3, CustomerName = CustomerName3, Phone = Phone3, Address = Address3, City = City3, PostalCode = PostalCode3, Country = Country3 }); context.SaveChanges(); }
private void button1_Click(object sender, EventArgs e) { dataGridView1.Enabled = true; string x = textBox1.Text; string comboText = comboBox1.Text; var context = new DataInformationContext(); //var AllMedicine = (from Medicine in context.MedicineInfos // where (Medicine.Medicine_Id.ToString() == x || Medicine.Medicine_Name == x || Medicine.Medicine_Catagory == x) // select Medicine); if (comboText == "Medicine_Id") { try { int mid = Convert.ToInt32(textBox1.Text); var AllMedicine = db.MedicineInfos.Where(m => m.Medicine_Id == mid); dataGridView1.DataSource = AllMedicine.ToList(); } catch (Exception) { MessageBox.Show("Please Searching Choose Type"); } } else if (comboText == "Medicine_Name") { var AllMedicine = db.MedicineInfos.Where(m => m.Medicine_Name == textBox1.Text); dataGridView1.DataSource = AllMedicine.ToList(); } else if (comboText == "Medicine_Catagory") { var AllMedicine = db.MedicineInfos.Where(m => m.Medicine_Catagory == textBox1.Text); dataGridView1.DataSource = AllMedicine.ToList(); } }
public static void InsertEmployee(string FullName3, string MobileNumber3, DateTime Dob3, string Address3, string Email3, int Salary3, string UserName3, string Password3) { var context = new DataInformationContext(); context.EmployeeInfos.Add(new EmployeeInfo() { FullName = FullName3, MobileNumber = MobileNumber3, Dob = Dob3, Address = Address3, Email = Email3, Salary = Salary3, UserName = UserName3, Password = Password3 }); context.SaveChanges(); }
public static void Insertuser(string Name1, string Gender1, string Address1, string MobileNumber1, string UserType1, string UserName1, string Password1) { var context = new DataInformationContext(); context.UserInfos.Add(new UserInfo() { Name = Name1, Gender = Gender1, Address = Address1, MobileNumber = MobileNumber1, UserType = UserType1, UserName = UserName1, Password = Password1, }); context.SaveChanges(); }
public static void InsertPermacyData(string Medicine_Name2, string Medicine_Catagory2, string Dosage2, string Manufacturer2, int Medicine_Available2, DateTime Entry_Date2, DateTime Production_Date2, DateTime Expire_Date2, int Buying_Price2, int Selling_Price2, int Medicine_Id2) { var context = new DataInformationContext(); context.MedicineInfos.Add(new MedicineInfo() { Medicine_Name = Medicine_Name2, Medicine_Catagory = Medicine_Catagory2, Dosage = Dosage2, Manufacturer = Manufacturer2, Medicine_Available = Medicine_Available2, Entry_Date = Entry_Date2, Production_Date = Production_Date2, Expire_Date = Expire_Date2, Buying_Price = Buying_Price2, Selling_Price = Selling_Price2, Medicine_Id = Medicine_Id2 }); context.SaveChanges(); }
private void button3_Click(object sender, EventArgs e) { DataInformationContext db = new DataInformationContext(); DialogResult rs = MessageBox.Show("Are u sure u want to delete?", "Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); int i = (int)dataGridView1.SelectedCells[0].Value; if (rs == DialogResult.OK) { if (i > -1) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = " DELETE FROM EmployeeInfoes WHERE Id='" + i + "'"; MessageBox.Show("Employee Deleted Successfully"); cmd.ExecuteNonQuery(); con.Close(); } } else { MessageBox.Show("Not Deleted Any Value"); } //var AllEmployee = db.EmployeeInfos.Select(E => E.Id); //if (AllEmployee != null) //{ // db.EmployeeInfos.Remove(); // db.SaveChanges(); //} ////EmployeeData ed = new EmployeeData(); //var context = new DataInformationContext(); //var allEmployee =context.EmployeeInfos.Where(c=>c.Id ==c.Id).FirstOrDefault(); //if (allEmployee.Count() != 0) //{ // var result = MessageBox.Show("Delete this customer?", "Not Deleted", MessageBoxButtons.YesNo); // if (result == DialogResult.Yes) // { // foreach (var emp in allEmployee) // { // context.EmployeeInfos.DeleteOnSubmit(emp); // } // try { // //context.SubmitChanges(); // } // catch { // MessageBox.Show("Cant delete"); // } // MessageBox.Show("Employee deleted"); // this.Hide(); // } // else { // this.Hide(); // } //} //else { MessageBox.Show("No User Found"); } }