private void frmWebBowser_Load(object sender, EventArgs e) { Settings.WaitForCompleteTimeOut = 120000; Settings.AttachToBrowserTimeOut = 120000; webBrowser1.ScriptErrorsSuppressed = false; Settings.AutoStartDialogWatcher = false; ie = new IE(webBrowser1.ActiveXInstance); try { ie.ClearCache(); } catch { } //ie = new IE(); dialogWatcher = new DialogWatcher(new Window(this.Handle)); dialogWatcher.CloseUnhandledDialogs = false; webpage = new WebPage(); lookUpEditPage.Properties.DataSource = WebPage.GetAll(); lookUpEditPage.Properties.DisplayMember = "Page"; lookUpEditPage.Properties.ValueMember = "ID"; if (pageID > 0) { lookUpEditPage.EditValue = long.Parse(pageID.ToString()); } }
public static void Update(WebPage cus) { string sql = @"UPDATE [QLCV_WebPage] SET [Page] = '" + cus.Page + @"' ,[Active] = " + cus.Active + @" ,[Type] = '" + cus.Type + @"' WHERE ID=" + cus.ID; ServerProvider.ExecuteNonQuery(sql); }
public static WebPage Get(long ID) { string sql = @"select * from QLCV_WebPage where ID=" + ID; DataTable dtTable = ServerProvider.ExecuteToDataTable(sql); if (dtTable.Rows.Count > 0) { WebPage cus = new WebPage(); return (WebPage)RootLibrary.GetObjectValue(dtTable.Rows[0], cus); } return null; }
public static long Insert(WebPage cus) { string sql = @"INSERT INTO QLCV_WebPage ([Page] ,[Active] ,[Type]) VALUES (" + cus.Page + @" ," + cus.Active + @" ,'" + cus.Type + @"')"; ServerProvider.ExecuteNonQuery(sql); return long.Parse(ServerProvider.ExecuteScalar("Select @@IDENTITY").ToString()); }
private void btnSave_Click(object sender, EventArgs e) { if (txtUrl.Text == "") { MessageBox.Show("Nhập vào tên trang Web"); return; } if (webpageUp == null) { webpageUp = new WebPage(); webpageUp.Page = txtUrl.Text; webpageUp.Type = NumCode.UPWEB; webpageUp.Active = 1; long ID = WebPage.Insert(webpageUp); txtID.Text = ID.ToString(); foreach (DataRow dtRow in dtSource.Rows) { try { WebStep webStep = new WebStep(); webStep.IDWeb = ID; webStep.Step = long.Parse(dtRow["Step"].ToString()); webStep.Action = dtRow["Action"].ToString(); webStep.Message = dtRow["Message"].ToString(); WebStep.Insert(webStep); } catch (Exception) { } } MessageBox.Show("Đã lưu thành công"); lookUpEditPage_EditValueChanged(null, null); } else { webpageUp.Page = txtUrl.Text; //WebPage.Update(webpageUp); WebStep.DeleteByID(webpageUp.ID); foreach (DataRow dtRow in dtSource.Rows) { try { WebStep webStep = new WebStep(); webStep.IDWeb = webpageUp.ID; webStep.Step = long.Parse(dtRow["Step"].ToString()); webStep.Action = dtRow["Action"].ToString(); webStep.Message = dtRow["Message"].ToString(); WebStep.Insert(webStep); } catch (Exception) { } } MessageBox.Show("Đã lưu thành công"); lookUpEditPage_EditValueChanged(null, null); } }
private void bntNew_Click(object sender, EventArgs e) { txtID.Text = ""; txtUrl.Text = ""; txtAction.Text = ""; txtStep.Text = ""; txtMessage.Text = ""; webpageUp = null; }
private void lookUpEditPage_EditValueChanged(object sender, EventArgs e) { if (lookUpEditPage.EditValue != null) { long ID = long.Parse(lookUpEditPage.EditValue.ToString()); gridControl3.DataSource = WebStep.GetByIDWeb(ID); if (ID > 0) { _LoadDSWebLink(lookUpEditPage.Text); } else { _LoadDSForum(); } webpageUp = WebPage.Get(ID); if (webpageUp != null) { txtUrl.Text = webpageUp.Page; txtID.Text = webpageUp.ID.ToString(); dtSource = WebStep.GetByIDWeb(webpageUp.ID); gridControl2.DataSource = dtSource; } } }
public frmWebPageList() { InitializeComponent(); webPage=new WebPage(); }
public static WebPage GetByPage(string page) { string sql = @"select * from QLCV_WebPage where Page='" + page + "' and Type='"+NumCode.UPWEB+"'"; DataTable dtTable = ServerProvider.ExecuteToDataTable(sql); if (dtTable.Rows.Count > 0) { WebPage cus = new WebPage(); return (WebPage)RootLibrary.GetObjectValue(dtTable.Rows[0], cus); } return null; }