コード例 #1
0
        /// <summary>
        /// Lấy danh sách id được chọn
        /// </summary>
        /// <returns></returns>
        private List <NS_DM_DANH_MUC_DTO> getListSeletedDataRow()
        {
            try
            {
                List <NS_DM_DANH_MUC_DTO> listDataRow = new List <NS_DM_DANH_MUC_DTO>();

                if (grid.SelectedItems.Count > 0)
                {
                    for (int i = 0; i < grid.SelectedItems.Count; i++)
                    {
                        NS_DM_DANH_MUC_DTO nsDmDanhMuc = (NS_DM_DANH_MUC_DTO)grid.SelectedItems[i];
                        listDataRow.Add(nsDmDanhMuc);
                    }
                }
                return(listDataRow);
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                return(null);
            }
        }
コード例 #2
0
        private void LoadGrid()
        {
            NhanSuProcess processNhanSu = new NhanSuProcess();

            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                List <ClientResponseDetail> listClientResponseDetail = new List <ClientResponseDetail>();
                List <NS_DM_DANH_MUC>       lstDMDanhMuc             = new List <NS_DM_DANH_MUC>();
                bool ret = processNhanSu.DanhSachDanhMuc(DatabaseConstant.Action.LOAD_DATA, ref lstDMDanhMuc, ref listClientResponseDetail);

                if (ret == true)
                {
                    int i = 1;
                    List <NS_DM_DANH_MUC_DTO> lstDTO = new List <NS_DM_DANH_MUC_DTO>();
                    NS_DM_DANH_MUC_DTO        obj    = null;
                    for (i = 0; i < lstDMDanhMuc.Count; i++)
                    {
                        obj              = new NS_DM_DANH_MUC_DTO();
                        obj.ID           = lstDMDanhMuc[i].ID;
                        obj.STT          = i + 1;
                        obj.MA_DANH_MUC  = lstDMDanhMuc[i].MA_DANH_MUC;
                        obj.TEN_DANH_MUC = lstDMDanhMuc[i].TEN_DANH_MUC;
                        lstDTO.Add(obj);
                    }
                    grid.DataContext = lstDTO;
                }
                else
                {
                    grid.DataContext = null;
                }
            }
            catch (System.Exception ex)
            {
                CommonFunction.ThongBaoLoi(ex);
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
            }
            Mouse.OverrideCursor = Cursors.Arrow;
        }