public void tblHtmlMailRule_insert(HtmlMailRuleDTO dt) { string sql = "INSERT INTO tblHtmlMailRule VALUES(@Attribute, @Outlookcom, @YahooMail, @Gmail, @AOLMail, "+ "@Outlook071013, @OutlookExpress, @WindowsLiveMail2011, @Notes67, @LotusNotes85, "+ "@AOLDesktop10, @AppleMail65, @Postbox, @Thunderbird17, @iPhoneiOS7iPad, "+ "@Blackberry6, @Android4, @GmailMobile, @WindowsMobile75)"; cmd = new SqlCommand(sql, ConnectionData._MyConnection); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@Attribute", SqlDbType.VarChar).Value = dt.Attribute; cmd.Parameters.Add("@Outlookcom", SqlDbType.Bit).Value = dt.Outlookcom; cmd.Parameters.Add("@YahooMail", SqlDbType.Bit).Value = dt.YahooMail; cmd.Parameters.Add("@Gmail", SqlDbType.Bit).Value = dt.Gmail; cmd.Parameters.Add("@AOLMail", SqlDbType.Bit).Value = dt.AOLMail; cmd.Parameters.Add("@Outlook071013", SqlDbType.Bit).Value = dt.Outlook071013; cmd.Parameters.Add("@OutlookExpress", SqlDbType.Bit).Value = dt.OutlookExpress; cmd.Parameters.Add("@WindowsLiveMail2011", SqlDbType.Bit).Value = dt.WindowsLiveMail2011; cmd.Parameters.Add("@Notes67", SqlDbType.Bit).Value = dt.Notes67; cmd.Parameters.Add("@LotusNotes85", SqlDbType.Bit).Value = dt.LotusNotes85; cmd.Parameters.Add("@AOLDesktop10", SqlDbType.Bit).Value = dt.AOLDesktop10; cmd.Parameters.Add("@AppleMail65", SqlDbType.Bit).Value = dt.AppleMail65; cmd.Parameters.Add("@Postbox", SqlDbType.Bit).Value = dt.Postbox; cmd.Parameters.Add("@Thunderbird17", SqlDbType.Bit).Value = dt.Thunderbird17; cmd.Parameters.Add("@iPhoneiOS7iPad", SqlDbType.Bit).Value = dt.iPhoneiOS7iPad; cmd.Parameters.Add("@Blackberry6", SqlDbType.Bit).Value = dt.Blackberry6; cmd.Parameters.Add("@Android4", SqlDbType.Bit).Value = dt.Android4; cmd.Parameters.Add("@GmailMobile", SqlDbType.Bit).Value = dt.GmailMobile; cmd.Parameters.Add("@WindowsMobile75", SqlDbType.Bit).Value = dt.WindowsMobile75; if (ConnectionData._MyConnection.State == ConnectionState.Closed) { ConnectionData._MyConnection.Open(); } cmd.ExecuteNonQuery(); cmd.Dispose(); }
public void tblHtmlMailRule_Update(HtmlMailRuleDTO dt) { hmrDAO.tblHtmlMailRule_Update(dt); }
public void tblHtmlMailRule_insert(HtmlMailRuleDTO dt) { hmrDAO.tblHtmlMailRule_insert(dt); }
protected void btnSave_Click(object sender, EventArgs e) { try { if (this.txtAttr.Text == "") { pnError.Visible = true; pnSuccess.Visible = false; lblError.Text = "Bạn chưa nhập thuộc tính HTML "; } else { mailRuleBUS = new HtmlMailRuleBUS(); HtmlMailRuleDTO htmlDTO = new HtmlMailRuleDTO(); htmlDTO.Attribute = txtAttr.Text; htmlDTO.Gmail = chkGmail.Checked; htmlDTO.YahooMail= chkYahoo.Checked; htmlDTO.Outlook071013 = chkOutLook.Checked; htmlDTO.WindowsLiveMail2011 = chkHotMail.Checked; htmlDTO.AOLMail = chkAOL.Checked; htmlDTO.Android4 = false; htmlDTO.AOLDesktop10 = false; htmlDTO.AppleMail65 = false; htmlDTO.Blackberry6 = false; htmlDTO.GmailMobile = false; htmlDTO.iPhoneiOS7iPad = true; htmlDTO.LotusNotes85 = true; htmlDTO.Notes67 = true; htmlDTO.Outlookcom = true; htmlDTO.OutlookExpress = false; htmlDTO.Postbox = true; htmlDTO.Thunderbird17 = true; htmlDTO.WindowsMobile75 = true; int i=0; if (mailRuleBUS.GetByID(txtAttr.Text).Rows.Count > 0) { mailRuleBUS.tblHtmlMailRule_Update(htmlDTO); i = 1; } else { mailRuleBUS.tblHtmlMailRule_insert(htmlDTO); } pnSuccess.Visible = true; pnError.Visible = false; if (i != 1) { lblSuccess.Text = "Bạn đã thêm thành công một thuộc tính html"; } else { lblSuccess.Text = "Bạn đã cập nhật thành công một thuộc tính html"; } this.txtAttr.Text = ""; } LoadData(); } catch (Exception) { pnError.Visible = true; lblError.Text = "Lỗi trong quá trình cập nhật"; pnSuccess.Visible = false; } }
public void tblHtmlMailRule_Update(HtmlMailRuleDTO dt) { string sql = "UPDATE tblHtmlMailRule SET "+ "Outlookcom = @Outlookcom, "+ "YahooMail = @YahooMail, "+ "Gmail = @Gmail, "+ "AOLMail = @AOLMail, "+ "Outlook071013 = @Outlook071013, "+ "OutlookExpress = @OutlookExpress, "+ "WindowsLiveMail2011 = @WindowsLiveMail2011, "+ "Notes67 = @Notes67, "+ "LotusNotes85 = @LotusNotes85, "+ "AOLDesktop10 = @AOLDesktop10, "+ "AppleMail65 = @AppleMail65, "+ "Postbox = @Postbox, "+ "Thunderbird17 = @Thunderbird17, "+ "iPhoneiOS7iPad = @iPhoneiOS7iPad, "+ "Blackberry6 = @Blackberry6, "+ "Android4 = @Android4, "+ "GmailMobile = @GmailMobile, "+ "WindowsMobile75 = @WindowsMobile75 WHERE Attribute = @Attribute "; cmd = new SqlCommand(sql, ConnectionData._MyConnection); cmd.CommandType = CommandType.Text; cmd.Parameters.Add("@Attribute", SqlDbType.VarChar).Value = dt.Attribute; cmd.Parameters.Add("@Outlookcom", SqlDbType.Bit).Value = dt.Outlookcom; cmd.Parameters.Add("@YahooMail", SqlDbType.Bit).Value = dt.YahooMail; cmd.Parameters.Add("@Gmail", SqlDbType.Bit).Value = dt.Gmail; cmd.Parameters.Add("@AOLMail", SqlDbType.Bit).Value = dt.AOLMail; cmd.Parameters.Add("@Outlook071013", SqlDbType.Bit).Value = dt.Outlook071013; cmd.Parameters.Add("@OutlookExpress", SqlDbType.Bit).Value = dt.OutlookExpress; cmd.Parameters.Add("@WindowsLiveMail2011", SqlDbType.Bit).Value = dt.WindowsLiveMail2011; cmd.Parameters.Add("@Notes67", SqlDbType.Bit).Value = dt.Notes67; cmd.Parameters.Add("@LotusNotes85", SqlDbType.Bit).Value = dt.LotusNotes85; cmd.Parameters.Add("@AOLDesktop10", SqlDbType.Bit).Value = dt.AOLDesktop10; cmd.Parameters.Add("@AppleMail65", SqlDbType.Bit).Value = dt.AppleMail65; cmd.Parameters.Add("@Postbox", SqlDbType.Bit).Value = dt.Postbox; cmd.Parameters.Add("@Thunderbird17", SqlDbType.Bit).Value = dt.Thunderbird17; cmd.Parameters.Add("@iPhoneiOS7iPad", SqlDbType.Bit).Value = dt.iPhoneiOS7iPad; cmd.Parameters.Add("@Blackberry6", SqlDbType.Bit).Value = dt.Blackberry6; cmd.Parameters.Add("@Android4", SqlDbType.Bit).Value = dt.Android4; cmd.Parameters.Add("@GmailMobile", SqlDbType.Bit).Value = dt.GmailMobile; cmd.Parameters.Add("@WindowsMobile75", SqlDbType.Bit).Value = dt.WindowsMobile75; if (ConnectionData._MyConnection.State == ConnectionState.Closed) { ConnectionData._MyConnection.Open(); } cmd.ExecuteNonQuery(); cmd.Dispose(); }