2015年8月19日 星期三

C# webForm 確定刪除 confirm!!

在 LinkButton的 onclientclick 加入  return confirm('確定刪除盤點單?');


<asp:LinkButton ID="removeButton" runat="server"  onclick="removeButton_Click"
                        onclientclick="return confirm('確定刪除盤點單?');" >刪除盤點單</asp:LinkButton>

C# winForm 確定刪除~確認視窗

private void delButton_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("確定刪除?", "提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                string sql;
                string cN;
                cN = Convert.ToString(DGV.CurrentRow.Cells[0].Value);

                sql = string.Format("delete from record where cardno='{0}' ",cN);
                dbCom.myselect(sql);

            }
        }

新增空的DataTable..並填入數據

static DataTable dt()
        {
            DataTable dt = new DataTable();

            //新增資料欄位;
            dt.Columns.Add("ID", typeof(String));
            dt.Columns.Add("Name", typeof(String));
            dt.Columns.Add("item", typeof(String));
            dt.Columns.Add("website", typeof(String));

            //加入資料;
            dt.Rows.Add(new object[] { "1001 ", " Ivan", "奇摩網頁", "http://tw.yahoo.com/" });
            dt.Rows.Add(new object[] { "1002 ", " Tony", "谷歌網頁", "http://www.google.com/" });
            dt.Rows.Add(new object[] { "1003 ", " Hunter", "中華電信", "http://www.hinet.net/" });

            //輸出DataTable;
            return dt;
        }

2015年8月11日 星期二

刪除相同字串

data.Text="2015-06-08";

string st;
st=data.Text.Replace( "-", "");
///st=20150608



標籤機


SIZE 32 mm,25 mm
GAP 3 mm,0
CLS
TEXT 15,0,"TST24.BF2",0,1,1,"單號:005"
TEXT 15,25,"TST24.BF2",0,1,1,"====================="
TEXT 15,75,"TST24.BF2",0,1,1,"薑汁汽水"
TEXT 15,100,"TST24.BF2",0,1,2,"薑汁汽水"
PRINT 1,1

2015年8月10日 星期一

C# 發送EMail

void sendMail(string failDate)
        {
            MailMessage mail = new MailMessage();
            NetworkCredential cred = new NetworkCredential("service@gmail.com", "密碼");
            //收件者

            mail.To.Add("is@gmail.com");
            //("is@gmail.com,shirley@gmail.com");//多收件人員
            //郵件主旨
            mail.Subject = "蜜糖cafe類別轉檔失敗_通知郵件[ " + failDate +" ]";
            //寄件者
            mail.From = new System.Net.Mail.MailAddress("service@gmail.com");
            mail.IsBodyHtml = true;
            //郵件內容
            mail.Body = "轉檔失敗日期 : " + failDate;
            //Attachment attachment = new Attachment(@"C:\檔案.txt");//夾帶附件

            //設定SMTP
            SmtpClient smtp = new SmtpClient("smtp.gmail.com");
            smtp.UseDefaultCredentials = false;
            smtp.EnableSsl = true;
            smtp.Credentials = cred;
            smtp.Port = 587;
            //送出Mail
            smtp.Send(mail);
        }

Brown Cafe MySQL

select * from base_machine where name like '%宜蘭大學%'
//*
select  * from ord_order_info
where machine_id=74 and accountDate='2015-07-31' and no >='1507310740311' order by no

//*


select * from ord_invoice where header_id in(
select  id from ord_order_info where machine_id=74 and accountDate='2015-07-31' and no >='1507310740311' order by no)


//*

select o.no,i.number,i.* from ord_order_info o,ord_invoice i where o.id=i.header_id AND
o.machine_id=74 and o.accountDate='2015-07-31' and o.no >='1507310740311'
order by o.no

///
select o.no,o.total,i.number,i.money,i.* from ord_order_info o,ord_invoice i where o.id=i.header_id AND
o.machine_id=56 and o.accountDate='2015-07-31'
order by o.no

///

select * from ord_order_info where no>='1507310340318' and no <='1507310340321'
select * from ord_invoice where number>='RH51031662' and number<='RH51031669'


update ord_invoice set money=324 where number='RH51474622'

update ord_invoice set number='RH51474635' where number='RH51474638' and money=108

delete from ord_invoice where number='RH51477609' and money=460
///
///
///select delete_order_by_id(67215);


///
#update ord_invoice set coupled=2,drawer=100500,establish=1,money=0,number='RH51142432',printedNumber='家福桂林店A機'
#,state=1,header_id=100671 where id=111955