예제 #1
0
        public IList <CDM_Khach_Hang> List_DM_Khach_Hang()
        {
            IList <CDM_Khach_Hang> v_arrRes = new List <CDM_Khach_Hang>();
            DataTable v_dt = new DataTable();

            try
            {
                CSqlHelper.FillDataTable(CConfig.g_strVTNN_Conn_String, v_dt, "sp_sel_List_DM_Khach_Hang");

                foreach (DataRow v_row in v_dt.Rows)
                {
                    CDM_Khach_Hang v_objRes = new CDM_Khach_Hang();
                    MapDM_Khach_Hang(v_row, v_objRes);
                    v_arrRes.Add(v_objRes);
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                v_dt.Dispose();
            }

            return(v_arrRes);
        }
예제 #2
0
        public CDM_Khach_Hang Get_DM_Khach_Hang_By_ID(Int64 p_iID)
        {
            CDM_Khach_Hang v_objRes = null;
            DataTable      v_dt     = new DataTable();

            try
            {
                CSqlHelper.FillDataTable(CConfig.g_strVTNN_Conn_String, v_dt, "sp_sel_Get_DM_Khach_Hang_By_ID", p_iID);

                if (v_dt.Rows.Count > 0)
                {
                    v_objRes = new CDM_Khach_Hang();
                    MapDM_Khach_Hang(v_dt.Rows[0], v_objRes);
                }
            }

            catch (Exception ex)
            {
                throw ex;
            }

            finally
            {
                v_dt.Dispose();
            }

            return(v_objRes);
        }
예제 #3
0
        private void MapDM_Khach_Hang(DataRow p_row, CDM_Khach_Hang p_objDes)
        {
            DataTable p_dt = p_row.Table;

            if (p_dt.Columns.Contains("Auto_ID"))
            {
                p_objDes.Auto_ID = CUtility.Convert_To_Int64(p_row["Auto_ID"]);
            }

            if (p_dt.Columns.Contains("Ma_Khach_Hang"))
            {
                p_objDes.Ma_Khach_Hang = CUtility.Convert_To_String(p_row["Ma_Khach_Hang"]);
            }

            if (p_dt.Columns.Contains("Ten_Khach_Hang"))
            {
                p_objDes.Ten_Khach_Hang = CUtility.Convert_To_String(p_row["Ten_Khach_Hang"]);
            }

            if (p_dt.Columns.Contains("Dia_Chi"))
            {
                p_objDes.Dia_Chi = CUtility.Convert_To_String(p_row["Dia_Chi"]);
            }

            if (p_dt.Columns.Contains("Dien_Thoai"))
            {
                p_objDes.Dien_Thoai = CUtility.Convert_To_String(p_row["Dien_Thoai"]);
            }

            if (p_dt.Columns.Contains("Ma_So_Thue"))
            {
                p_objDes.Ma_So_Thue = CUtility.Convert_To_String(p_row["Ma_So_Thue"]);
            }

            if (p_dt.Columns.Contains("Created"))
            {
                p_objDes.Created = CUtility.Convert_To_DateTime(p_row["Created"]);
            }

            if (p_dt.Columns.Contains("Created_By"))
            {
                p_objDes.Created_By = CUtility.Convert_To_String(p_row["Created_By"]);
            }

            if (p_dt.Columns.Contains("Last_Updated"))
            {
                p_objDes.Last_Updated = CUtility.Convert_To_DateTime(p_row["Last_Updated"]);
            }

            if (p_dt.Columns.Contains("Last_Updated_By"))
            {
                p_objDes.Last_Updated_By = CUtility.Convert_To_String(p_row["Last_Updated_By"]);
            }

            if (p_dt.Columns.Contains("Deleted"))
            {
                p_objDes.Deleted = CUtility.Convert_To_Bool(p_row["Deleted"]);
            }
        }
 public void InitForm()
 {
     if (this.fStatus == Utility.FormStatus.Add)
     {
         this.Text     = "Thêm mới khách hàng";
         _objKhachHang = new CDM_Khach_Hang();
     }
     if (this.fStatus == Utility.FormStatus.Edit)
     {
         this.Text = "Sửa khách hàng";
     }
 }
예제 #5
0
        public void Update_DM_Khach_Hang(CDM_Khach_Hang p_objData)
        {
            try
            {
                CSqlHelper.ExecuteNonquery(CConfig.g_strVTNN_Conn_String, "sp_upd_DM_Khach_Hang", p_objData.Auto_ID,
                                           p_objData.Ma_Khach_Hang, p_objData.Ten_Khach_Hang, p_objData.Dia_Chi, p_objData.Dien_Thoai, p_objData.Ma_So_Thue, p_objData.Last_Updated_By);
            }

            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #6
0
 public void Updated()
 {
     if (grvKhachHang.RowCount > 0 && grvKhachHang.FocusedRowHandle >= 0)
     {
         using (frmChiTietKhachHang frm = new frmChiTietKhachHang())
         {
             frm.fStatus = Utility.FormStatus.Edit;
             CDM_Khach_Hang v_objKhachHang = (CDM_Khach_Hang)grvKhachHang.GetRow(grvKhachHang.FocusedRowHandle);
             frm._objKhachHang = v_objKhachHang;
             frm.ReLoadParent  = this.Load_Data_Form;
             frm.ShowDialog();
         }
     }
 }
예제 #7
0
        public int Insert_DM_Khach_Hang(CDM_Khach_Hang p_objData)
        {
            int v_iRes = CConst.INT_VALUE_NULL;

            try
            {
                v_iRes = Convert.ToInt32(CSqlHelper.ExecuteScalar(CConfig.g_strVTNN_Conn_String, "sp_ins_DM_Khach_Hang",
                                                                  p_objData.Ma_Khach_Hang, p_objData.Ten_Khach_Hang, p_objData.Dia_Chi, p_objData.Dien_Thoai, p_objData.Ma_So_Thue, p_objData.Last_Updated_By));
            }

            catch (Exception ex)
            {
                throw ex;
            }

            return(v_iRes);
        }
예제 #8
0
 public void Deleted()
 {
     if (grvKhachHang.RowCount > 0 && grvKhachHang.FocusedRowHandle >= 0 && CExtensions.showConfirmMessage("Xác nhận xóa dữ liệu"))
     {
         CDM_Khach_Hang v_objKhachHang = (CDM_Khach_Hang)grvKhachHang.GetRow(grvKhachHang.FocusedRowHandle);
         if (v_objKhachHang != null)
         {
             try
             {
                 _objKhachHangBUS.Deleted(v_objKhachHang.Auto_ID, "Admin");
                 CExtensions.showMessage("Xóa dữ liệu thành công!");
                 Load_Data_Form();
             }
             catch (Exception ex)
             {
                 CExtensions.showErrorException(ex, "Error!");
             }
         }
     }
 }