예제 #1
0
 public frmTypeSetup(string group,string caption)
 {
     InitializeComponent();
     _cusType = null;
     _group = group;
     _caption = caption;
 }
예제 #2
0
        public static long Insert(CodeType cus)
        {
            string sql = "insert into [CodeType]([Code],[Name],[Field1],[Field2],[Note],[Group]) values('" + cus.Code + "','" + cus.Name + "','" + cus.Field1 + "','" + cus.Field2 + "','" + cus.Note + "','" + cus.Group + "')";
            Provider.ExecuteNonQuery(sql);
            return long.Parse(Provider.ExecuteScalar("Select @@IDENTITY").ToString());


        }
예제 #3
0
 private void _ClearForm()
 {
     txtMa.Enabled = true;
     txtMa.Text = "";
     txtTen.Text = "";
     txtGhiChu.Text = "";
     txtMa.Text = "";
     _cusType = null;
 }
예제 #4
0
        public static void Update(CodeType cus)
        {
            string sql = @"UPDATE [CodeType]
               SET [Code] = '" + cus.Code + @"'
                  ,[Name] = '" + cus.Name + @"'
                  ,[Field1] = '" + cus.Field1 + @"'
                  ,[Field2] = '" + cus.Field2 + @"' 
                  ,[Note] = '" + cus.Note + @"' 
                  ,[Group] = '" + cus.Group + @"' 
             WHERE ID=" + cus.ID;
            Provider.ExecuteNonQuery(sql);


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

            }
          
            return null;

        }
예제 #6
0
 private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
 {
     try
     {
         int k = gridView1.SelectedRowsCount;
         if (k > 0)
         {
             int RowHandle = gridView1.FocusedRowHandle;
             if (RowHandle >= 0)
             {
                 _cusType = new CodeType();
                 _cusType.ID = int.Parse(gridView1.GetRowCellValue(RowHandle, colMa).ToString());
                 _cusType.Name = gridView1.GetRowCellValue(RowHandle, colTen).ToString();
                 _cusType.Note = gridView1.GetRowCellValue(RowHandle, colGhiChu).ToString();
                 _SetFormInfo();
                 _setFormStatus("NORMAL");
             }
         }
     }
     catch{}
 }
예제 #7
0
        private CodeType _getFormInfo()
        {
            CodeType nhom = null;
           
                if (txtTen.Text != "")
                {
                    nhom = new CodeType();
                    //nhom.Ma = int.Parse(txtMa.Text);
                    nhom.Name = txtTen.Text;
                    nhom.Note = txtGhiChu.Text;
                    nhom.Group = _group;
                }
                else
                {
                    MessageBox.Show("Nhập vào tên thiết lập");
                    txtTen.Focus();

                }
            
            return nhom;
        }