Example #1
0
 private void _ClearForm()
 {
     txtMa.Enabled = true;
     txtMa.Text = "";
     txtTen.Text = "";
     txtGhiChu.Text = "";
     txtMa.Text = "";
     txtUsername.Text = "";
     txtPassword.Text = "";
     lookUpEditPage.EditValue = null;
     _webReg = null;
 }
Example #2
0
        public static void Update(WebReg cus)
        {
            string sql = @"UPDATE [WebReg]
               SET [Page] = '" + cus.Page + @"'
                  ,[UserName] = '" + cus.UserName + @"'
                  ,[Password] = '" + cus.Password + @"'
                 ,[Note] = '" + cus.Note + @"'
                  ,[Type] = '" + cus.Type + @"' 
             WHERE ID=" + cus.ID;

            Provider.ExecuteNonQuery(sql);
        }
Example #3
0
        public static void Update(WebReg cus)
        {
            string sql = @"UPDATE [WebReg]
               SET [Page] = '" + cus.Page + @"'
                  ,[UserName] = '" + cus.UserName + @"'
                  ,[Password] = '" + cus.Password + @"'
                 ,[Note] = '" + cus.Note + @"'
                  ,[Type] = '" + cus.Type + @"' 
             WHERE ID=" + cus.ID;
            Provider.ExecuteNonQuery(sql);


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

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

            }
            return null;

        }
Example #6
0
        public static long Insert(WebReg cus)
        {
            string sql = @"INSERT INTO WebReg
           ([Page]
           ,[UserName]
           ,[Password]
            ,[Note]
           ,[Type])
         VALUES
           ('" + cus.Page + @"'
           ,'" + cus.UserName + @"'
           ,'" + cus.Password + @"'
              ,'" + cus.Note + @"'
            ,'" + cus.Type + @"')";

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

            string sql = @"INSERT INTO WebReg
           ([Page]
           ,[UserName]
           ,[Password]
            ,[Note]
           ,[Type])
         VALUES
           ('" + cus.Page + @"'
           ,'" + cus.UserName + @"'
           ,'" + cus.Password + @"'
              ,'" + cus.Note + @"'
            ,'" + cus.Type + @"')";
            Provider.ExecuteNonQuery(sql);
            return long.Parse(Provider.ExecuteScalar("Select @@IDENTITY").ToString());

        }
Example #8
0
 private void gridView1_Click(object sender, EventArgs e)
 {
     try
     {
         int k = gridView1.SelectedRowsCount;
         if (k > 0)
         {
             int RowHandle = gridView1.FocusedRowHandle;
             if (RowHandle >= 0)
             {
                 _webReg = new WebReg();
                 _webReg.ID = int.Parse(gridView1.GetRowCellValue(RowHandle, colID).ToString());
                 _webReg.Page = gridView1.GetRowCellValue(RowHandle, colPge).ToString();
                 _webReg.UserName = gridView1.GetRowCellValue(RowHandle, colUser).ToString();
                 _webReg.Password = gridView1.GetRowCellValue(RowHandle, colPass).ToString();
                 _webReg.Note = gridView1.GetRowCellValue(RowHandle, colGhiChu).ToString();
                 _SetFormInfo();
                 _setFormStatus("NORMAL");
             }
         }
     }
     catch { }
 }
Example #9
0
 public frmWebReg(string _type)
 {
     InitializeComponent();
     _webReg = null;
     _Type = _type;
 }
Example #10
0
        private WebReg _getFormInfo()
        {
            WebReg nhom = null;

            if (txtTen.Text != "" || lookUpEditPage.EditValue!=null)
                {
                    nhom = new WebReg();
                    //nhom.Ma = int.Parse(txtMa.Text);
                    if (_Type == NumCode.WEB)
                    {
                        nhom.Page = lookUpEditPage.EditValue.ToString();
                    }
                    else
                    {
                        nhom.Page = txtTen.Text;
                    }
                    nhom.Note = txtGhiChu.Text;
                    nhom.UserName = txtUsername.Text;
                    nhom.Password = txtPassword.Text;
                    nhom.Type = _Type;
                }
                else
                {
                    MessageBox.Show("Nhập vào địa chỉ trang web");
                    txtTen.Focus();

                }
            
            return nhom;
        }