public void mailSender(sellPipe data, string billNo) { try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add("*****@*****.**"); mail.Subject = "Sells Bill No:" + billNo; mail.Body = "\nSold By: " + data.UserName + " \n\n\nCustomer Name: " + data.CustomerName + "\nCustomer Email: " + data.CustomerEmail + "\nCustomer PhoneNumber: " + data.CustomerPhoneNumber + "\n\nPipe Name: " + data.PipeName + "\nPipe Size: " + data.PipeSize + "\nQuantity: " + data.Quantity + "\n\nTotal Price: " + data.TotalPrice + "\n\nPaid Amount: " + data.PaidAmount + "\n\nDue Amount: " + data.DueAmount + "\n\nDiscount: " + discountField.Text; //[email protected]", "tonmoydotzone$$$" SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "tonmoydotzone$$$"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); //MessageBox.Show("mail Send"); notifyIcon1.ShowBalloonTip(1000, "Sending Sell Report As Mail", "Mail has been send to admin", ToolTipIcon.Info); } catch (Exception ex) { // MessageBox.Show(ex.ToString()); // notifyIcon1.ShowBalloonTip(1000, "Sending Sell Mail failed", ex.ToString(), ToolTipIcon.Info); // MessageBox.Show(""+ex); } }
public void mailSender(sellPipe data, string billNo) { try { MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com"); mail.From = new MailAddress("*****@*****.**"); mail.To.Add("*****@*****.**"); mail.Subject = "Purchase Bill No:" + billNo; mail.Body = "\nPurchase By: " + data.UserName + " \n\n\nBought From: " + textBox3.Text + "\n\nPipe Name: " + data.PipeName + "\nPipe Size: " + data.PipeSize + "\nQuantity Bought: " + textBox4.Text + "\nPresent Quantity: " + data.Quantity + "\n\nUnit price: " + textBox5.Text + "\n\nTotal Price: " + data.TotalPrice; SmtpServer.Port = 587; SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "tonmoydotzone$$$"); SmtpServer.EnableSsl = true; SmtpServer.Send(mail); //MessageBox.Show("mail Send"); notifyIcon1.ShowBalloonTip(1000, "Sending Report As Mail", "Mail has been send to admin", ToolTipIcon.Info); } catch (Exception ex) { // MessageBox.Show(ex.ToString()); // notifyIcon1.ShowBalloonTip(1000, "Sending Purchase report Mail failed", ex.ToString(), ToolTipIcon.Info); } }
public void createPdf(string billNo, sellPipe sp) { this.sp = sp; this.data = new List <string>(); this.data.Add(this.sp.PipeName); //0 this.data.Add(this.sp.PipeSize); //1 this.data.Add(this.sp.Quantity); //2 this.data.Add(this.sp.PricePerPipe); //3 this.data.Add(this.sp.TotalPrice); //4 this.data.Add(this.sp.CustomerName); //5 this.data.Add(this.sp.CustomerPhoneNumber); //6 this.data.Add(this.sp.CustomerEmail); //7 this.data.Add(this.sp.PaidAmount); //8 this.data.Add(this.sp.DueAmount); //9 this.data.Add(this.sp.Discount); //10 this.data.Add(this.sp.UserName); //11 this.data.Add(this.sp.TotalPrize); //12 this.data.Add(billNo); //13 this.billNo = billNo; if (!this.ad.dataAddToDb(this.data)) { MessageBox.Show("Check Internet Connection\n\nOr Report to admin"); } else { MakePdf(); } }
public PdfMaker() { this.data = null; this.sp = null; ad = new addData(); this.alert = new Alert(); }
private void proceedButton_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; if (String.IsNullOrEmpty(textBox1.Text) || String.IsNullOrEmpty(cEmail.Text) || String.IsNullOrEmpty(phoneNumber.Text) || String.IsNullOrEmpty(paidAmount.Text) || quantityField.Text.Equals("0")) { MessageBox.Show("Enter all information\nEnter \'no-email\' if customer doesn't have any email-address.\nPipe Quanity must be more then 0"); } else if ((int.Parse(paidAmount.Text)) == 0) { this.alert.Show(alert.Error, "Customer must pay"); } else { if ((Double.Parse(totalPrice.Text) / 2) > (Double.Parse(paidAmount.Text))) { this.alert.Show(alert.Error, "Customer should may more then half"); } else { if (discountField.Text.Equals("")) { discountField.Text = "0"; ddval.Text = "0"; } string billNo = DateTime.Now.ToString("MM") + DateTime.Now.ToString("dd") + DateTime.Now.ToString("yy") + DateTime.Now.ToString("hh") + DateTime.Now.ToString("mm") + DateTime.Now.ToString("ss"); var data = new sellPipe() { PipeName = comboBox1.Text, PipeSize = comboBox2.Text, Quantity = quantityField.Text, CustomerName = textBox1.Text, Discount = discountField.Text, CustomerEmail = cEmail.Text, CustomerPhoneNumber = (comboBox3.Text + phoneNumber.Text), TotalPrize = (Double.Parse(totalPrice.Text) - Double.Parse(ddval.Text)).ToString(), PricePerPipe = pricePerUnit.Text, DueAmount = dueAmount.Text, UserName = this.UserName, PaidAmount = this.paidAmount.Text, TotalPrice = totalPrice.Text }; new PdfMaker().createPdf(billNo, data); this.Cursor = Cursors.Default; mailSender(data, billNo); } } this.Cursor = Cursors.Default; }
public void stockUpdate() { if (check(pName.Text)) { this.Cursor = Cursors.Default; this.alert.Show(this.alert.Warning, "Pipe Name Not Given "); } else if (check(label21.Text)) { this.Cursor = Cursors.Default; this.alert.Show(this.alert.Warning, "Pipe Size Not Given "); } else if (check(label26.Text)) { this.Cursor = Cursors.Default; this.alert.Show(this.alert.Warning, "Seller Information Not Given "); } else { string sql; string sql2; string billNo = DateTime.Now.ToString("mm") + DateTime.Now.ToString("dd") + DateTime.Now.ToString("yy") + DateTime.Now.ToString("hh") + DateTime.Now.ToString("MM") + DateTime.Now.ToString("ss"); var data = new sellPipe() { PipeName = pName.Text, PipeSize = label21.Text, Quantity = label23.Text, PricePerPipe = label24.Text, TotalPrice = label25.Text, UserName = this.UserName }; if (!pname && !psize) { this.pc.getPrice(data.PipeName, data.PipeSize); int quantity = int.Parse(this.pc.Quantity); data.Quantity = (quantity + int.Parse(label23.Text)).ToString(); sql = String.Format("update stock set quantity={0} where pipe_name='{1}' and pipe_size='{2}'", data.Quantity, data.PipeName, data.PipeSize); sql2 = sql2 = string.Format("INSERT INTO `transection`(`billNo`,`item_date`, `pipe_name`, `pipe_size`, `quantity`, `amount` ,`paid_amount`,`due_amount`,`done_by`, `status`) VALUES ('{0}','{1}',\'" + data.PipeName + "\',\'" + data.PipeSize + "\'," + data.Quantity + "," + data.TotalPrice + ",{2},{3},'{4}',\'purchase\')", billNo, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), data.TotalPrice, 0, data.UserName); // MessageBox.Show(sql); if (this.pda.addToDb(sql)) { if (this.pda.addToDb(sql2)) { this.Cursor = Cursors.Default; this.alert.Show(alert.Success, "Purchase report done"); mailSender(data, billNo); } else { this.Cursor = Cursors.Default; this.alert.Show(alert.Error, "Transection error\nNet Connection problem"); } } else { this.Cursor = Cursors.Default; this.alert.Show(alert.Error, "update error\nNet Connection problem"); } } else { if (!String.IsNullOrEmpty(textBox5.Text)) { if (!this.pda.CheckStock(data.PipeName, data.PipeSize)) { sql = String.Format("insert into stock(`pipe_name`,`pipe_size`,`quantity`,`price_per_unit`)values('{0}','{1}',{2},{3})", data.PipeName, data.PipeSize, data.Quantity, data.PricePerPipe); } else { this.pc.getPrice(data.PipeName, data.PipeSize); int quantity = int.Parse(this.pc.Quantity); data.Quantity = (quantity + int.Parse(label23.Text)).ToString(); sql = String.Format("update stock set quantity={0} where pipe_name='{1}' and pipe_size='{2}'", data.Quantity, data.PipeName, data.PipeSize); } // MessageBox.Show(sql); sql2 = sql2 = string.Format("INSERT INTO `transection`(`billNo`,`item_date`, `pipe_name`, `pipe_size`, `quantity`, `amount` ,`paid_amount`,`due_amount`,`done_by`, `status`) VALUES ('{0}','{1}',\'" + data.PipeName + "\',\'" + data.PipeSize + "\'," + data.Quantity + "," + data.TotalPrice + ",{2},{3},'{4}',\'purchase\')", billNo, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), data.TotalPrice, 0, data.UserName); if (this.pda.addToDb(sql)) { if (this.pda.addToDb(sql2)) { mailSender(data, billNo); this.Cursor = Cursors.Default; this.alert.Show(alert.Success, "Purchase report done"); } else { this.Cursor = Cursors.Default; this.alert.Show(alert.Error, "Transection error\nNet Connection problem"); } } else { this.Cursor = Cursors.Default; this.alert.Show(alert.Error, "update error\nNet Connection problem"); } } else { this.Cursor = Cursors.Default; this.alert.Show(alert.Error, "Enter price per unit "); } } } }