private void cart_Paint(object sender, PaintEventArgs e) { businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.Select("all", "cart", "", ""); DataTable table = new DataTable(); if (dr != null) { table.Load(dr); if (table != null) { CartTable.DataSource = table; } } double Price = 0; foreach (DataGridViewRow row in CartTable.Rows) { if (!row.IsNewRow) { Price += Convert.ToDouble(row.Cells["ModSellPrice"].Value); } } TotalPrice.Text = Price.ToString() + " L.E."; foreach (DataGridViewRow row in CartTable.SelectedRows) { if (!row.IsNewRow) { bl.DeleteRow("cart", "MobileSerial", row.Cells["MobileSerial"].Value + ""); CartTable.Rows.Remove(row); MessageBox.Show("Delete Operation is Completed"); } } }
public void GetData(int Num, DateTime DT) { BillNo = Num.ToString(); this.DT = DT; businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.Select("all", "cart", "", ""); DataTable table = new DataTable(); if (dr != null) { table.Load(dr); } foreach (DataRow row in table.Rows) { MobileSerial.Add(row["MobileSerial"].ToString()); CustomerSSN.Add(row["CustomerSSN"].ToString()); ModSellPrice.Add(row["ModSellPrice"].ToString()); ModCompany.Add(row["ModCompany"].ToString()); TotalPrice += Convert.ToDouble(row["ModSellPrice"].ToString()); } TotalPriceSTR = TotalPrice + " L.E."; }
private void AddEmpB_Click(object sender, EventArgs e) { if (OldPass.Text.Equals("") || NewPass.Text.Equals("") || RNewPass.Text.Equals("")) { MessageBox.Show("Please,Fill The Input Fields!"); } else { businesslayer bl = new businesslayer(); bl.changePass(OldPass.Text, NewPass.Text, RNewPass.Text); } }
private void button2_Click(object sender, EventArgs e) { if (CompNameA.Text.Equals("") || CompSerial.Text.Equals("")) { MessageBox.Show("Please, Fill The Tnput Fields"); } else { businesslayer bl = new businesslayer(); bl.InsertComp(CompSerial.Text, CompNameA.Text); LoadAutoCompleteTextBoxes(); } }
private void button5_Click(object sender, EventArgs e) { if (ModelNameA.Text.Equals("") || BuyCost.Text.Equals("") || InterStorage.Text.Equals("") || ScreenSize.Text.Equals("") || ModelSerial.Text.Equals("") || SecondaryCam.Text.Equals("") || SellCost.Text.Equals("") || Ram.Text.Equals("") || PrimaryCam.Text.Equals("") || CPU.Text.Equals("") || BuyCost.Text.Equals("")) { MessageBox.Show("Please, Fill The Tnput Fields"); } else { businesslayer bl = new businesslayer(); bl.InsertModel(ModelSerial.Text, ModelNameA.Text, BuyCost.Text, SellCost.Text, Ram.Text, CPU.Text, InterStorage.Text, ScreenSize.Text, PrimaryCam.Text, SecondaryCam.Text, CompanyName.Text); LoadAutoCompleteTextBoxes(); } }
private void Browse_Paint(object sender, PaintEventArgs e) { businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.Select("all", "returnpayment", "", ""); DataTable table = new DataTable(); if (dr != null) { table.Load(dr); if (table != null) { dataGridView1.DataSource = table; } } }
private void button3_Click(object sender, EventArgs e) { if (Global.Time.Day != DateTime.Now.Day || Global.Time.Month != DateTime.Now.Month || Global.Time.Year != DateTime.Now.Year) { //MessageBox.Show("Hoba"); Global.BillNo = 1; } else { Global.BillNo++; } Global.Time = DateTime.Now; BillTemplate BillTemplate = new BillTemplate(); BillTemplate.Session = new Dictionary <string, object>(); BillTemplate.Session["Bill"] = new BillModel(); BillTemplate.Initialize(); webBrowser1.DocumentText = BillTemplate.TransformText(); businesslayer bl = new businesslayer(); foreach (DataGridViewRow row in CartTable.Rows) { if (!row.IsNewRow) { bl.Buy(Global.Time, row.Cells["CustomerSSN"].Value.ToString(), row.Cells["MobileSerial"].Value.ToString(), row.Cells["ModName"].Value.ToString(), row.Cells["ModSellPrice"].Value.ToString()); } } bl.insertBill(); MySqlDataReader dr = bl.Select("all", "cart", "", ""); DataTable table = new DataTable(); if (dr != null) { table.Load(dr); if (table != null) { CartTable.DataSource = table; } } }
public DataSet dataaccessCity(businesslayer business) { SqlConnection con = new SqlConnection(strstudent); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_selectcitystatevice"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.AddWithValue("@sid", business.stateid); SqlDataAdapter adpter = new SqlDataAdapter(cmd); DataSet dt = new DataSet(); adpter.Fill(dt); return(dt); }
public int db_delete(businesslayer bs) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_delete"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.AddWithValue("@id", bs.id); con.Open(); int p = cmd.ExecuteNonQuery(); con.Close(); return(p); }
public DataTable db_login(businesslayer bs) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "loginpage"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.AddWithValue("@un", bs.uname); cmd.Parameters.AddWithValue("@ps", bs.pwd); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); return(dt); }
private void button1_Click(object sender, EventArgs e) { //businesslayer bl = new businesslayer(); //dataGridView1 = bl.profit(firstDate.Value.ToString("dd-MM-yyyy"), endDate.Value.ToString("dd-MM-yyyy")); businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.revenue(firstDate.Value.ToString("yyyy-MM-dd"), endDate.Value.ToString("yyyy-MM-dd")); DataTable table = new DataTable(); if (dr != null) { table.Load(dr); if (table != null) { dataGridView1.DataSource = table; } } // dr.Close(); }
public void LoadAutoCompleteTextBoxes() { businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.Select("all", "company", null, null); AutoCompleteStringCollection MyCollection = new AutoCompleteStringCollection(); while (dr.Read()) { MyCollection.Add(dr.GetString(1)); } CompanyName.AutoCompleteCustomSource = MyCollection; dr = bl.Select("all", "model", null, null); MyCollection = new AutoCompleteStringCollection(); while (dr.Read()) { MyCollection.Add(dr.GetString(1)); } ModelName.AutoCompleteCustomSource = MyCollection; }
public int db_insert(businesslayer bs) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "sp_all_insert"; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = con; cmd.Parameters.AddWithValue("@fn", bs.fname); cmd.Parameters.AddWithValue("@gn", bs.gender); cmd.Parameters.AddWithValue("@hb", bs.hobby); cmd.Parameters.AddWithValue("@sb", bs.subject); cmd.Parameters.AddWithValue("@st", bs.state); cmd.Parameters.AddWithValue("@im", bs.image); con.Open(); int p = cmd.ExecuteNonQuery(); con.Close(); return(p); }
public int db_update(businesslayer bs) { SqlConnection con = new SqlConnection(str); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "update tbl_all_in_one set fname='" + bs.fname + "',gender=@gn,hobby=@hb,subject=@sb,state=@st,image=@im where id=@id"; cmd.CommandType = CommandType.Text; cmd.Connection = con; cmd.Parameters.AddWithValue("@id", bs.id); cmd.Parameters.AddWithValue("@fn", bs.fname); cmd.Parameters.AddWithValue("@gn", bs.gender); cmd.Parameters.AddWithValue("@hb", bs.hobby); cmd.Parameters.AddWithValue("@sb", bs.subject); cmd.Parameters.AddWithValue("@st", bs.state); cmd.Parameters.AddWithValue("@im", bs.image); con.Open(); int p = cmd.ExecuteNonQuery(); con.Close(); return(p); }
private void loginB_Click(object sender, EventArgs e) { businesslayer bl = new businesslayer(); MySqlDataReader dr = bl.profit(firstDate.Value.ToString("yyyy-MM-dd"), endDate.Value.ToString("yyyy-MM-dd")); if (dr.Read()) { if (!dr.IsDBNull(0)) { String temp = dr.GetString(0); proftext.Text = temp + "L.E."; } else { proftext.Text = "0 L.E."; } } else { proftext.Text = "0 L.E."; } }
private void AddEmpB_Click(object sender, EventArgs e) { businesslayer bl = new businesslayer(); if (EmpSSN.Text.Equals("") || EmpName.Text.Equals("") || EmpName.Text.Equals("") || EmpUsername.Text.Equals("") || EmpPassword.Text.Equals("") || EmpEmail.Text.Equals("")) { MessageBox.Show("Please,Fill the inputs"); } else { Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(EmpEmail.Text); if (match.Success) { bl.InsertEmp(EmpSSN.Text, EmpName.Text, EmpName.Text, EmpUsername.Text, EmpPassword.Text, EmpEmail.Text); } else { MessageBox.Show(EmpEmail.Text + " is incorrect"); } } }
private void button3_Click(object sender, EventArgs e) { businesslayer bl = new businesslayer(); if (CName.Text.Equals("") || Phone.Text.Equals("") || SSN.Text.Equals("") || Email.Text.Equals("") || ImagePath.Text.Equals("")) { MessageBox.Show("Please,Fill the inputs"); } else { Regex regex = new Regex(@"^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"); Match match = regex.Match(Email.Text); if (match.Success) { bl.InsertCust(CName.Text, Phone.Text, SSN.Text, Email.Text, ImagePath.Text); } else { MessageBox.Show(Email.Text + " is incorrect"); } } }
private void button1_Click(object sender, EventArgs e) { businesslayer bl = new businesslayer(); foreach (DataGridViewRow row in CartTable.SelectedRows) { if (!row.IsNewRow) { bl.DeleteRow("cart", "MobileSerial", row.Cells["MobileSerial"].Value + ""); CartTable.Rows.Remove(row); MessageBox.Show("Delete Operation is Completed"); } } double Price = 0; foreach (DataGridViewRow row in CartTable.Rows) { if (!row.IsNewRow) { Price += Convert.ToDouble(row.Cells["ModSellPrice"].Value); } } TotalPrice.Text = Price.ToString() + " L.E."; }
public DataTable bs_login(businesslayer bs) { return(db.db_login(bs)); }
private void button6_Click(object sender, EventArgs e) { businesslayer b1 = new businesslayer(); b1.InsertMobile(MobileSerialA.Text, ModelName.Text); }
public int bs_delete(businesslayer bs) { return(db.db_delete(bs)); }
public int bs_update(businesslayer bs) { return(db.db_update(bs)); }
public int bs_insert(businesslayer bs) { return(db.db_insert(bs)); }
private void button3_Click(object sender, EventArgs e) { businesslayer b1 = new businesslayer(); b1.InsertModel(ModelNameA.Text, CompNameA.Text, BuyCost.Text, CPU.Text, ScreenSize.Text, MobileSerialA.Text, SecondaryCam.Text, SellCost.Text, Ram.Text, PrimaryCam.Text, CompanyName.Text); }
public DataSet businessCity(businesslayer business) { return(dataaccess.dataaccessCity(business)); }