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


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

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

        }
예제 #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 { }
 }
예제 #9
0
 public frmWebReg(string _type)
 {
     InitializeComponent();
     _webReg = null;
     _Type = _type;
 }
예제 #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;
        }