private void button6_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameTxt.BackColor = Color.Red; return; } MemoryStream stream = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg); string fullimage = ImageToBase64(stream); if (!string.IsNullOrEmpty(existingID)) { if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Staff j = new Staff(existingID, nameTxt.Text, contactTxt.Text, departmentCbx.Text, fullimage, emailTxt.Text); DBConnect.Update(j, existingID); existingID = ""; return; } } existingID = ""; string id = Guid.NewGuid().ToString(); Staff _user = new Staff(id, nameTxt.Text, contactTxt.Text, departmentCbx.Text, fullimage, emailTxt.Text); if (DBConnect.Insert(_user) != "") { MessageBox.Show("Information Saved"); this.DialogResult = DialogResult.OK; this.Dispose(); } }
private void button4_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(amountTxt.Text)) { amountTxt.BackColor = Color.Red; return; } if (string.IsNullOrEmpty(itemTxt.Text)) { itemTxt.BackColor = Color.Red; return; } if (!string.IsNullOrEmpty(existingID)) { if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Expense j = new Expense(existingID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, categoryTxt.Text, Convert.ToDouble(amountTxt.Text), month); DBConnect.Update(j, existingID); existingID = ""; } return; } existingID = ""; string ID = Guid.NewGuid().ToString(); Expense i = new Expense(ID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, categoryTxt.Text, Convert.ToDouble(amountTxt.Text), month); DBConnect.Insert(i); MessageBox.Show("Information Saved "); itemTxt.Text = ""; amountTxt.Text = ""; autocompleteCategory(); autocomplete(); }
private void button4_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(endTxt.Text)) { endTxt.BackColor = Color.Red; return; } if (string.IsNullOrEmpty(categoryTxt.Text)) { categoryTxt.BackColor = Color.Red; return; } if (!string.IsNullOrEmpty(existingID)) { if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Cogs j = new Cogs(existingID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, categoryTxt.Text, Convert.ToDouble(begTxt.Text), Convert.ToDouble(endTxt.Text), Convert.ToDouble(cogsTxt.Text), month); DBConnect.Update(j, existingID); existingID = ""; return; } else { return; } } existingID = ""; string ID = Guid.NewGuid().ToString(); Cogs i = new Cogs(ID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, categoryTxt.Text, Convert.ToDouble(begTxt.Text), Convert.ToDouble(endTxt.Text), Convert.ToDouble(cogsTxt.Text), month); DBConnect.Insert(i); MessageBox.Show("Information Saved "); categoryTxt.Text = ""; endTxt.Text = ""; }
private void button4_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(amountTxt.Text)) { amountTxt.BackColor = Color.Red; return; } if (string.IsNullOrEmpty(itemTxt.Text)) { itemTxt.BackColor = Color.Red; return; } if (!string.IsNullOrEmpty(existingID)) { if (MessageBox.Show("YES or No?", "Are you sure you want to update the current existing information ? ", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { Sale j = new Sale(existingID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), itemTxt.Text, month); DBConnect.Update(j, existingID); existingID = ""; return; } else { return; } } else { string test = ""; try { test = Sale.List("SELECT * from sale WHERE item='" + itemTxt.Text + "' AND week = '" + weekLbl.Text + "' AND date = '" + Convert.ToDateTime(dateTxt.Text).Year.ToString() + "'").First().Amount.ToString(); } catch (Exception y) { // Helper.Exceptions(y.Message, "on adding inventory auto fill the category list selected item"); } if (!string.IsNullOrEmpty(test)) { MessageBox.Show("Value seems to be inserted already"); return; } Helper.CurrentWeek = Convert.ToInt32(weekLbl.Text); Helper.CurrentStarting = startLbl.Text; Helper.CurrentEnding = endLbl.Text; existingID = ""; string ID = Guid.NewGuid().ToString(); Sale i = new Sale(ID, Convert.ToDateTime(dateTxt.Text).Year.ToString(), Convert.ToInt32(weekLbl.Text), startLbl.Text, endLbl.Text, itemTxt.Text, Convert.ToDouble(amountTxt.Text), itemTxt.Text, month); DBConnect.Insert(i); MessageBox.Show("Information Saved "); itemTxt.Text = ""; amountTxt.Text = ""; } }
private void button5_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameTxt.BackColor = Color.Red; return; } MemoryStream stream = Helper.ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg); string fullimage = Helper.ImageToBase64(stream); if (!String.IsNullOrEmpty(UserID)) { User _user = new User(UserID, nameTxt.Text, contactTxt.Text, Helper.MD5Hash(pass2Txt.Text), fullimage, Convert.ToInt32(levelCbx.Text)); DBConnect.Update(_user, UserID); MessageBox.Show("Information Updated"); this.DialogResult = DialogResult.OK; this.Dispose(); } }
private void button5_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameTxt.BackColor = Color.Red; return; } MemoryStream stream = ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg); string fullimage = ImageToBase64(stream); if (!String.IsNullOrEmpty(StaffID)) { Staff _user = new Staff(StaffID, nameTxt.Text, contactTxt.Text, departmentCbx.Text, fullimage, emailTxt.Text); DBConnect.Update(_user, StaffID); MessageBox.Show("Information Updated"); this.DialogResult = DialogResult.OK; this.Dispose(); } }
private void button5_Click(object sender, EventArgs e) { if (nameTxt.Text == "") { nameTxt.BackColor = Color.Red; return; } MemoryStream stream = Helper.ImageToStream(imgCapture.Image, System.Drawing.Imaging.ImageFormat.Jpeg); string fullimage = Helper.ImageToBase64(stream); if (!String.IsNullOrEmpty(CompanyID)) { Company _company = new Company(CompanyID, nameTxt.Text, addressTxt.Text, fullimage, currentTxt.Text); DBConnect.Update(_company, CompanyID); MessageBox.Show("Information Updated"); this.DialogResult = DialogResult.OK; this.Dispose(); } }