예제 #1
0
        public int Update(CongtyVO congtyVO)
        {
            try
            {
                String         query         = "UPDATE CONG_TY SET MA_QUOC_GIA=@MA_QUOC_GIA,MA_NGUOI_DAI_DIEN=@MA_NGUOI_DAI_DIEN,TEN_CONG_TY=@TEN_CONG_TY,DIA_CHI=@DIA_CHI,DIEN_THOAI=@DIEN_THOAI,EMAIL=@EMAIL,FAX=@FAX,SO_TAI_KHOAN=@SO_TAI_KHOAN,MA_SO_THUE=@MA_SO_THUE WHERE MA_CONG_TY=@MA_CONG_TY";
                SqlParameter[] sqlParameters = new SqlParameter[10];
                sqlParameters[0] = new SqlParameter("@MA_CONG_TY", congtyVO.MA_CONG_TY);
                sqlParameters[1] = new SqlParameter("@MA_QUOC_GIA", congtyVO.MA_QUOC_GIA);
                sqlParameters[2] = new SqlParameter("@MA_NGUOI_DAI_DIEN", congtyVO.MA_NGUOI_DAI_DIEN);
                sqlParameters[3] = new SqlParameter("@TEN_CONG_TY", congtyVO.TEN_CONG_TY);
                sqlParameters[4] = new SqlParameter("@DIA_CHI", congtyVO.DIA_CHI);
                sqlParameters[5] = new SqlParameter("@DIEN_THOAI", congtyVO.DIEN_THOAI);
                sqlParameters[6] = new SqlParameter("@EMAIL", congtyVO.EMAIL);
                sqlParameters[7] = new SqlParameter("@FAX", congtyVO.FAX);
                sqlParameters[8] = new SqlParameter("@SO_TAI_KHOAN", congtyVO.SO_TAI_KHOAN);
                sqlParameters[9] = new SqlParameter("@MA_SO_THUE", congtyVO.MA_SO_THUE);


                return(Program.dbConnection.ExecuteNonQuery(query, sqlParameters));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #2
0
        public int Insert(CongtyVO congtyVO)
        {
            try
            {
                String         query         = "INSERT INTO CONG_TY VALUES(@MA_QUOC_GIA,@MA_NGUOI_DAI_DIEN,@TEN_CONG_TY,@DIA_CHI,@DIEN_THOAI,@EMAIL,@FAX,@SO_TAI_KHOAN,@MA_SO_THUE,@HIEU_LUC)";
                SqlParameter[] sqlParameters = new SqlParameter[10];

                sqlParameters[0] = new SqlParameter("@MA_QUOC_GIA", congtyVO.MA_QUOC_GIA);
                sqlParameters[1] = new SqlParameter("@MA_NGUOI_DAI_DIEN", congtyVO.MA_NGUOI_DAI_DIEN);
                sqlParameters[2] = new SqlParameter("@TEN_CONG_TY", congtyVO.TEN_CONG_TY);
                sqlParameters[3] = new SqlParameter("@DIA_CHI", congtyVO.DIA_CHI);
                sqlParameters[4] = new SqlParameter("@DIEN_THOAI", congtyVO.DIEN_THOAI);
                sqlParameters[5] = new SqlParameter("@EMAIL", congtyVO.EMAIL);
                sqlParameters[6] = new SqlParameter("@FAX", congtyVO.FAX);
                sqlParameters[7] = new SqlParameter("@SO_TAI_KHOAN", congtyVO.SO_TAI_KHOAN);
                sqlParameters[8] = new SqlParameter("@MA_SO_THUE", congtyVO.MA_SO_THUE);
                sqlParameters[9] = new SqlParameter("@HIEU_LUC", congtyVO.HIEU_LUC);

                return(Program.dbConnection.ExecuteNonQuery(query, sqlParameters));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
예제 #3
0
 public int Update(CongtyVO congtyVO)
 {
     try
     {
         return(congtyDAO.Update(congtyVO));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
예제 #4
0
 public int Insert(CongtyVO congtyVO)
 {
     try
     {
         return(congtyDAO.Insert(congtyVO));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
예제 #5
0
        private CongtyVO GetCongtyVO()
        {
            CongtyVO congtyVO = new CongtyVO();

            congtyVO.MA_CONG_TY        = int.Parse(txt_MaCongty.Text.Substring(2));
            congtyVO.MA_QUOC_GIA       = int.Parse(cbo_QuocGia.SelectedValue.ToString());
            congtyVO.MA_NGUOI_DAI_DIEN = int.Parse(cbo_MaNguoiDaiDien.SelectedValue.ToString().Substring(2));

            congtyVO.TEN_CONG_TY  = txt_TenCongTy.Text;
            congtyVO.DIA_CHI      = txt_DiaChi.Text;
            congtyVO.DIEN_THOAI   = txt_DienThoai.Text;
            congtyVO.EMAIL        = txt_Email.Text;
            congtyVO.FAX          = txt_Fax.Text;
            congtyVO.SO_TAI_KHOAN = txt_SoTaiKhoan.Text;
            congtyVO.MA_SO_THUE   = txt_MaSoThue.Text;
            congtyVO.HIEU_LUC     = true;
            return(congtyVO);
        }
예제 #6
0
        private void bttLuu_Click(object sender, EventArgs e)
        {
            try
            {
                if (isAdded)
                {
                    isAdded = false;
                    CongtyVO vo = GetCongtyVO();
                    congtyBUS.Insert(GetCongtyVO());
                }
                if (isModified)
                {
                    isModified = false;
                    congtyBUS.Update(GetCongtyVO());
                }

                LoadInit();
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }