예제 #1
0
        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());
            }
        }
예제 #2
0
        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);


        }
예제 #3
0
        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;

        }
예제 #4
0
        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());

        }
예제 #5
0
        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);
               
            }
        }
예제 #6
0
 private void bntNew_Click(object sender, EventArgs e)
 {
     txtID.Text = "";
     txtUrl.Text = "";
     txtAction.Text = "";
     txtStep.Text = "";
     txtMessage.Text = "";
     webpageUp = null;
 }
예제 #7
0
 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;
         }
     }
 }
예제 #8
0
 public frmWebPageList()
 {
     InitializeComponent();
     webPage=new WebPage();
 }
예제 #9
0
        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;
        }