private void Btnsendemail_Click(object sender, EventArgs e) { ShopSendEmail FrmSemdEmail = new ShopSendEmail(); FrmSemdEmail.Connnection = lsGdb.Gdb; FrmSemdEmail.ShowDialog(this); }
private void BtnRec_Click(object sender, EventArgs e) { Pb1.Visible = true; BtnRec.Enabled = false; string lsVou = "", lsMem = "", lsSendDate = "", lsFlagSendEmailSu = "1"; string lsTO = lsIni.GetString("thahr30", "emailto", "*****@*****.**"); string lsSendrptdailypayinrecordpaymentEmailTO = lsIni.GetString("thahr30", "sendrptdailypayinrecordpaymentemailto", "*****@*****.**"); Lb1.Items.Clear(); if (ChkSendReportSu.Checked) { Lb1.Items.Add("àÃÔèÁÊè§ E-mail á¨é§ÂÍ´ Voucher Çѹ·Õè" + TxtStartDate.Value.ToString()); Application.DoEvents(); string lsSMTP = lsIni.GetString("thahr30", "smtp", "mail.asianet.co.th"); ShopSendEmail frmSendEmail = new ShopSendEmail(); frmSendEmail.SendDate = TxtStartDate.Value; frmSendEmail.SendEMail(lsSMTP, false, lsTO, "rptdailypayinrecordsuemail"); frmSendEmail.SendEMail(lsSMTP, false, lsSendrptdailypayinrecordpaymentEmailTO, "rptdailypayinrecordpayment"); Lb1.Items.Add("Êè§ E-mail àÃÕºÃéÍÂ"); lsFlagSendEmailSu = "2"; Application.DoEvents(); } lsSendDate = lsGdb.SelectDateMySQL(TxtStartDate.Value); Lb1.Items.Add("àÃÔèÁÊ觢éÍÁÙÅ Voucher"); Application.DoEvents(); if (SeparateVoucher(ChkHD.Checked, Convert.ToInt32(CboTSend.SelectedValue.ToString())) == true) { lsVou = "Ê觢éÍÁÙÅ Voucher àÃÕºÃéÍÂ"; //MessageBox.Show("Ê觢éÍÁÙÅàÃÕºÃéÍÂ", "Ê觢éÍÁÙÅ", MessageBoxButtons.OK); } Lb1.Items.Add("Ê觢éÍÁÙÅ Voucher àÃÕºÃéÍ "); Application.DoEvents(); Int32 liMember = 0; string lsServer = "", lsDatabase = "", lsStrSelect = "", lsStrUpdate = ""; lsServer = lsIni.GetString("thahr30", "serverdatabasename", "localhost"); lsDatabase = lsIni.GetString("thahr30", "databasename", "thahr3"); string lsDatabaseServerName = lsIni.GetString("thahr30", "databaseservername", "thahr3"); string lsUserName = lsIni.GetString("thahr30", "username", "janepop"); string lsPassword = lsIni.GetString("thahr30", "password", "Ekartc2c5"); if (ChkHD.Checked) { lsStrSelect = TxtIP.Text; lsStrUpdate = lsServer; } else { lsStrSelect = lsServer; lsStrUpdate = TxtIP.Text; } lsConnSelect1.ConnectionString = "Data Source=" + lsStrSelect + ";Database=" + lsDatabaseServerName + ";User ID=" + lsUserName + ";Password="******""; lsConnSelect2.ConnectionString = "Data Source=" + lsStrSelect + ";Database=" + lsDatabaseServerName + ";User ID=" + lsUserName + ";Password="******""; lsConnUpdate1.ConnectionString = "Data Source=" + lsStrUpdate + ";Database=" + lsDatabase + ";User ID=" + lsUserName + ";Password="******""; try { lsConnSelect1.Open(); Lb1.Items.Add("à»Ô´ Connection " + lsConnSelect1.Database); Application.DoEvents(); lsConnSelect2.Open(); Lb1.Items.Add("à»Ô´ Connection " + lsConnSelect2.Database); Application.DoEvents(); } catch (Exception e1) { string ls = "äÁèÊÒÁÒöµÔ´µèÍ Counter SeparateMember ä´é "; lsGdb.WriteLogError(ls, e1, "", "SeparateMember"); MessageBox.Show("äÁèÊÒÁÒöµÔ´µèÍ°Ò¹¢éÍÁÙÅ " + lsStrSelect + " " + e1.Message.ToString(), e1.Source.ToString()); } try { lsConnUpdate1.Open(); Lb1.Items.Add("à»Ô´ Connection " + lsConnUpdate1.Database); Application.DoEvents(); } catch (Exception e2) { string ls = "äÁèÊÒÁÒöµÔ´µèÍ Counter SeparateMember ä´é "; lsGdb.WriteLogError(ls, e2, "", "SeparateMember"); MessageBox.Show("äÁèÊÒÁÒöµÔ´µèÍ°Ò¹¢éÍÁÙÅ " + lsStrUpdate + " " + e2.Message.ToString(), e2.Source.ToString()); } Lb1.Items.Add("àÃÔèÁÃѺ¢éÍÁÙÅ Member "); Application.DoEvents(); liMember = SeparateMember(ChkHD.Checked); lsMem = "ÃѺ¢éÍÁÙÅ Member " + liMember.ToString() + "àÃÕºÃéÍÂ"; Lb1.Items.Add("ÃѺ¢éÍÁÙÅ Member àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Nationality, "nationcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("nationality", "nationcode", "nationname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ Nationality àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.TypeRoom, "plcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("typeroom", "plcode", "plnamee"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ ÃÒ¤ÒËéͧ¾Ñ¡ àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.TypeMem, "tmemcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("typemem", "tmemcode", "tmemname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ »ÃÐàÀ·ÊÁÒªÔ¡ àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.TypeBis, "tbiscode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("typebis", "tbiscode", "tbisname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ »ÃÐàÀ·ÇÔÊÒË¡Ô¨ àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Status, "statuscode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("status", "statuscode", "statusname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙŠʶҹРàÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Staff, "staffcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("staff", "staffcode", "staffname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ ¾¹Ñ¡§Ò¹ àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Shift, "shiftcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("shift", "shiftcode", "shiftname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ Shift àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Salutation, "salcode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("salutation", "salcode", "salnamee"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ Sale àÃÕºÃéÍÂ"); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.Region, "regioncode", "", Pb1, lsConnSelect1, lsConnUpdate1); //SeparateInitial("region", "regioncode", "regionname"); Lb1.Items.Add("»ÃѺ»Ãا¢éÍÁÙÅ Region àÃÕºÃéÍÂ"); if (ChkPriceList.Checked == true) { Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; Cursor.Show(); Lb1.Items.Add("¡ÓÅѧÊ觢éÍÁÙÅ PriceList "); Application.DoEvents(); lsGdb.SeparateTable(Connection.TableIniT.MemberPriceList, "plid", "", Pb1, lsConnUpdate1, lsConnSelect1); Lb1.Items.Add("Ê觢éÍÁÙÅ PriceList àÃÕºÃéÍÂ"); Cursor.Current = System.Windows.Forms.Cursors.Default; Cursor.Show(); } Application.DoEvents(); lsConnSelect1.Close(); Lb1.Items.Add("»Ô´ Connection " + lsConnSelect1.Database); lsConnSelect2.Close(); Lb1.Items.Add("»Ô´ Connection " + lsConnSelect2.Database); lsConnUpdate1.Close(); Lb1.Items.Add("»Ô´ Connection " + lsConnUpdate1.Database); lsGdb.UpdateSendVoucher(lsCounterIP, lsSendDate, lsFlagSendEmailSu); Lb1.Items.Add("Ê觢éÍÁÙÅ àÃÕºÃéÍÂ"); Pb1.Visible = false; BtnRec.Enabled = true; MessageBox.Show("Ê觢éÍÁÙÅ àÃÕºÃéÍÂ", "Ê觢éÍÁÙÅ"); this.Close(); }