Beispiel #1
0
        public static void Update(WebStep cus)
        {
            string sql = @"UPDATE [QLCV_WebStep]
               SET [IDWeb] = " + cus.IDWeb + @"
                  ,[Step] = " + cus.Step + @"
                     ,[Action] = N'" + cus.Action + @"'
                  ,[Message] = N'" + cus.Message + @"' 
             WHERE IDWeb=" + cus.IDWeb + " and Step=" + cus.Step;

            ServerProvider.ExecuteNonQuery(sql);
        }
Beispiel #2
0
        public static void Update(WebStep cus)
        {
            string sql = @"UPDATE [QLCV_WebStep]
               SET [IDWeb] = " + cus.IDWeb + @"
                  ,[Step] = " + cus.Step + @"
                     ,[Action] = N'" + cus.Action + @"'
                  ,[Message] = N'" + cus.Message + @"' 
             WHERE IDWeb=" + cus.IDWeb+" and Step="+cus.Step;
            ServerProvider.ExecuteNonQuery(sql);


        }
Beispiel #3
0
        public static WebStep Get(long ID)
        {
            string    sql     = @"select * from QLCV_WebStep where ID=" + ID;
            DataTable dtTable = ServerProvider.ExecuteToDataTable(sql);

            if (dtTable.Rows.Count > 0)
            {
                WebStep cus = new WebStep();
                return((WebStep)RootLibrary.GetObjectValue(dtTable.Rows[0], cus));
            }
            return(null);
        }
Beispiel #4
0
        public static WebStep Get(long ID)
        {
            string sql = @"select * from QLCV_WebStep where ID=" + ID;
            DataTable dtTable = ServerProvider.ExecuteToDataTable(sql);
            if (dtTable.Rows.Count > 0)
            {
                WebStep cus = new WebStep();
                return (WebStep)RootLibrary.GetObjectValue(dtTable.Rows[0], cus);

            }
            return null;

        }
Beispiel #5
0
        public static long Insert(WebStep cus)
        {
            string sql = @"INSERT INTO QLCV_WebStep
           ([IDWeb]
           ,[Step]
            ,[Action]
           ,[Message])
         VALUES
           (" + cus.IDWeb + @"
             ," + cus.Step + @"
            ,N'" + cus.Action + @"'
            ,N'" + cus.Message + @"')";

            ServerProvider.ExecuteNonQuery(sql);
            return(1);
            //return long.Parse(ServerProvider.ExecuteScalar("Select @@IDENTITY").ToString());
        }
Beispiel #6
0
        public static long Insert(WebStep cus)
        {

            string sql = @"INSERT INTO QLCV_WebStep
           ([IDWeb]
           ,[Step]
            ,[Action]
           ,[Message])
         VALUES
           (" + cus.IDWeb + @"
             ," + cus.Step + @"
            ,N'" + cus.Action + @"'
            ,N'" + cus.Message + @"')";
            ServerProvider.ExecuteNonQuery(sql);
            return 1;
            //return long.Parse(ServerProvider.ExecuteScalar("Select @@IDENTITY").ToString());

        }
Beispiel #7
0
        public StatusObj UpTopicWeb()
        {
            StatusObj statusObj = new StatusObj();

            if (forum == null)
            {
                statusObj.Message = "Object null";
                statusObj.Status  = "Error";
                return(statusObj);
            }
            if (string.IsNullOrEmpty(forum.UrlPost))
            {
                statusObj.Message = "Không có link up bài";
                statusObj.Status  = "Error";
                return(statusObj);
            }
            try
            {
                // Start WatiN
                WebPage wp = WebPage.GetByPage(forum.Url.Trim().ToLower());
                if (wp == null)
                {
                    statusObj.Message = "Trang Web này chưa được đăng ký";
                    statusObj.Status  = "Error";
                    return(statusObj);
                }
                IDWeb = wp.ID;
                DataTable dtTable1 = WebStep.GetByIDWeb(wp.ID);
                if (dtTable1 == null)
                {
                    statusObj.Message = "Chưa đăng ký sử dụng phần mềm";
                    statusObj.Status  = "Register";
                    return(statusObj);
                }
                if (Open() == false)
                {
                    statusObj.Message = "Không mở được trình duyệt";
                    statusObj.Status  = "Error";
                    return(statusObj);
                }

                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);
                        string s = MyCore.ProcessStep(processStep, ie);
                        if (s != String.Empty)
                        {
                            if (dtRow["Message"] != null && dtRow["Message"].ToString().Trim() != "")
                            {
                                Close();
                                statusObj.Message = dtRow["Message"].ToString();
                                statusObj.Status  = s;
                                return(statusObj);
                            }
                        }
                        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++;
                        }
                    }
                }

                statusObj.Message = "Successful";
                statusObj.Status  = "Successful";
                statusObj.Value   = ie.Url;

                Close();
                return(statusObj);
            }

            catch (Exception ex)
            {
                if (ie != null)
                {
                    Close();

                    statusObj.Message = "Lỗi hệ thống ";
                    statusObj.Status  = "Error";
                    return(statusObj);
                }
            }
            return(statusObj);
        }
Beispiel #8
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);
               
            }
        }