Beispiel #1
0
        public static WebUp Get(long ID)
        {
            Type      type    = typeof(WebUp);
            string    sql     = @"select * from WebUp where ID=" + ID;
            DataTable dtTable = Provider.ExecuteToDataTable(sql);

            if (dtTable.Rows.Count > 0)
            {
                WebUp cus = new WebUp();
                return((WebUp)Common.GetObjectValue(dtTable.Rows[0], type, cus));
            }
            return(null);
        }
Beispiel #2
0
        public static WebUp Get(long ID)
        {
            Type type = typeof(WebUp);
            string sql = @"select * from WebUp where ID=" + ID;
            DataTable dtTable = Provider.ExecuteToDataTable(sql);
            if (dtTable.Rows.Count > 0)
            {
                WebUp cus = new WebUp();
                return (WebUp)Common.GetObjectValue(dtTable.Rows[0], type, cus);

            }
            return null;

        }
Beispiel #3
0
        public static void Update(WebUp cus)
        {
            string sql = @"UPDATE [WebUp]
               SET [Page] = " + cus.Page + @"
                    ,[UrlPost] = '" + cus.UrlPost + @"'
                    ,[Note] = '" + cus.Note + @"'
                     ,[Topic] = '" + cus.Topic + @"'
                    ,[IDTopic] = '" + cus.IDTopic + @"'
                  ,[Group] = " + cus.Group + @"
                  ,[Type] = '" + cus.Type + @"' 
             WHERE ID=" + cus.ID;

            Provider.ExecuteNonQuery(sql);
        }
Beispiel #4
0
        public static void Update(WebUp cus)
        {
            string sql = @"UPDATE [WebUp]
               SET [Page] = " + cus.Page + @"
                    ,[UrlPost] = '" + cus.UrlPost + @"'
                    ,[Note] = '" + cus.Note + @"'
                     ,[Topic] = '" + cus.Topic + @"'
                    ,[IDTopic] = '" + cus.IDTopic + @"'
                  ,[Group] = " + cus.Group + @"
                  ,[Type] = '" + cus.Type + @"' 
             WHERE ID=" + cus.ID;
            Provider.ExecuteNonQuery(sql);


        }
Beispiel #5
0
        public static long Insert(WebUp cus)
        {
            string sql = @"INSERT INTO WebUp
           ([Page]
           ,[UrlPost]
           ,[Topic]
           ,[IDTopic]
           ,[Note]
           ,[Group]
           ,[Type])
         VALUES
           (" + cus.Page + @"
            ,'" + cus.UrlPost + @"'
            ,'" + cus.Topic + @"'
            ,'" + cus.IDTopic + @"'
            ,'" + cus.Note + @"'
             ," + cus.Group + @"
            ,'" + cus.Type + @"')";

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

            string sql = @"INSERT INTO WebUp
           ([Page]
           ,[UrlPost]
           ,[Topic]
           ,[IDTopic]
           ,[Note]
           ,[Group]
           ,[Type])
         VALUES
           (" + cus.Page + @"
            ,'" + cus.UrlPost + @"'
            ,'" + cus.Topic+ @"'
            ,'" + cus.IDTopic + @"'
            ,'" + cus.Note + @"'
             ," + cus.Group + @"
            ,'" + cus.Type + @"')";
            Provider.ExecuteNonQuery(sql);
            return long.Parse(Provider.ExecuteScalar("Select @@IDENTITY").ToString());

        }
Beispiel #7
0
        private WebUp _getFormInfo()
        {
                WebUp temp = null ;

                if (lookUpEditPage.EditValue != null)
                {
                    if (lookUpEdit_Nhom.EditValue != null)
                    {

                        if (txtUrlPost.Text != "")
                        {
                            
                                    temp = new WebUp();

                                    temp.Group = (int) lookUpEdit_Nhom.EditValue;
                                    temp.Page = long.Parse( lookUpEditPage.EditValue.ToString());
                                    temp.Type = _Type;
                                    temp.UrlPost = txtUrlPost.Text;
                                    temp.Note = txtNote.Text;
                                    temp.Topic = txtTopic.Text;
                                    temp.IDTopic = txtIDTopic.Text;
                                
                        }
                        else
                        {
                            MessageBox.Show("Nhập link topic cần post tin", "Lỗi", MessageBoxButtons.OK,
                                            MessageBoxIcon.Error);
                            txtUrlPost.Focus();
                        }


                    }
                    else
                    {
                        MessageBox.Show("Chọn nhóm link", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        lookUpEdit_Nhom.Focus();
                    }
                }
                else
                {
                    MessageBox.Show("Chọn trang Web", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    lookUpEditPage.Focus();
                }


            return temp;
        }
Beispiel #8
0
        private void btnLuu_Click(object sender, EventArgs e)
        {
            WebUp temp = _getFormInfo();
            if (temp != null)
            {
                if (_cus == null) //thêm mới
                {
                        _cus = temp;
                        txtID.Text=WebUp.Insert( _cus).ToString();
                        DialogResult = DialogResult.OK;
                        if (chkCloseAlterSave.Checked)
                        {
                            
                            this.Close();
                            return;
                        }
                        
                        _setFormStatus(-1);
                    
                   

                }
                else //cập nhật
                {

                   
                        temp.ID = _cus.ID;
                        _cus = temp;
                        WebUp.Update(_cus);
                        DialogResult = DialogResult.OK;
                        if (chkCloseAlterSave.Checked)
                        {

                            this.Close();
                            return;
                        }
                        _setFormStatus(-1);

                }
            }
           
        }
Beispiel #9
0
        private void _ClearForm()
        {
            txtID.Text = "";
            lookUpEdit_Nhom.EditValue = null;
            lookUpEditPage.EditValue = null;
            txtUsername.Text = "";
            txtUrlPost.Text = "";
            txtPassword.Text = "";
            txtNote.Text = "";
            txtTopic.Text = "";
            txtIDTopic.Text = "";
            _cus = null;

            lookUpEditPage.Focus();
            
        }