public static long Insert(CustomersType cus)
        {
            string sql = "insert into [CustomersType]([Name],[Note]) values('" + cus.Name + "','" + cus.Note + "')";

            Provider.ExecuteNonQuery(sql);
            return(long.Parse(Provider.ExecuteScalar("Select @@IDENTITY").ToString()));
        }
Exemple #2
0
        public static long Insert(CustomersType cus)
        {
            string sql = "insert into [CustomersType]([Name],[Note]) values('" + cus.Name + "','" + cus.Note + "')";
            Provider.ExecuteNonQuery(sql);
            return long.Parse(Provider.ExecuteScalar("Select @@IDENTITY").ToString());


        }
 private void _ClearForm()
 {
     txtMa.Enabled = true;
     txtMa.Text = "";
     txtTen.Text = "";
     txtGhiChu.Text = "";
     txtMa.Text = "";
     _cusType = null;
 }
Exemple #4
0
 public static CustomersType GetObject(DataRow dtRow)
 {
     CustomersType cus = new CustomersType();
     if (dtRow["Code"] != null && dtRow["Code"].ToString() != "")
         cus.Code = long.Parse(dtRow["Code"].ToString());
     if (dtRow["Name"] != null && dtRow["Name"].ToString() != "")
         cus.Name = dtRow["Name"].ToString();
      if (dtRow["Note"] != null && dtRow["Note"].ToString() != "")
         cus.Note = (dtRow["Note"].ToString());
     return cus;
 }
        public static CustomersType GetObject(DataRow dtRow)
        {
            CustomersType cus = new CustomersType();

            if (dtRow["Code"] != null && dtRow["Code"].ToString() != "")
            {
                cus.Code = long.Parse(dtRow["Code"].ToString());
            }
            if (dtRow["Name"] != null && dtRow["Name"].ToString() != "")
            {
                cus.Name = dtRow["Name"].ToString();
            }
            if (dtRow["Note"] != null && dtRow["Note"].ToString() != "")
            {
                cus.Note = (dtRow["Note"].ToString());
            }
            return(cus);
        }
Exemple #6
0
 public static void Update(CustomersType cus)
 {
     string sql = "Update [CustomersType] set [Name]='" + cus.Name + "',[Note]='" + cus.Note + "' where [Code]=" + cus.Code + "";
     Provider.ExecuteNonQuery(sql);
 }
        public static void Update(CustomersType cus)
        {
            string sql = "Update [CustomersType] set [Name]='" + cus.Name + "',[Note]='" + cus.Note + "' where [Code]=" + cus.Code + "";

            Provider.ExecuteNonQuery(sql);
        }
        private CustomersType _getFormInfo()
        {
            CustomersType nhom = null;
           
                if (txtTen.Text != "")
                {
                    nhom = new CustomersType();
                    //nhom.Ma = int.Parse(txtMa.Text);
                    nhom.Name = txtTen.Text;
                    nhom.Note = txtGhiChu.Text;
                }
                else
                {
                    MessageBox.Show("Nhập vào tên loại khách hàng");
                    txtTen.Focus();

                }
            
            return nhom;
        }
 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 CustomersType();
                 _cusType.Code = 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{}
 }
Exemple #10
0
 public frmCustomerType()
 {
     InitializeComponent();
     _cusType = null;
 }