private async Task Xaddmode() { Sqlcmd.Parameters.Clear(); Image temp = new Bitmap(bunifuPictureBox1.Image); var strm = new MemoryStream(); temp.Save(strm, ImageFormat.Jpeg); _imagebytearray = strm.ToArray(); await Conopen(); Strsql = "Insert into tbl_Products(Prod_Barcode, Prod_Name, Prod_Stock, Unit_Desc, Prod_Price,Prod_Img,production_Strt_date,cost_sale,cat_desc,prod_description,prod_FS,prod_exp_date) " + "Values(@Prod_Barcode, @Prod_Name, @Prod_Stock, @Unit_Desc, @Prod_Price, @Prod_Img,@production_Strt_date,@cost_sale,@cat_desc,@prod_description,@prod_FS,@prod_exp_date)"; Sqlcmd.Parameters.AddWithValue("@Prod_Barcode", bunifuTextBox2.Text); Sqlcmd.Parameters.AddWithValue("@Prod_Name", bunifuTextBox1.Text); Sqlcmd.Parameters.AddWithValue("@Prod_Stock", bunifuTextBox3.Text); Sqlcmd.Parameters.AddWithValue("@Unit_Desc", cmbounit.Text); Sqlcmd.Parameters.AddWithValue("@Prod_Price", bunifuTextBox4.Value); Sqlcmd.Parameters.AddWithValue("@Prod_Img", _imagebytearray); Sqlcmd.Parameters.AddWithValue("@production_Strt_date", psdstartdate.Value); Sqlcmd.Parameters.AddWithValue("@cost_sale", cost.Value); Sqlcmd.Parameters.AddWithValue("@cat_desc", category.Text); Sqlcmd.Parameters.AddWithValue("@prod_description", txtdesciption.Text); Sqlcmd.Parameters.AddWithValue("@prod_FS", prodFS); Sqlcmd.Parameters.AddWithValue("@prod_exp_date", dateTimePicker1.Value); Sqlcmd.Connection = Cnn; //sqlcmd.CommandType = CommandType.Text; Sqlcmd.CommandText = Strsql; Sqlcmd.ExecuteNonQuery(); var a = new T_Message(); var frmok = new Frm_OK(); a.Show(this); frmok.titletxt.Text = @"Success"; frmok.msgtxt.Text = @"Record has been successfully Added! Please refresh the products data to see modified changes."; frmok.OkDescription = "Success"; frmok.ShowDialog(this); a.Hide(); Sqlcmd.Dispose(); Strsql = ""; Cnn.Close(); Close(); }
private async Task XAddCustomer() { Sqlcmd.Parameters.Clear(); Image temp = new Bitmap(bunifuPictureBox1.Image); var strm = new MemoryStream(); temp.Save(strm, ImageFormat.Jpeg); _imagebytearray = strm.ToArray(); await Conopen(); Strsql = "Insert into tbl_customer(cus_ID, cus_fname, cus_lname, cus_prefix, cus_address, cus_home_phone, cus_mobile,cus_email,cus_dob,cus_notes,cus_img) " + "Values(@cus_ID, @cus_fname, @cus_lname, @cus_prefix, @cus_address, @cus_home_phone, @cus_mobile, @cus_email,@cus_dob,@cus_notes,@cus_img)"; Sqlcmd.Parameters.AddWithValue("@cus_ID", _idNum); Sqlcmd.Parameters.AddWithValue("@cus_fname", txtfname.Text); Sqlcmd.Parameters.AddWithValue("@cus_lname", txtlname.Text); Sqlcmd.Parameters.AddWithValue("@cus_prefix", cmbprefix.Text); Sqlcmd.Parameters.AddWithValue("@cus_address", txtaddress.Text); Sqlcmd.Parameters.AddWithValue("@cus_home_phone", txthomephone.Text); Sqlcmd.Parameters.AddWithValue("@cus_mobile", txtmobilephone.Text); Sqlcmd.Parameters.AddWithValue("@cus_email", txtemail.Text); Sqlcmd.Parameters.AddWithValue("@cus_dob", dateTimePicker1.Value); Sqlcmd.Parameters.AddWithValue("@cus_notes", txtnotes.Text); Sqlcmd.Parameters.AddWithValue("@cus_img", _imagebytearray); Sqlcmd.Connection = Cnn; Sqlcmd.CommandText = Strsql; Sqlcmd.ExecuteNonQuery(); var a = new T_Message(); var frmok = new Frm_OK(); a.Show(this); frmok.titletxt.Text = @"Success"; frmok.msgtxt.Text = @"Record has been successfully Added! Please refresh the customer data to see modified changes."; frmok.OkDescription = "Success"; frmok.ShowDialog(this); a.Hide(); Sqlcmd.Dispose(); Strsql = ""; Cnn.Close(); XCustomerLoaded = false; Close(); }
private async void numericUpDown1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyData == Keys.Enter) { var ok = new Frm_OK(); var a = new T_Message(); //try //{ Sqlcmd.Parameters.Clear(); await Conopen(); Strsql = "Update tbl_Transaction_Detail set Tran_D_Subtotal=@Tran_D_Subtotal, Disc=@Disc Where Prod_Number=@Prod_Number And Inv_Num=@Inv_Num"; Sqlcmd.Parameters.AddWithValue("@Tran_D_Subtotal", Convert.ToSingle(lblnewamount.Text)); Sqlcmd.Parameters.AddWithValue("@Disc", Convert.ToDecimal(lbldiscount.Text)); Sqlcmd.Parameters.AddWithValue("@Inv_Num", inv_num); Sqlcmd.Parameters.AddWithValue("@Prod_Number", proid); Sqlcmd.Connection = Cnn; //sqlcmd.CommandType = CommandType.Text; Sqlcmd.CommandText = Strsql; Sqlcmd.ExecuteNonQuery(); ok.OkDescription = "Success"; ok.titletxt.Text = @"Success"; ok.msgtxt.Text = @"Discount has been successfully added!"; a.Show(this); ok.ShowDialog(); a.Hide(); Sqlcmd.Dispose(); Strsql = ""; Cnn.Close(); FillCart = true; Hide(); //} //catch (Exception ex) //{ // a.Show(this); // ok.titletxt.Text = @"Error"; // ok.msgtxt.Text = @"System has encountered an unexpected Error! Please contact the system developer relating to this problem."; // ok.OkDescription = "Error"; // ok.ShowDialog(this); // a.Hide(); // Focus(); // //call LogFile method and pass argument as Exception message, event name, control name, error line number, current form name // LogFile(ex.Message, e.ToString(), ((Control)sender).Name, ex.LineNumber(), FindForm()?.Name); //} } }
private async Task XTransaction() { Sqlcmd.Parameters.Clear(); await Conopen(); Strsql = "Select * from tbl_Transaction where Inv_Num like '" + inv_num + "'"; Sqlcmd.CommandText = Strsql; Sqlcmd.Connection = Cnn; Sqladapter.SelectCommand = Sqlcmd; DataTable sqlDt = new DataTable(); sqlDt.Reset(); Sqladapter.Fill(sqlDt); Sqlreader = Sqlcmd.ExecuteReader(); //************************************************** if (!Sqlreader.Read()) { await XSaveTransaction(); await XSaveTransactionDetails(); } else { await XSaveTransactionDetails(); } var a = new T_Message(); var frmok = new Frm_OK(); a.Show(this); frmok.titletxt.Text = @"Success"; frmok.msgtxt.Text = @"Item successfully added to cart!"; frmok.OkDescription = "Success"; frmok.ShowDialog(this); a.Hide(); //popup.TitleText = @"Success"; //popup.Image = Properties.Resources.check; //popup.ContentText = @"The product "+ lblprodname.Text + " has been successfully added to cart!"; //popup.Popup(); Sqlcmd.Dispose(); Strsql = ""; Cnn.Close(); TranNum = inv_num; FillCart = true; Hide(); }
private async void bunifuFlatButton2_Click(object sender, EventArgs e) { var ok = new Frm_OK(); var a = new T_Message(); if (bunifuTextBox1.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter Product name!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox1.Focus(); } else if (bunifuTextBox3.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter Product Stock!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox3.Focus(); } else if (cmbounit.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Select Product's Unit description!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); cmbounit.Focus(); } else if (bunifuTextBox4.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Select Product's Unit price!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox4.Focus(); } else { if (_PAdd) { try { if (bunifuCheckBox2.Checked) { await Xaddmode(); } else { await Xaddmode1(); } } catch (Exception ex) { a.Show(this); ok.titletxt.Text = "Error"; ok.msgtxt.Text = "System has encountered an unexpected Error! Please contact the system developer relating to this problem."; ok.OkDescription = "Error"; ok.ShowDialog(this); a.Hide(); Focus(); LogFile(ex.Message, e.ToString(), ((Control)sender).Name, ex.LineNumber(), FindForm()?.Name); } } } }
private async void bunifuFlatButton2_Click(object sender, EventArgs e) { var a = new T_Message(); if (bunifuTextBox5.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter your full name!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox5.Focus(); } else if (bunifuTextBox6.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter your address!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox6.Focus(); } else if (bunifuTextBox7.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter your contact number!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox7.Focus(); } else if (cmbodesig.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please your designation!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); cmbodesig.Focus(); } else if (bunifuTextBox4.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter your unique user name!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox4.Focus(); } else if (bunifuTextBox3.Text == "") { var frmok = new Frm_OK { titletxt = { Text = "Warning" }, OkDescription = "Warn", msgtxt = { Text = "Please Enter your password!" } }; a.Show(this); frmok.ShowDialog(); a.Hide(); Focus(); bunifuTextBox3.Focus(); } else { await XSignUp(); } }