Ejemplo n.º 1
0
        private void XSendEmail()
        {
            try
            {
                var message = new MailMessage(_mymail, txtemail.Text)
                {
                    Subject = _subject, Body = _mailmsg
                };

                using (var mailer = new SmtpClient("smtp.gmail.com", 587))
                {
                    mailer.Credentials = new NetworkCredential(_mymail, _mypassword);
                    mailer.EnableSsl   = true;
                    mailer.Send(message);
                }
            }
            catch
            {
                var t = new T_Message();
                t.Show(this);
                var ok = new Frm_OK
                {
                    msgtxt        = { Text = @"There is an error sending and email, ensure that the root mail is set up properly! and ensure that the application is not blocked by the firewall! And ensure that this PC has an internet connection!" },
                    OkDescription = "Warn",
                    titletxt      = { Text = @"E-mail error" }
                };
                ok.ShowDialog();
                t.Dispose();
                // ignored
            }
        }
Ejemplo n.º 2
0
        private async void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            if (TranNum != null)
            {
                Sqlcmd.Parameters.Clear();
                await Conopen();

                Strsql                   = "Select * from tbl_Transaction_Detail where Inv_Num='" + TranNum + "' AND Prod_Number = '" + label2.Text + "'";
                Sqlcmd.CommandText       = Strsql;
                Sqlcmd.Connection        = Cnn;
                Sqladapter.SelectCommand = Sqlcmd;
                Sqlreader                = Sqlcmd.ExecuteReader();
                //metroComboBox1.Items.Clear();
                if (Sqlreader.Read())
                {
                    Sqlcmd.Dispose();
                    Sqlreader.Close();
                    Cnn.Close();
                    Strsql = "";
                    var ms = new T_Message();
                    var ok = new Frm_OK();
                    ms.Show(this);
                    ok.OkDescription = "Warn";
                    ok.titletxt.Text = @"Warning";
                    ok.msgtxt.Text   = @"This product is already in the cart. Are you trying to modify it's quantity? If so, please select set quantity option in the cart panel.";
                    ok.ShowDialog();
                    ms.Close();
                    Focus();
                }
                else
                {
                    Sqlcmd.Dispose();
                    Sqlreader.Close();
                    Cnn.Close();
                    Strsql = "";
                    var b = new T_Transaction();
                    var a = new FrmAddToCart();
                    a.lblprodID.Text = label2.Text;
                    b.Show(this);
                    a.ShowDialog();
                    b.Dispose();
                    a.Dispose();
                    Focus();
                }
            }
            else
            {
                var b = new T_Transaction();
                var a = new FrmAddToCart();
                a.lblprodID.Text = label2.Text;
                b.Show(this);
                a.ShowDialog();
                //c.lblinvoice.Text = a.inv_num;
                b.Dispose();
                a.Dispose();
                Focus();
            }
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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();
        }
Ejemplo n.º 5
0
        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);

                //}
            }
        }
Ejemplo n.º 6
0
        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();
        }
Ejemplo n.º 7
0
        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);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private async void bunifuFlatButton2_Click(object sender, EventArgs e)
        {
            var a = new T_Message();

            if (txtfname.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's first name!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtfname.Focus();
            }
            else if (txtlname.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's last name!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtlname.Focus();
            }
            else if (cmbprefix.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please select customer's preferred prefix!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                cmbprefix.Focus();
            }
            else if (txtaddress.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's address!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtaddress.Focus();
            }
            else if (txtmobilephone.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's mobile number!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtmobilephone.Focus();
            }
            else if (txtemail.Text == "")
            {
                var frmok = new Frm_OK
                {
                    titletxt      = { Text = @"Warning" },
                    OkDescription = "Warn",
                    msgtxt        = { Text = @"Please enter customer's valid e-mail address!" }
                };
                a.Show(this);
                frmok.ShowDialog();
                a.Dispose();
                Focus();
                txtemail.Focus();
            }
            else
            {
                await XGen_ID();
                await XAddCustomer();

                XSendEmail();
            }
        }
Ejemplo n.º 9
0
        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();
            }
        }