示例#1
0
        public MainViewModel(string userid)
        {
            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";

            DataTable dtResult = DataAccess.DAL.Select(sql);

            if (dtResult != null && dtResult.Rows.Count > 0)
            {
                UserName = "******" + dtResult.Rows[0]["Name"].ToString();
                foreach (DataRow dr in dtResult.Rows)
                {
                    ButtonDataModel obj = new ButtonDataModel(dr["ApplicationName"].ToString(), new DelegateCommand(OnRenderForm), dr["ApplicationName"].ToString(), dr["ImagePath"].ToString());
                    MyData.Add(obj);
                }
            }
            OnRenderForm("Mail");
        }
示例#2
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);
            }
        }