Ejemplo n.º 1
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);
     }
 }
Ejemplo n.º 2
0
 private void frmCreateStep_Load(object sender, EventArgs e)
 {
     if (webPage != null)
     {
         txtUrl.Text             = webPage.Page;
         txtID.Text              = webPage.ID.ToString();
         dtSource                = WebStep.GetByIDWeb(webPage.ID);
         gridControl2.DataSource = dtSource;
     }
 }
Ejemplo n.º 3
0
        private void Auto()
        {
            DataTable dtTable1 = WebStep.GetByIDWeb(long.Parse(lookUpEditPage.EditValue.ToString()));
            int       i        = 0;

            while (i < dtTable1.Rows.Count)
            {
                DataRow dtRow       = dtTable1.Rows[i];
                string  processStep = dtRow["Action"].ToString();
                if (processStep.IndexOf("Exists") < 0)
                {
                    processStep = processStep.Replace("{UserName}", forum.UserName);
                    processStep = processStep.Replace("{Password}", forum.Password);
                    processStep = processStep.Replace("{Url}", forum.UrlPost);
                    processStep = processStep.Replace("{IDTopic}", forum.IDTopic);
                    processStep = processStep.Replace("{Content}", "Up phụ nè");
                    string s = MyCore.ProcessStep(processStep, ie);
                    if (s != String.Empty)
                    {
                        if (dtRow["Message"] != null && dtRow["Message"].ToString().Trim() != "")
                        {
                            MessageBox.Show(dtRow["Message"].ToString());
                            return;
                        }
                    }
                    i++;
                }
                else
                {
                    try
                    {
                        string[] a           = processStep.Split('(');
                        string   processType = a[0].Trim();
                        string   processText = a[1].Trim(')');
                        string[] b           = processText.Split('|');
                        string   text        = b[0].Trim();
                        int      stepYes     = int.Parse(b[1]);
                        int      stepNo      = int.Parse(b[2]);
                        if (MyCore.Exist(text, ie))
                        {
                            i = stepYes - 1;
                        }
                        else
                        {
                            i = stepNo - 1;
                        }
                    }
                    catch
                    {
                        i++;
                    }
                }
            }
            MessageBox.Show("Hoàn thành");
        }
Ejemplo n.º 4
0
 private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         if (gridView1.FocusedRowHandle >= 0)
         {
             long ID = long.Parse(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, colID).ToString());
             gridControl2.DataSource = WebStep.GetByIDWeb(ID);
         }
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 5
0
 private void btnXoa_Click(object sender, EventArgs e)
 {
     try
     {
         int k = gridView1.SelectedRowsCount;
         if (k > 0)
         {
             if (MessageBox.Show("Bạn muốn xóa WebPage này?", "Thông tin", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
             {
                 int[] arrSelect = gridView1.GetSelectedRows();
                 for (int i = 0; i < k; i++)
                 {
                     long MaDT = long.Parse(gridView1.GetRowCellValue(arrSelect[i], colID).ToString());
                     WebPage.Delete(MaDT);
                     WebStep.DeleteByID(MaDT);
                     MessageBox.Show("Đã xóa thành công");
                 }
             }
         }
     }
     catch { }
 }
Ejemplo n.º 6
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;
         }
     }
 }
Ejemplo n.º 7
0
 public TimedProxyWebStep(WebStep webStep = null, WebValidator validator = null)
     : base()
 {
     Step = webStep;
     this.Validator = validator;
 }
Ejemplo n.º 8
0
 public SimpleWebAction(WebStep step = null, WebValidator validator = null, WebValidator canDoValidator = null, WebValidator shouldWaitValidator = null, bool waitForEvent = false)
     : base(waitForEvent, validator, canDoValidator, shouldWaitValidator)
 {
     Step = step;
 }
Ejemplo n.º 9
0
 public TimedProxyWebStep(WebStep webStep = null, WebValidator validator = null)
     : base()
 {
     Step           = webStep;
     this.Validator = validator;
 }