コード例 #1
0
ファイル: DAL.cs プロジェクト: mdshahidkamal/SourceCode
        static void GetConnectionString()
        {
            try
            {
                string dbpath = ConfigurationSettings.AppSettings["db"].ToString();

                string strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbpath + ";Persist Security Info=False;";
                oConn = new OleDbConnection(strConnectionString);
            }
            catch (Exception ex)
            {
                logger.Log(((System.Data.OleDb.OleDbException)(ex)).Message, MessageType.Error);
            }
            finally
            {
                oConn.Close();
            }
        }
コード例 #2
0
 void GetImageTempate()
 {
     try
     {
         string LogoPath = ConfigurationSettings.AppSettings["SchoolLogo"].ToString();
         LogoPath         = LogoPath + Common.ClientLogo;
         this.ImageSource = BitmapFrame.Create(new Uri(LogoPath), BitmapCreateOptions.None,
                                               BitmapCacheOption.OnLoad);
     }
     catch (Exception ex)
     {
         logger.Log(ex.StackTrace, MessageType.Error);
     }
 }
コード例 #3
0
        public MainViewModel(string userid)
        {
            TabItemSource = new ObservableCollection <TabDataModel>();
            logger        = Helpers.Logger.IntializeLogger();


            //string sql = "select m.application_id,a.applicationname,m.user_id,a.imagepath,u.Name from applicationmapping m, applications a, users u";
            //sql += " where m.application_id=a.id";

            //sql += " and m.user_id=u.id and u.id=" + userid + " order by SortOrder";

            string    sql      = "exec ims.imsUserAppMapping " + userid + "," + 25;
            DataTable dtResult = DataAccess.DAL.Select(sql);

            if (dtResult != null && dtResult.Rows.Count > 0)
            {
                UserName = "******" + dtResult.Rows[0]["Name"].ToString();
                Common.LoggedInUserID = dtResult.Rows[0]["User_ID"].ToString();
                foreach (DataRow dr in dtResult.Rows)
                {
                    ButtonDataModel obj = new ButtonDataModel(dr["ApplicationName"].ToString(), new DelegateCommand(OnRenderForm), new string[] { dr["ApplicationName"].ToString() }, dr["ImagePath"].ToString());
                    MyData.Add(obj);
                }
            }
            this.ClientNAme   = Common.ClientName;
            this.AcademicYear = Common.AcademicYear;
            this.ConnectedTo  = "Connected To " + DataAccess.DAL.oConn.DataSource;
            //            string[] arr = new string[] { "Letter" };
            OnRenderForm(null);
            try
            {
                download();
            }
            catch (Exception ex)
            {
                logger.Log(ex.StackTrace, MessageType.Error);
            }
        }
コード例 #4
0
ファイル: DAL.cs プロジェクト: mdshahidkamal/SourceCode
        static void GetConnectionString()
        {
            try
            {
                //                string dbpath = ConfigurationSettings.AppSettings["db"].ToString();

                //string strConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + dbpath + ";Persist Security Info=False;";
                //string strConnectionString= "Data Source = moskit.database.windows.net; Initial Catalog = moskitdb; Persist Security Info = True; User ID=moskitadmin@moskit;Password=pwdsql@4712;";
                //string strConnectionString = @"Data Source=DELL\SQLEXPRESS;Initial Catalog=moskitdb;Integrated Security=True;";
                string strConnectionString = ConfigurationSettings.AppSettings["ConnectionString"].ToString();
                //string strConnectionString = "Server=tcp:moskit.database.windows.net,1433;Database=moskitdb;User ID=moskitadmin@moskit;Password=pwdsql@4712;Encrypt=True;TrustServerCertificate=true;Connection Timeout=30;";
                oConn = new SqlConnection(strConnectionString);
                logger.Log("Connecting Server :" + oConn.DataSource, MessageType.Debug);
                logger.Log("Connecting Database :" + oConn.Database, MessageType.Debug);
            }
            catch (Exception ex)
            {
                logger.Log(((SqlException)(ex)).Message, MessageType.Error);
            }
            finally
            {
                //oConn.Close();
            }
        }