Пример #1
0
        public ActionResult ListPartial(int page = 1, string sortCol = "RoleID", string sortType = "asc")
        {
            string err;

            try {
                var result = MBFDB.GetRolePageList <RoleViewModel>(out err, page, MBFDB.PageSize, sortCol, sortType);
                ViewBag.Page     = page;
                ViewBag.SortCol  = sortCol;
                ViewBag.SortType = sortType;
                //
                Session["PageInfo"] = new PageInfoModel(page, sortCol, sortType);
                if (string.IsNullOrEmpty(err))
                {
                    Response.StatusCode = (int)HttpStatusCode.OK;
                    return(PartialView("ListPartial", result));
                }
                else
                {
                    LOG.Trace(ERRHD.BuildTraceMessage(ExceptionHandle.MBF_ERROR.ERR_DB_ACCESS, "MBFDB.GetRolePageList"));
                    return(new HttpStatusCodeResult(500, ERRHD.BuildUserMsg(ExceptionHandle.MBF_ERROR.ERR_DB_ACCESS)));
                }
            }
            catch (Exception ex) {
                LOG.Fatal(ERRHD.BuildExceptionMessage(ex));
                return(new HttpStatusCodeResult(500, "exception error."));
            }
        }
Пример #2
0
        public void Trace()
        {
            using (ILOGInstance instance = new AsyncLOGInstance(true, SyncType.EventWaitHandle, true, new[] { new TestOutputter() }, new[] { new KeyValuePair <string, string>("SessionID", "TestSession") }))
            {
                _testingAdditionalfields.Add("SessionID", "TestSession");

                _testingMessage  = "test Trace message";
                _testingTag      = "Trace";
                _testingSeverity = LogSeverity.Trace;
                instance.Trace(_testingMessage, _testingTag);
                LOG.Trace(_testingMessage, _testingTag);
            }
        }
Пример #3
0
            public void InitializeInSeparateThread()
            {
                RunSpace = null;

                Thread oThread = new Thread(new ThreadStart(InitializeInCurrentThread));

                oThread.Start();
                LOG.Trace("Waiting for run space initialization to start (in a separate thread)...");
                while (!oThread.IsAlive)
                {
                    ;                                   // wait for thread to become alive
                }
                LOG.Trace("Waiting for run space initialization to finish (in a separate thread)...");
                oThread.Join();                         // wait for thread to finish
                LOG.Trace("Run space initialization finished.");
            }
Пример #4
0
        // GET: Role/Edit/5
        public ActionResult Edit(long id)
        {
            string err;

            try {
                var model = MBFDB.GetRole(out err, id);
                if (string.IsNullOrEmpty(err))
                {
                    return(PartialView(model));
                }
                else
                {
                    LOG.Trace(ERRHD.BuildTraceMessage(ExceptionHandle.MBF_ERROR.ERR_DB_ACCESS, "MBFDB.GetRole"));
                    return(new HttpStatusCodeResult(500, ERRHD.BuildUserMsg(ExceptionHandle.MBF_ERROR.ERR_DB_ACCESS)));
                }
            }
            catch (Exception ex) {
                LOG.Fatal(ERRHD.BuildExceptionMessage(ex));
                return(new HttpStatusCodeResult(500, "exception error."));
            }
        }
Пример #5
0
        public ActionResult Create(string roleID, string roleName)
        {
            int    ret = 0;
            string err = "";

            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Create"));
            }

            if (string.IsNullOrEmpty(roleID) || string.IsNullOrEmpty(roleName))
            {
                LOG.Trace(ERRHD.BuildTraceMessage(ExceptionHandle.MBF_ERROR.ERR_DATA_EMPTY));
                return(new HttpStatusCodeResult(500, ERRHD.BuildUserMsg(ExceptionHandle.MBF_ERROR.ERR_DATA_EMPTY)));
            }

            try {
                var model = new RoleViewModel();
                model.RoleID   = roleID;
                model.RoleName = roleName;
                ret            = MBFDB.InsertRole(out err, model);
                if (ret > 0)
                {
                    Response.StatusCode = (int)HttpStatusCode.OK;
                    var pageInfo = (PageInfoModel)Session["PageInfo"];
                    return(RedirectToAction("ListPartial", new { page = pageInfo.Page, SortCol = pageInfo.SortCol, SortType = pageInfo.SortType }));
                }
                else
                {
                    LOG.Trace(ERRHD.BuildTraceMessage(ExceptionHandle.MBF_ERROR.ERR_DB_INSERT, "MBFDB.InsertRole"));
                    return(new HttpStatusCodeResult(500, ERRHD.BuildUserMsg(ExceptionHandle.MBF_ERROR.ERR_DB_INSERT)));
                }
            }
            catch (Exception ex) {
                LOG.Fatal(ERRHD.BuildExceptionMessage(ex));
                return(new HttpStatusCodeResult(500, "exception error."));
            }
        }
Пример #6
0
        public ActionResult Delete(int id)
        {
            string err;

            try {
                int ret = MBFDB.DeleteRole(out err, id);
                if (ret > 0)
                {
                    Response.StatusCode = (int)HttpStatusCode.OK;
                    var pageInfo = (PageInfoModel)Session["PageInfo"];
                    return(RedirectToAction("ListPartial", new { page = pageInfo.Page, SortCol = pageInfo.SortCol, SortType = pageInfo.SortType }));
                }
                else
                {
                    LOG.Trace(ERRHD.BuildTraceMessage(ExceptionHandle.MBF_ERROR.ERR_DB_DELETE, "MBFDB.DeleteRole"));
                    return(new HttpStatusCodeResult(500, ERRHD.BuildUserMsg(ExceptionHandle.MBF_ERROR.ERR_DB_DELETE)));
                }
            }
            catch (Exception ex) {
                LOG.Fatal(ERRHD.BuildExceptionMessage(ex));
                return(new HttpStatusCodeResult(500, "exception error."));
            }
        }
Пример #7
0
 public void StaticTrace()
 {
     Assert.Throws <NotInitializedException>(() => LOG.Trace("trace Message"));
 }