Exemple #1
0
        public void TestShouldSelectEmployeeTable()
        {
            //Arrange

            var employeeDataContext = new DatabaseContext <Employee>();

            var databaseWrapper = new DBWrapper <Employee>(employeeDataContext);

            //Act

            var employeeObject = databaseWrapper.Select(employee);
            var employeeList   = employeeObject.ToList();

            //Assert

            Assert.AreEqual(35, employeeList.FirstOrDefault().Age);  // Assume the age from table is 35
        }
Exemple #2
0
        public DataTable GetRow(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (parameters.ContainsKey("p_code"))
            {
                if (!dbw.ExecuteSP("sp_pc_empl_getrow_by_code", parameters, ds))
                {
                    throw new Exception("Fail to execute sp_pc_empl_getrow_by_code", new Exception(dbw.DBErrorMessage));
                }
                else
                {
                    if (ds.Tables.Count <= 0)
                    {
                        throw new Exception("Fail to sp_pc_empl_getrow_by_code. No row found.");
                    }
                    else
                    {
                        return(ds.Tables[0]);
                    }
                }
            }
            else
            {
                if (!dbw.ExecuteSP("sp_pc_empl_getrow", parameters, ds))
                {
                    throw new Exception("Fail to execute sp_pc_empl_getrow", new Exception(dbw.DBErrorMessage));
                }
                else
                {
                    if (ds.Tables.Count <= 0)
                    {
                        throw new Exception("Fail to sp_pc_empl_getrow. No row found.");
                    }
                    else
                    {
                        return(ds.Tables[0]);
                    }
                }
            }
        }
        public TodoItemListViewModel()
        {
            SaveCommand = new Command(async() =>
            {
                try
                {
                    //Todo: get from api
                    var items = await DBWrapper.GetTodoItemsAsync();
                    await Application.Current.MainPage.Navigation.PopAsync();
                }
                catch (Exception ex)
                {
                }
            });

            TodoItem = new TodoItem {
                Notes = "Test", Task = "Tasksbd"
            };
        }
Exemple #4
0
        public static void MyClassInitialize(TestContext testContext)
        {
            try
            {
                DBWrapper dbWrapper = new DBWrapper();
                if (!dbWrapper.Initialize())
                {
                    return;
                }
                var studyList = dbWrapper.GetAllStudyList();
                if (studyList.Count > 0)
                {
                    _studyInstanceUID = studyList[0].StudyInstanceUID;
                }
                else
                {
                    return;
                }

                _seriesUID = string.Empty;
                var seriesList = dbWrapper.GetSeriesListByStudyInstanceUID(_studyInstanceUID);
                if (seriesList.Count > 0)
                {
                    _seriesUID = seriesList[0].SeriesInstanceUID;
                }
                else
                {
                    return;
                }

                var imageList = dbWrapper.GetImageListBySeriesInstanceUID(_seriesUID);
                if (imageList.Count > 0)
                {
                    _imageUID = imageList[0].SOPInstanceUID;
                }

                //_studyData = new StudyData(_studyInstanceUID);
            }
            catch (Exception ex)
            {
                Logger.LogFuncException(ex.Message + ex.StackTrace);
            }
        }
Exemple #5
0
        public static void MyClassInitialize(TestContext testContext)
        {
            DBWrapper dbWrapper = new DBWrapper();

            if (!dbWrapper.Initialize())
            {
                return;
            }
            var    studyList        = dbWrapper.GetAllStudyList();
            string studyInstanceUID = string.Empty;

            if (studyList != null && studyList.Count > 0)
            {
                studyInstanceUID = studyList[0].StudyInstanceUID;
            }
            else
            {
                return;
            }

            _seriesUID = string.Empty;
            var seriesList = dbWrapper.GetSeriesListByStudyInstanceUID(studyInstanceUID);

            if (seriesList != null && seriesList.Count > 0)
            {
                _seriesUID = seriesList[0].SeriesInstanceUID;
            }
            else
            {
                return;
            }

            var imageList = dbWrapper.GetImageListBySeriesInstanceUID(_seriesUID);

            if (imageList != null && imageList.Count > 0)
            {
                _imageUID = imageList[0].SOPInstanceUID;
            }

            //_studyData = new StudyData(studyInstanceUID);
        }
Exemple #6
0
        public DataTable GetRowsTemp(string sSPName, Hashtable htParameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            if (!dbw.ExecuteSP(sSPName, htParameters, ds))
            {
                throw new Exception("Fail to execute " + sSPName, new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to execute " + sSPName + ". No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #7
0
        private void handleData(Dictionary <string, string> dictionary)
        {
            Console.WriteLine("Data parsed and receive succesful");
            if (dictionary.ContainsKey("Game Type"))
            {
                string    title = dictionary["Game Type"];
                DBWrapper db    = new DBWrapper();
                switch (title)
                {
                case "!SAY":
                    SimonORM sayData = new SimonORM(dictionary);
                    db.AddSimonData(sayData);
                    break;

                case "!MAZ":
                    MazeORM mazData = new MazeORM(dictionary);
                    db.AddMazeData(mazData);
                    break;
                }
            }
        }
        public DataTable GetRowsBySuppStatus(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_tblsupplier_getrows_bysuppstatus", parameters, ds))
            {
                throw new Exception("Fail to sp_sys_tblsupplier_getrows_bysuppstatus sp_sys_tblsupplier_getrows", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_tblsupplier_getrows_bysuppstatus. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowsAsForListCustomerPerSupplier(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_tblsupplier_getrows_asforlistcustomerpersupplier", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_tblsupplier_getrows_asforlistcustomerpersupplier", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_tblsupplier_getrows_asforlistcustomerpersupplier. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowForGLinkFeeDetail(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_ls_tblglmiscfee_getrow_asforglinkfeedetail", parameters, ds))
            {
                throw new Exception("Fail to execute sp_ls_tblglmiscfee_getrow_asforglinkfeedetail", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_ls_tblglmiscfee_getrow_asforglinkfeedetail. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #11
0
        public DataTable GetRowByGroupCode(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_master_group_role_getrows_by_group_code", parameters, ds))
            {
                throw new Exception("Fail to execute sp_master_group_role_getrows_by_group_code", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_master_group_role_getrows_by_group_code. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRow(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("SP_MST_JABATAN_GETROW", parameters, ds))
            {
                throw new Exception("Fail to execute SP_MST_JABATAN_GETROW", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to SP_MST_JABATAN_GETROW. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRows(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_rpt_fa_monthlydepreciation_getrows", parameters, ds))
            {
                throw new Exception("Fail to execute sp_rpt_fa_monthlydepreciation_getrows", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_rpt_fa_monthlydepreciation_getrows. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowByMenuId(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_jobaccess_getrowbyMenu", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_jobaccess_getrowbyMenu", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_jobaccess_getrowbyMenu. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #15
0
        public DataRow GetRow(string TableName, string SPName, Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP(SPName, parameters, ds))
            {
                throw new Exception("Fail to execute " + SPName, new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to " + SPName + ". No row found.");
                }
                else
                {
                    return(ds.Tables[0].Rows[0]);
                }
            }
        }
Exemple #16
0
        public DataTable GetRowsCHAsforIndustryCode(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_client_getrows_plusindustrycodechannelling", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_client_getrows_plusindustrycodechannelling", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_client_getrows_plusindustrycodechannelling. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowsForLookUp(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_clientgroup_getrows_for_lookup", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_clientgroup_getrows_for_lookup", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_clientgroup_getrows_for_lookup. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #18
0
        public DataTable CheckName(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_client_checkname", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_client_checkname", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_client_checkname. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #19
0
        public object GetRowsNew(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_pl_amort_getrows_new", parameters, ds))
            {
                throw new Exception("Fail to execute sp_pl_amort_getrows_new", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_pl_amort_getrows_new. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #20
0
        public DataTable ValidateLogin(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_master_user_validate_login", parameters, ds))
            {
                throw new Exception("Fail to execute sp_master_user_validate_login", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Invalid user id/password.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #21
0
        public DataTable RentalAdjustmentLetterGetRow(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_rpt_ls_amortschedule2doc_getrow", parameters, ds))
            {
                throw new Exception("Fail to execute sp_rpt_ls_amortschedule2doc_getrow", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_rpt_ls_amortschedule2doc_getrow. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRow(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_reff_jenis_usaha_getrow", parameters, ds))
            {
                throw new Exception("Fail to execute sp_reff_jenis_usaha_getrow", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_hr_jenjang_pendidikan_getrow. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #23
0
        public DataTable LsApplicationOfferingLetterGetRow(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_surat_getrowbyid", parameters, ds))
            {
                throw new Exception("Fail to execute sp_surat_getrowbyid", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_surat_getrowbyid. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowsTempBalanceGrid(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("xsp_Temp_HR_CUTI_KUOTA_getrows", parameters, ds))
            {
                throw new Exception("Fail to execute xsp_Temp_HR_CUTI_KUOTA_getrows", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to xsp_Temp_HR_CUTI_KUOTA_getrows. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #25
0
        public DataTable GetTarikData(string xsp, Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.OtherConnectionString;
            if (!dbw.ExecuteSP(xsp, parameters, ds))
            {
                throw new Exception("Fail to " + xsp, new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to " + xsp + ". No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
        public DataTable GetRowsForOperationReports(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_master_report_getrows_operationreport", parameters, ds))
            {
                throw new Exception("Fail to execute sp_master_report_getrows_operationreport", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_master_report_getrows_operationreport. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #27
0
        public DataTable GetRowsApproval(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_expenseclaim_getrows_Approval", parameters, ds))
            {
                throw new Exception("Fail to execute sp_expenseclaim_getrows_Approval", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_expenseclaim_getrows_Approval. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #28
0
        public DataTable GetRowsAsForLeaseReject(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_sys_company_getrows_asforleasereject", parameters, ds))
            {
                throw new Exception("Fail to execute sp_sys_company_getrows_asforleasereject", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_sys_company_getrows_asforleasereject. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #29
0
        public DataTable GetRowsLeaveBalance(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_Emp_Balance_Quota_getrow", parameters, ds))
            {
                throw new Exception("Fail to execute sp_Emp_Balance_Quota_getrow", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_Emp_Balance_Quota_getrow. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }
Exemple #30
0
        public DataTable GetRowsAsForChannelling(Hashtable parameters)
        {
            DBWrapper dbw = DBWrapper.GetSqlClientWrapper();
            DataSet   ds  = new DataSet();

            dbw.ConnectionString = Shared.ConnectionString;
            if (!dbw.ExecuteSP("sp_rpt_ch_akad_getrowsasforchannelling", parameters, ds))
            {
                throw new Exception("Fail to execute sp_rpt_ch_akad_getrowsasforchannelling", new Exception(dbw.DBErrorMessage));
            }
            else
            {
                if (ds.Tables.Count <= 0)
                {
                    throw new Exception("Fail to sp_rpt_ch_akad_getrowsasforchannelling. No row found.");
                }
                else
                {
                    return(ds.Tables[0]);
                }
            }
        }