示例#1
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            var user = (UserInfoModel)httpContext.Session[Constants.SessionKeys.UserInfo];

            if (user == null)
            {
                _IsLogged = false;
            }
            else
            {
                _IsLogged = true;
                //Neu yeu cau check accion
                if (user.ROLE == Constants.Role.SuperAdmin || Action == null)
                {
                    _HasPermission = true;
                }
                else
                {
                    _HasPermission = Action.Any(t =>
                                                (
                                                    (user.ListMenu != null)
                                                    &&
                                                    (user.ListMenu.Where(x => x.ID == t).ToList().Count > 0)
                                                )
                                                );
                }
                if (_HasPermission && Action != null)
                {
                    LogBusiness log = new LogBusiness();
                    log.LogThaoTac(user.USER_NAME, httpContext.Request.Url.LocalPath, httpContext.Request.Url.OriginalString, Action[0]);
                }
                return(_HasPermission);
            }
            return(false);
        }
示例#2
0
        public void SendNotification(IEnumerable <Guid> users, Notification.Entity.SignalR.Notification notification)
        {
            try
            {
                LogBusiness.Info(string.Format("[NotificationHub] SendNotification (connectionId: {0})", Context.ConnectionId));

                if (users == null || !users.Any())
                {
                    LogBusiness.Warn(string.Format("[NotificationHub] SendNotification  - Listagem de usuários vazia (connectionId: {0})", Context.ConnectionId));
                    return;
                }

                if (notification == null)
                {
                    LogBusiness.Warn(string.Format("[NotificationHub] SendNotification  - Notificação vazia (connectionId: {0})", Context.ConnectionId));
                    return;
                }

                foreach (var user in users)
                {
                    LogBusiness.Debug(string.Format("[NotificationHub] SendNotification  - Notificação ({0}) enviada para o usuário ({1})", notification.Id, user));
                    Clients.Group(user.ToString()).ReceiveNotification(notification);
                }
            }
            catch (Exception exc)
            {
                LogBusiness.Error(exc);
                throw;
            }
        }
示例#3
0
        public override Task OnDisconnected(bool stopCalled)
        {
            try
            {
                LogBusiness.Info(string.Format("[NotificationHub] OnDisconnected (connectionId: {0})", Context.ConnectionId));

                var principal = this.Context.User as ClaimsPrincipal;

                var getUserId = from c in principal.Identities.First().Claims
                                where c.Type == CLAIM_USERID
                                select c.Value;//.FirstOrDefault();
                var userId = getUserId.FirstOrDefault();

                if (userId != null)
                {
                    LogBusiness.Debug(string.Format("[NotificationHub] Grupo ({0})  removido (connectionId: {1})", userId, Context.ConnectionId));
                    Groups.Remove(Context.ConnectionId, userId.ToString());
                }

                return(base.OnDisconnected(stopCalled));
            }
            catch (Exception exc)
            {
                LogBusiness.Error(exc);
                throw;
            }
        }
示例#4
0
        public JsonResult GetTaskLogs(string taskID, string userID, string clientID, int pageindex = 1)
        {
            if (!string.IsNullOrEmpty(taskID))
            {
                int totalCount = 0;
                int pageCount  = 0;
                var list       = LogBusiness.GetLogs(taskID, EnumLogObjectType.OrderTask, PageSize, pageindex, ref totalCount, ref pageCount, clientID);

                List <Dictionary <string, object> > logs = new List <Dictionary <string, object> >();
                foreach (var item in list)
                {
                    Dictionary <string, object> log = new Dictionary <string, object>();
                    log.Add("createUser", GetUserBaseObj(item.CreateUser));
                    log.Add("remark", item.Remark);
                    log.Add("createTime", item.CreateTime.ToString("yyyy-MM-dd hh:mm:ss"));
                    logs.Add(log);
                }

                JsonDictionary.Add("taskLogs", logs);
                JsonDictionary.Add("totalCount", totalCount);
                JsonDictionary.Add("pageCount", pageCount);
            }

            return(new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
示例#5
0
 void txtCode_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         cmbMaterial.Items.Clear();
         string barcode = this.txtCode.Text.Trim();
         LogBusiness.RecordLog(user, "扫码器读取条码为:" + barcode, "读取条码");
         DataTable table = test.GetInfomation(barcode);
         if (table.Rows.Count != 0)
         {
             foreach (DataRow item in table.Rows)
             {
                 if (!cmbMaterial.Items.Contains(item["MaterialNumber"]))
                 {
                     this.cmbMaterial.Items.Add(item["MaterialNumber"]);
                 }
             }
             cmbMaterial.SelectedIndex = 0;
         }
         else
         {
             MessageBox.Show("未查询到数据,请重试!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
示例#6
0
        public IHttpActionResult GetFoPickUpCountwise(int mode, int districtID, string date, string toDate, string UID)
        {
            //return Ok(db.Tbl_Questions.Where(x => x.QuetionId == mode));
            var fromOrderDate = Convert.ToDateTime(date).ToString("yyyy-MM-dd 00:00:00.000");
            var toOrderDate   = Convert.ToDateTime(toDate).ToString("yyyy-MM-dd 23:59:59.000");

            try
            {
                var modeName = mode == 1 ? "Order Creation Report" : "Order Delivery Report";
                var filter   = "From Date:- " + fromOrderDate.ToString() + "<br/>ToDate:- " + toOrderDate.ToString() + "<br/> Mode:- " + modeName;
                var filename = "PickUp Sheet(Assigned/picked/Returned)";

                LogBusiness.DownloadHistoryLog(filter, filename, Convert.ToInt32(UID));
            }
            catch
            { }
            //var list = ClsHelper.Get_Orderdetail(mode,Convert.ToDateTime(fromOrderDate), Convert.ToDateTime(toOrderDate));
            DataSet ds = LogBusiness.GetFoPickUp(mode, Convert.ToDateTime(fromOrderDate), Convert.ToDateTime(toOrderDate), districtID);

            if (ds != null && ds.Tables.Count > 1 && ds.Tables[0].Rows.Count > 1)
            {
                ds.Tables[0].TableName = "FoPickUpCountWise";
                ds.Tables[1].TableName = "FoPickUpValueWise";
                string disrictname = Convert.ToString(ds.Tables[0].Rows[0]["DistrictName"]);
            }

            return(Ok(ds));//View("OrderReport");
        }
示例#7
0
 public MainWindow(User user)
 {
     this.userInfo = user;
     LogBusiness.RecordLog(userInfo.Id.ToString(), "登录进入管理系统", "登录");
     InitializeComponent();
     this.FormClosing += new FormClosingEventHandler(MainWindow_FormClosing);
 }
示例#8
0
        public ActionResult SelectLogImage(IEnumerable <int> ImageIDs)
        {
            LogBusiness LogBO = new LogBusiness();

            //Lay nhung image da chon tu db, sort theo rollcall ID
            List <LogImage> ImageList = ImageIDs.Select(id => LogBO.GetLogImageByID(id))
                                        .OrderBy(img => img.AttendanceLog.RollCallID).ToList();

            List <int> RollCallIDs = ImageList.Select(img => img.AttendanceLog.RollCallID).Distinct().ToList();

            List <RecognizerResult> Result = new List <RecognizerResult>();

            foreach (int RollCallID in RollCallIDs)
            {
                List <LogImage> RollCallImages = ImageList.Where(img => img.AttendanceLog.RollCallID == RollCallID).ToList();
                List <String>   ImagePaths     = RollCallImages.Select(img => Server.MapPath("~/Content/Log/" + img.ImageLink)).ToList();

                //Nhan dien khuon mat, dua vao list de show ra
                Result.AddRange(FaceBusiness.RecognizeStudentForAttendance(RollCallID, ImagePaths));
            }


            //Danh sash student de tao select list
            ViewBag.Students = StuBO.GetAllStudents();

            return(View("LogImagesResult", Result));
        }
示例#9
0
        public MA_COUNTRY_LIMIT CreateTempLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT record)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (record.EFFECTIVE_DATE < sessioninfo.Process.CurrentDate)
                    throw this.CreateException(new Exception(), "Effective date cannot be set to past date.");

                if (record.EXPIRY_DATE < sessioninfo.Process.CurrentDate)
                    throw this.CreateException(new Exception(), "Expiry date cannot be set to past date.");

                if (record.EXPIRY_DATE <= record.EFFECTIVE_DATE)
                    throw this.CreateException(new Exception(), "Expiry date must be after effective date.");

                var duplicate = unitOfWork.MA_COUNTRY_LIMITRepository.All().FirstOrDefault(p => p.ISTEMP == true && p.ISACTIVE == true
                                                                                                && p.COUNTRY_ID == record.COUNTRY_ID && p.EXPIRY_DATE >= record.EFFECTIVE_DATE);
                if (duplicate != null)
                    throw this.CreateException(new Exception(), "Duplicate temp limit info");

                LogBusiness logBusiness = new LogBusiness();
                var newRecord = new { AMOUNT = record.AMOUNT, EFFECTIVE_DATE = record.EFFECTIVE_DATE, EXPIRY_DATE = record.EXPIRY_DATE };
                unitOfWork.DA_LOGGINGRepository.Add(logBusiness.CreateLogging(sessioninfo, record.COUNTRY_ID, LimitLogEvent.TEMP_COUNTRY_LIMIT_AUDIT.ToString(), LookupFactorTables.MA_COUNTRY_LIMIT, "Temp Country Limit", newRecord));

                unitOfWork.MA_COUNTRY_LIMITRepository.Add(record);
                unitOfWork.Commit();
            }

            return record;
        }
示例#10
0
        public MA_CTPY_LIMIT UpdateCounterpartyLimit(SessionInfo sessioninfo, MA_CTPY_LIMIT counterpartyLimit)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var foundData = unitOfWork.MA_CTPY_LIMITRepository.GetAll().FirstOrDefault(p => p.ID == counterpartyLimit.ID);
                if (foundData == null)
                {
                    throw this.CreateException(new Exception(), "Data not found!");
                }
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var         oldRecord   = new{ AMOUNT = foundData.AMOUNT.ToString("#,##0"), FLAG_CONTROL = foundData.FLAG_CONTROL, EXPIRE_DATE = foundData.EXPIRE_DATE };
                    var         newRecord   = new { AMOUNT = counterpartyLimit.AMOUNT.ToString("#,##0"), FLAG_CONTROL = counterpartyLimit.FLAG_CONTROL, EXPIRE_DATE = counterpartyLimit.EXPIRE_DATE };
                    var         log         = logBusiness.UpdateLogging(sessioninfo, foundData.ID, LimitLogEvent.LIMIT_AUDIT.ToString(), LookupFactorTables.MA_CTPY_LIMIT, oldRecord, newRecord);
                    if (log != null)
                    {
                        unitOfWork.DA_LOGGINGRepository.Add(log);
                    }
                    foundData.ID                 = counterpartyLimit.ID;
                    foundData.AMOUNT             = counterpartyLimit.AMOUNT;
                    foundData.FLAG_CONTROL       = counterpartyLimit.FLAG_CONTROL;
                    foundData.EXPIRE_DATE        = counterpartyLimit.EXPIRE_DATE;
                    foundData.LOG.MODIFYBYUSERID = counterpartyLimit.LOG.MODIFYBYUSERID;
                    foundData.LOG.MODIFYDATE     = DateTime.Now;
                    foundData.LIMIT_ID           = counterpartyLimit.LIMIT_ID;
                    unitOfWork.Commit();
                }
            }

            return(counterpartyLimit);
        }
 public MailController(IEmail emailService)
 {
     #region Write Log
     var dtEntry = DateTime.Now;
     var address = baseAddress + ".MailController(IEmail emailService)";
     var dic     = LogBusiness.GetDictionary();
     dic.Add(LogFieldName.FullyQualifiedFunctionName, address);
     var dicParams = LogBusiness.GetDictionary();
     dicParams.Add(LogFieldName.Token, dicParams);
     LogBusiness.CustomLog("AnonymousUser", LogEvent.MethodStart, dic, dicParams);
     #endregion
     try
     {
         _emailService = emailService;
     }
     catch (Exception ex)
     {
         #region Write Log
         dic = LogBusiness.GetDictionary();
         dic.Add(LogFieldName.FullyQualifiedFunctionName, baseAddress);
         dic.Add(LogFieldName.ErrorMessage, ex.Message);
         dic.Add(LogFieldName.StackTrace, ex.StackTrace);
         dic.Add(LogFieldName.TimeElapsed, ((int)(DateTime.Now - dtEntry).TotalMilliseconds).ToString());
         LogBusiness.CustomLog("EMail informations could not be loaded to MailAPI possibly from unexpected error", LogEvent.ErrorEvent, dic, dicParams);
         #endregion
     }
 }
示例#12
0
 /// <summary>
 /// 确认保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (storeUnit.StoreStructUpdate(txtUsedStatus.Text, txtStoreType.Text, txtRowNumber.Text, txtColumnNumber.Text, txtLayerNumber.Text) == 1)
     {
         LogBusiness.RecordLog("管理员", string.Format("将库位{0}-{1}-{2}状态修改为【使用状态{3}】", txtRowNumber.Text, txtColumnNumber.Text, txtLayerNumber.Text, txtUsedStatus.Text), "修改仓库结构属性");
     }
     MessageBox.Show("修改成功,重启系统以后生效", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 }
示例#13
0
        //
        // GET: /Help/

        public ActionResult Security()
        {
            var logmd = LogBusiness.GetLogsByUserID(CurrentUser.UserID, 1);

            ViewBag.LastIP   = logmd.IP == "::1" ? "127.0.0.1" : logmd.IP;
            ViewBag.LastTime = logmd.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            return(View());
        }
示例#14
0
 /// <summary>
 /// 获取用户浏览量
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public JsonResult GetUserReport(string userid)
 {
     JsonDictionary.Add("item", LogBusiness.GetUserCount(userid));
     return(new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     });
 }
示例#15
0
        public void TestEmtpyUrl()
        {
            string      url         = string.Empty;
            LogBusiness logBusiness = new LogBusiness(url);

            Action action = () => logBusiness.MapMinhaCdnToAgora();

            action.Should().Throw <Exception>().WithMessage("The url is empty");
        }
示例#16
0
        public void TestInvalidUrl()
        {
            string      url         = "test";
            LogBusiness logBusiness = new LogBusiness(url);

            Action action = () => logBusiness.MapMinhaCdnToAgora();

            action.Should().Throw <Exception>().WithMessage("The url is invalid");
        }
示例#17
0
        public ActionResult UserEdit()
        {
            var model = M_UsersBusiness.GetUserDetail(CurrentUser.UserID);
            var logmd = LogBusiness.GetLogsByUserID(CurrentUser.UserID, 2);

            ViewBag.UserName = model.UserName;
            ViewBag.LastIP   = model.LastLoginIP == "::1" ? "127.0.0.1" : model.LastLoginIP;
            ViewBag.LastTime = logmd.CreateTime.ToString("yyyy-MM-dd HH:mm:ss");
            return(View());
        }
示例#18
0
        public MA_TEMP_CTPY_LIMIT UpdateTempLimit(SessionInfo sessioninfo, MA_TEMP_CTPY_LIMIT record)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (record.EFFECTIVE_DATE < sessioninfo.Process.CurrentDate)
                {
                    throw this.CreateException(new Exception(), "Effective date cannot be set to past date.");
                }

                if (record.EXPIRY_DATE < sessioninfo.Process.CurrentDate)
                {
                    throw this.CreateException(new Exception(), "Expiry date cannot be set to past date.");
                }

                if (record.EXPIRY_DATE <= record.EFFECTIVE_DATE)
                {
                    throw this.CreateException(new Exception(), "Expiry date must be after effective date.");
                }

                var duplicate = unitOfWork.MA_TEMP_CTPY_LIMITRepository.All().FirstOrDefault(p => p.CTPY_LIMIT_ID == record.CTPY_LIMIT_ID && p.ISACTIVE == true && p.ID != record.ID && p.EXPIRY_DATE >= record.EFFECTIVE_DATE);
                if (duplicate != null)
                {
                    throw this.CreateException(new Exception(), "Duplicate temp limit info");
                }

                var foundData = unitOfWork.MA_TEMP_CTPY_LIMITRepository.GetAll().FirstOrDefault(p => p.ID == record.ID);
                if (foundData == null)
                {
                    throw this.CreateException(new Exception(), "Data not found!");
                }
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var         oldRecord   = new { AMOUNT = foundData.AMOUNT.ToString("#,##0"), EFFECTIVE_DATE = foundData.EFFECTIVE_DATE, EXPIRY_DATE = foundData.EXPIRY_DATE, ISACTIVE = foundData.ISACTIVE };
                    var         newRecord   = new { AMOUNT = record.AMOUNT.ToString("#,##0"), EFFECTIVE_DATE = record.EFFECTIVE_DATE, EXPIRY_DATE = record.EXPIRY_DATE, ISACTIVE = record.ISACTIVE };
                    var         log         = logBusiness.UpdateLogging(sessioninfo, foundData.CTPY_LIMIT_ID, LimitLogEvent.TEMP_LIMIT_AUDIT.ToString(), LookupFactorTables.MA_TEMP_CTPY_LIMIT, oldRecord, newRecord, "Temp Limit");

                    if (log != null)
                    {
                        unitOfWork.DA_LOGGINGRepository.Add(log);
                    }

                    foundData.AMOUNT             = record.AMOUNT;
                    foundData.CTPY_LIMIT_ID      = record.CTPY_LIMIT_ID;
                    foundData.EFFECTIVE_DATE     = record.EFFECTIVE_DATE;
                    foundData.EXPIRY_DATE        = record.EXPIRY_DATE;
                    foundData.ISACTIVE           = record.ISACTIVE;
                    foundData.LOG.MODIFYBYUSERID = record.LOG.MODIFYBYUSERID;
                    foundData.LOG.MODIFYDATE     = DateTime.Now;
                    unitOfWork.Commit();
                }
            }

            return(record);
        }
示例#19
0
        public MA_USER UpdateUser(SessionInfo sessioninfo, MA_USER user)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USERRepository.GetAll().FirstOrDefault(p => p.USERCODE.ToLower() == user.USERCODE.ToLower() && p.ID != user.ID);
                if (checkDuplicate != null)
                {
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
                }

                var foundUser = unitOfWork.MA_USERRepository.GetAll().FirstOrDefault(p => p.ID == user.ID);
                if (foundUser == null)
                {
                    throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND);
                }
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var         oldRecord   = new {
                        DEPARTMENT     = foundUser.DEPARTMENT, ISACTIVE = foundUser.ISACTIVE
                        , ISLOCKED     = foundUser.ISLOCKED, NAME = foundUser.NAME
                        , USERCODE     = foundUser.USERCODE, USER_OPICS = foundUser.USER_OPICS
                        , USER_PROFILE = foundUser.MA_USER_PROFILE.LABEL
                    };
                    var newRecord = new
                    {
                        DEPARTMENT     = user.DEPARTMENT, ISACTIVE = user.ISACTIVE
                        , ISLOCKED     = user.ISLOCKED, NAME = user.NAME
                        , USERCODE     = user.USERCODE, USER_OPICS = user.USER_OPICS
                        , USER_PROFILE = unitOfWork.MA_USER_PROFILERepository.All().FirstOrDefault(p => p.ID == user.USER_PROFILE_ID).LABEL
                    };

                    var log = logBusiness.UpdateLogging(sessioninfo, foundUser.ID, LogEvent.USER_AUDIT.ToString(), LookupFactorTables.MA_USER, oldRecord, newRecord);
                    if (log != null)
                    {
                        unitOfWork.DA_LOGGINGRepository.Add(log);
                    }
                    foundUser.ID                 = user.ID;
                    foundUser.DEPARTMENT         = user.DEPARTMENT;
                    foundUser.ISACTIVE           = user.ISACTIVE;
                    foundUser.ISLOCKED           = user.ISLOCKED;
                    foundUser.LOG.MODIFYBYUSERID = user.LOG.MODIFYBYUSERID;
                    foundUser.LOG.MODIFYDATE     = user.LOG.MODIFYDATE;
                    foundUser.NAME               = user.NAME;
                    foundUser.USERCODE           = user.USERCODE;
                    foundUser.USER_OPICS         = user.USER_OPICS;
                    foundUser.USER_PROFILE_ID    = user.USER_PROFILE_ID;

                    unitOfWork.Commit();
                }
            }

            return(user);
        }
示例#20
0
        public static bool CreateUserReport(string seeid, string seename, string keyName, string operateip, string userid = "", string username = "", string levelid = "")
        {
            var bl = M_UsersDAL.BaseProvider.CreateUserReport(seeid, keyName);

            if (!string.IsNullOrEmpty(userid))
            {
                LogBusiness.AddOperateLog(userid, username, levelid, seeid, seename, EnumUserOperateType.SeeUser, "",
                                          operateip);
            }
            return(bl);
        }
示例#21
0
        public static string GetUserPartInfo(string seeID, string seename, string cname, string userid, string username, string leveid, string operateip)
        {
            object obj = CommonBusiness.Select("M_Users", cname, " Userid='" + seeID + "'");

            if (obj != null)
            {
                LogBusiness.AddOperateLog(userid, username, leveid, seeID, seename, EnumUserOperateType.SeeLink, "联系方式", operateip);
                return(obj.ToString());
            }
            return("");
        }
示例#22
0
        public static bool CreateNeeds(UserNeeds needs, string operateip)
        {
            var result = UserNeedsDAL.BaseProvider.CreateNeeds(needs.UserID, needs.UserName, needs.Type, needs.Title,
                                                               needs.Content, needs.LetDays, needs.ServiceConten, needs.NeedSex, needs.Price, needs.NeedType, needs.NeedCity, needs.NeedDate);

            if (result && needs.Type == 0)
            {
                LogBusiness.AddOperateLog(needs.UserID, needs.UserName, needs.UserLevelID, "", "", EnumUserOperateType.SendLog,
                                          needs.Title, operateip);
            }
            return(result);
        }
        public static void SendNotification(IEnumerable <Guid> users, Guid notificationId)
        {
            try
            {
                var notif = NotificationBusiness.GetById(notificationId);

                if (notif == null)
                {
                    LogBusiness.Warn(string.Format("[SignalRClientBusiness] SendNotification - Notificação não encontrada ({0})", notificationId));
                    return;
                }

                if ((notif.DateStartNotification > DateTime.Now.Date) ||
                    (notif.DateEndNotification != null && DateTime.Now.Date > notif.DateEndNotification))
                {
                    LogBusiness.Info(string.Format("[SignalRClientBusiness] SendNotification - Notificação fora do período programado ({0})", notificationId));
                    return;
                }

                var notifP = new Notification.Entity.SignalR.Notification()
                {
                    Id      = notif.Id,
                    Title   = notif.Title,
                    Message = notif.Message
                };

                var hubConnection = new HubConnection(UrlSignalRServer);
                var hub           = hubConnection.CreateHubProxy("notificationHub");

                hubConnection.Headers.Add("Authorization", "Basic " + Base64Encode(UserCredentialSignalRServer, PasswordCredentialSignalRServer));

                hubConnection.Start().Wait();

                int i     = 0;
                int total = users.Count();

                while (i < total)
                {
                    var ltU = users.Skip(i).Take(1000).ToList();
                    LogBusiness.Debug(string.Format("[SignalRClientBusiness] SendNotification - Enviando... ({0}-{1})", i, ltU.Count));
                    hub.Invoke("SendNotification", ltU, notifP).Wait();
                    i += 1000;
                }

                hubConnection.Stop();
            }
            catch (Exception exc)
            {
                LogBusiness.Error(exc);
                throw;
            }
        }
示例#24
0
        public IActionResult Search(JDataTableSearch model, string AppId, string AppName)
        {
            IList <AppInfo> res = LogBusiness.GetAppInfoList();

            JDatatableResult jDatatable = new JDatatableResult()
            {
                data            = res,
                recordsTotal    = res.Count,
                recordsFiltered = res.Count
            };

            return(new JsonResult(jDatatable));
        }
 public HttpResponseMessage Get()
 {
     try
     {
         var result = SchoolSuperiorBusiness.Get(claimData.UserId, claimData.GroupId);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#26
0
 public HttpResponseMessage SaveAction(NotificationAction entity)
 {
     try
     {
         NotificationBusiness.Action(filterActionUser.UserId, entity);
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#27
0
 /// <summary>
 /// 删除该条信息
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnDelete_Click(object sender, EventArgs e)
 {
     storeUnit.DeleteStoreStruct(cmbDel.SelectedItem.ToString(), txtRowNumber.Text, txtColumnNumber.Text, txtLayerNumber.Text);
     if (cmbDel.SelectedItem.ToString() != "全部删除")
     {
         LogBusiness.RecordLog("管理员", string.Format("将库位{0}-{1}-{2}删除", txtRowNumber.Text, txtColumnNumber.Text, txtLayerNumber.Text), "删除库位");
     }
     else
     {
         LogBusiness.RecordLog("管理员", "将仓库所有库位全部删除", "删除全部库位");
     }
     MessageBox.Show("删除成功,重启系统以后生效", "提示!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
 }
示例#28
0
 public HttpResponseMessage Get(string calendarYear)
 {
     try
     {
         var result = CourseBusiness.Get(calendarYear);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#29
0
 public HttpResponseMessage Get()
 {
     try
     {
         var result = LogBusiness.Get(filterActionPaginate.Page, filterActionPaginate.Size);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#30
0
 public HttpResponseMessage GetById(Guid id)
 {
     try
     {
         var result = LogBusiness.GetById(id);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#31
0
 public HttpResponseMessage Get(string calendarYear, [ModelBinder(typeof(Ints))] IEnumerable <int> courseId = null)
 {
     try
     {
         var result = CoursePeriodBusiness.Get(calendarYear, courseId);
         return(Request.CreateResponse(HttpStatusCode.OK, result));
     }
     catch (Exception exc)
     {
         var logId = LogBusiness.Error(exc);
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, new ErrorModel(logId)));
     }
 }
示例#32
0
        public MA_USER CreateUser(SessionInfo sessioninfo, MA_USER user)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USERRepository.GetByUserCode(user.USERCODE);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
                LogBusiness logBusiness = new LogBusiness();
                unitOfWork.DA_LOGGINGRepository.Add(logBusiness.CreateLogging(sessioninfo, user.ID, LogEvent.USER_AUDIT.ToString(), LookupFactorTables.MA_USER, "User", new { }));
                unitOfWork.MA_USERRepository.Add(user);
                unitOfWork.Commit();
            }

            return user;
        }
示例#33
0
        public MA_INSTRUMENT Create(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), "Label is duplicated");
                if (product == ProductCode.BOND)
                {
                    LogBusiness logBusiness = new LogBusiness();
                    unitOfWork.DA_LOGGINGRepository.Add(logBusiness.CreateLogging(sessioninfo, instrument.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, "BOND", new { }));
                }
                unitOfWork.MA_INSTRUMENTRepository.Add(instrument);
                unitOfWork.Commit();
            }

            return instrument;
        }
示例#34
0
        public MA_COUNTRY_LIMIT UpdateCountryLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT countryLimit)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (countryLimit.EXPIRY_DATE < sessioninfo.Process.CurrentDate)
                    throw this.CreateException(new Exception(), "Expiry date cannot be set to past date.");

                var foundData = unitOfWork.MA_COUNTRY_LIMITRepository.All().FirstOrDefault(p => p.ID == countryLimit.ID);
                if (foundData == null)
                    throw this.CreateException(new Exception(), "Data not found!");
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var oldRecord = new { AMOUNT = foundData.AMOUNT.ToString("#,##0"), EXPIRE_DATE = foundData.EXPIRY_DATE };
                    var newRecord = new { AMOUNT = countryLimit.AMOUNT.ToString("#,##0"), EXPIRE_DATE = countryLimit.EXPIRY_DATE };
                    var log = logBusiness.UpdateLogging(sessioninfo, foundData.COUNTRY_ID, LimitLogEvent.COUNTRY_LIMIY_AUDIT.ToString(), LookupFactorTables.MA_COUNTRY, oldRecord, newRecord, "Country Limit");
                    if (log != null) unitOfWork.DA_LOGGINGRepository.Add(log);

                    foundData.AMOUNT = countryLimit.AMOUNT;
                    foundData.FLAG_CONTROL = countryLimit.FLAG_CONTROL;
                    foundData.EXPIRY_DATE = countryLimit.EXPIRY_DATE;
                    foundData.LOG.MODIFYBYUSERID = countryLimit.LOG.MODIFYBYUSERID;
                    foundData.LOG.MODIFYDATE = countryLimit.LOG.MODIFYDATE;

                    unitOfWork.Commit();
                }
            }

            return countryLimit;
        }
示例#35
0
        public MA_INSTRUMENT Update(SessionInfo sessioninfo, MA_INSTRUMENT instrument, ProductCode product)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_INSTRUMENTRepository.GetAllByProductCode(product.ToString()).FirstOrDefault(p => p.LABEL == instrument.LABEL && p.ID != instrument.ID);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), "Label is duplicated");
                var foundData = unitOfWork.MA_INSTRUMENTRepository.GetAll().FirstOrDefault(p => p.ID == instrument.ID);
                if (foundData == null)
                    throw this.CreateException(new Exception(), "Data not found!");
                else
                {
                    if (product == ProductCode.BOND)
                    {
                        LogBusiness logBusiness = new LogBusiness();
                        var oldRecord = new
                        {
                                    ISACTIVE = foundData.ISACTIVE,
                                    CAL_METHOD = foundData.CAL_METHOD,
                                    COUPON = foundData.COUPON,
                                    COUPON_FREQ_TYPE = foundData.MA_FREQ_TYPE!= null ?foundData.MA_PRODUCT.LABEL:string.Empty,
                                    FLAG_FIXED = foundData.FLAG_FIXED,
                                    INS_MKT = foundData.INS_MKT,
                                    ISSUER = foundData.ISSUER,
                                    LABEL = foundData.LABEL,
                                    LOT_SIZE = foundData.LOT_SIZE,
                                    MATURITY_DATE = foundData.MATURITY_DATE,
                                    PRODUCT = foundData.MA_PRODUCT!= null ? foundData.MA_PRODUCT.LABEL:string.Empty,
                                    CURRENCY = foundData.MA_CURRENCY != null ? foundData.MA_CURRENCY.LABEL:string.Empty
                        };
                        var newRecord = new
                        {
                                    ISACTIVE = instrument.ISACTIVE,
                                    CAL_METHOD = instrument.CAL_METHOD,
                                    COUPON = instrument.COUPON,
                                    COUPON_FREQ_TYPE =unitOfWork.MA_FREQ_TYPERepository.All().FirstOrDefault(f=>f.ID==instrument.COUPON_FREQ_TYPE_ID).LABEL,
                                    FLAG_FIXED = instrument.FLAG_FIXED,
                                    INS_MKT = instrument.INS_MKT,
                                    ISSUER = instrument.ISSUER,
                                    LABEL = instrument.LABEL,
                                    LOT_SIZE = instrument.LOT_SIZE,
                                    MATURITY_DATE = instrument.MATURITY_DATE,
                                    PRODUCT = unitOfWork.MA_PRODUCTRepository.All().FirstOrDefault(p => p.ID == instrument.PRODUCT_ID).LABEL,
                                    CURRENCY = unitOfWork.MA_CURRENCYRepository.All().FirstOrDefault(c => c.ID == instrument.CURRENCY_ID1).LABEL,
                        };
                        var log = logBusiness.UpdateLogging(sessioninfo, foundData.ID, LogEvent.INSTRUMENT_AUDIT.ToString(), LookupFactorTables.MA_INSTRUMENT, oldRecord, newRecord);
                        if (log != null) unitOfWork.DA_LOGGINGRepository.Add(log);
                    }
                    foundData.ID = instrument.ID;
                    foundData.ISACTIVE = instrument.ISACTIVE;
                    foundData.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
                    foundData.LOG.MODIFYDATE = DateTime.Now;
                    foundData.CAL_METHOD = instrument.CAL_METHOD;
                    foundData.COUPON = instrument.COUPON;
                    foundData.COUPON_FREQ_TYPE_ID = instrument.COUPON_FREQ_TYPE_ID;
                    foundData.FLAG_FIXED = instrument.FLAG_FIXED;
                    foundData.INS_MKT = instrument.INS_MKT;
                    foundData.ISSUER = instrument.ISSUER;
                    foundData.LABEL = instrument.LABEL;
                    foundData.LOT_SIZE = instrument.LOT_SIZE;
                    foundData.MATURITY_DATE = instrument.MATURITY_DATE;
                    foundData.PRODUCT_ID = instrument.PRODUCT_ID;
                    foundData.CURRENCY_ID1 = instrument.CURRENCY_ID1;
                    foundData.CURRENCY_ID2 = instrument.CURRENCY_ID2;
                    unitOfWork.Commit();

                }
            }

            return instrument;
        }
示例#36
0
        public MA_USER UpdateUser(SessionInfo sessioninfo, MA_USER user)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USERRepository.GetAll().FirstOrDefault(p => p.USERCODE.ToLower() == user.USERCODE.ToLower() && p.ID != user.ID);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);

                var foundUser = unitOfWork.MA_USERRepository.GetAll().FirstOrDefault(p => p.ID == user.ID);
                if (foundUser == null)
                    throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND);
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var oldRecord = new {

                        DEPARTMENT = foundUser.DEPARTMENT, ISACTIVE = foundUser.ISACTIVE
                        , ISLOCKED = foundUser.ISLOCKED, NAME = foundUser.NAME
                        , USERCODE = foundUser.USERCODE, USER_OPICS = foundUser.USER_OPICS
                        , USER_PROFILE = foundUser.MA_USER_PROFILE.LABEL
                    };
                    var newRecord = new
                    {
                        DEPARTMENT = user.DEPARTMENT, ISACTIVE = user.ISACTIVE
                        , ISLOCKED = user.ISLOCKED, NAME = user.NAME
                        , USERCODE = user.USERCODE, USER_OPICS = user.USER_OPICS
                        , USER_PROFILE = unitOfWork.MA_USER_PROFILERepository.All().FirstOrDefault(p=> p.ID== user.USER_PROFILE_ID).LABEL
                    };

                    var log = logBusiness.UpdateLogging(sessioninfo, foundUser.ID, LogEvent.USER_AUDIT.ToString(), LookupFactorTables.MA_USER, oldRecord, newRecord);
                    if (log != null) unitOfWork.DA_LOGGINGRepository.Add(log);
                    foundUser.ID = user.ID;
                    foundUser.DEPARTMENT = user.DEPARTMENT;
                    foundUser.ISACTIVE = user.ISACTIVE;
                    foundUser.ISLOCKED = user.ISLOCKED;
                    foundUser.LOG.MODIFYBYUSERID = user.LOG.MODIFYBYUSERID;
                    foundUser.LOG.MODIFYDATE = user.LOG.MODIFYDATE;
                    foundUser.NAME = user.NAME;
                    foundUser.USERCODE = user.USERCODE;
                    foundUser.USER_OPICS = user.USER_OPICS;
                    foundUser.USER_PROFILE_ID = user.USER_PROFILE_ID;

                    unitOfWork.Commit();

                }
            }

            return user;
        }
示例#37
0
        public List<LimitAuditReportModel> GetLimitAuditReport(SessionInfo sessionInfo, string strLogDatefrom, string strLogDateto, string strCtpy, string strCountry, string strEvent)
        {
            try
            {
                DateTime dteReportfrom;
                DateTime dteReportto;
                Guid guCtpyID = Guid.Empty;
                Guid guCountryID = Guid.Empty;
                LogBusiness _logBusiness = new LogBusiness();
                CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
                CountryBusiness _countryBusiness = new CountryBusiness();
                UserBusiness _userBusiness = new UserBusiness();

                var log = _logBusiness.GetLogAll().Where(l => l.EVENT == LimitLogEvent.LIMIT_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.TEMP_LIMIT_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.COUNTRY_LIMIY_AUDIT.ToString()
                                                        || l.EVENT == LimitLogEvent.TEMP_COUNTRY_LIMIT_AUDIT.ToString()).AsQueryable();

                var ctpyLimit = _counterpartyBusiness.GetCounterpartyLimitAll().AsQueryable();
                var ctpys = _counterpartyBusiness.GetCounterpartyAll().AsQueryable();
                var countrys = _countryBusiness.GetCountryAll().AsQueryable();
                var users = _userBusiness.GetAll().AsQueryable();

                if (String.IsNullOrEmpty(strLogDatefrom))
                    throw this.CreateException(new Exception(), "Please input start log date.");
                else if (!DateTime.TryParseExact(strLogDatefrom, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReportfrom))
                    throw this.CreateException(new Exception(), "Invalid start log date.");
                else
                    dteReportfrom = DateTime.ParseExact(strLogDatefrom, "dd/MM/yyyy", null);

                if (String.IsNullOrEmpty(strLogDateto))
                    throw this.CreateException(new Exception(), "Please input end log date.");
                else if (!DateTime.TryParseExact(strLogDateto, "dd/MM/yyyy", null, DateTimeStyles.None, out dteReportto))
                    throw this.CreateException(new Exception(), "Invalid end log date.");
                else
                    dteReportto = DateTime.ParseExact(strLogDateto, "dd/MM/yyyy", null);
                if (dteReportto < dteReportfrom) throw this.CreateException(new Exception(), "Start log date must before end log date.");

                var limits = from limit in ctpyLimit
                             join ctpy in ctpys on limit.CTPY_ID equals ctpy.ID
                             select new
                             {
                                 LIMIT_ID = limit.ID,
                                 CTPY_ID = ctpy.ID,
                                 SNAME = ctpy.SNAME,
                                 LIMIT = limit.MA_LIMIT.LABEL
                             };

                log = log.Where(l => l.LOG_DATE.Date >= dteReportfrom.Date && l.LOG_DATE.Date <= dteReportto.Date);

                if (strEvent != "-1")
                    log = log.Where(p => p.EVENT == strEvent);

                var limitAudits = from l in log
                                  join user in users on l.LOG.INSERTBYUSERID equals user.ID
                                  join c in limits on l.RECORD_ID equals c.LIMIT_ID into templimit
                                  from sublimit in templimit.DefaultIfEmpty()
                                  join country in countrys on l.RECORD_ID equals country.ID into tempcountry
                                  from subcountry in tempcountry.DefaultIfEmpty()
                                  orderby l.LOG_DATE
                                  select new LimitAuditReportModel
                                  {
                                      ENTITY = sublimit != null ? sublimit.SNAME : subcountry != null ? subcountry.LABEL : "",
                                      ENTITY_ID = sublimit != null ? sublimit.CTPY_ID : (subcountry != null ? subcountry.ID : Guid.Empty),
                                      LIMIT = (l.EVENT.Contains("TEMP") ? "TEMP-" : "") + (sublimit != null ? sublimit.LIMIT : "COUNTRY-LIMIT"), //sublimit != null ? sublimit.LIMIT : "Country Limit",
                                      USER = user.USERCODE,
                                      LOG_DATE = l.LOG_DATE,
                                      LOG_DATE_STR = l.LOG_DATE.ToString("dd-MMM-yyyy HH:mm"),
                                      DETAIL = l.LOG_DETAIL
                                  };

                if (Guid.TryParse(strCtpy, out guCtpyID))
                {
                    guCtpyID = Guid.Parse(strCtpy);
                    limitAudits = limitAudits.Where(p => p.ENTITY_ID == guCtpyID);
                }

                if (Guid.TryParse(strCountry, out guCountryID))
                {
                    guCountryID = Guid.Parse(strCountry);
                    limitAudits = limitAudits.Where(t => t.ENTITY_ID == guCountryID);
                }

                return limitAudits.ToList();
            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
示例#38
0
        public MA_COUNTRY_LIMIT UpdateTempCountryLimit(SessionInfo sessioninfo, MA_COUNTRY_LIMIT countryLimit)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (countryLimit.EFFECTIVE_DATE < sessioninfo.Process.CurrentDate)
                    throw this.CreateException(new Exception(), "Effective date cannot be set to past date.");

                if (countryLimit.EXPIRY_DATE < sessioninfo.Process.CurrentDate)
                    throw this.CreateException(new Exception(), "Expiry date cannot be set to past date.");

                if (countryLimit.EXPIRY_DATE <= countryLimit.EFFECTIVE_DATE)
                    throw this.CreateException(new Exception(), "Expiry date must be after effective date.");

                var duplicate = unitOfWork.MA_COUNTRY_LIMITRepository.All().FirstOrDefault(p => p.ID != countryLimit.ID && p.ISTEMP == true && p.ISACTIVE == true
                                                                                                && p.COUNTRY_ID == countryLimit.COUNTRY_ID && p.EXPIRY_DATE >= countryLimit.EFFECTIVE_DATE);
                if (duplicate != null)
                    throw this.CreateException(new Exception(), "Duplicate temp limit info");

                var foundData = unitOfWork.MA_COUNTRY_LIMITRepository.All().FirstOrDefault(p => p.ID == countryLimit.ID);
                if (foundData == null)
                    throw this.CreateException(new Exception(), "Data not found!");
                else
                {
                    LogBusiness logBusiness = new LogBusiness();
                    var oldRecord = new { AMOUNT = foundData.AMOUNT.ToString("#,##0"), EFFECTIVE_DATE = foundData.EFFECTIVE_DATE, EXPIRE_DATE = foundData.EXPIRY_DATE, ISACTIVE = foundData.ISACTIVE };
                    var newRecord = new { AMOUNT = countryLimit.AMOUNT.ToString("#,##0"), EFFECTIVE_DATE = countryLimit.EFFECTIVE_DATE, EXPIRE_DATE = countryLimit.EXPIRY_DATE, ISACTIVE = countryLimit.ISACTIVE };
                    var log = logBusiness.UpdateLogging(sessioninfo, foundData.COUNTRY_ID, LimitLogEvent.TEMP_COUNTRY_LIMIT_AUDIT.ToString(), LookupFactorTables.MA_COUNTRY_LIMIT, oldRecord, newRecord, "Temp Country Limit");
                    if (log != null) unitOfWork.DA_LOGGINGRepository.Add(log);

                    foundData.AMOUNT = countryLimit.AMOUNT;
                    foundData.ISACTIVE = countryLimit.ISACTIVE;
                    foundData.EFFECTIVE_DATE = countryLimit.EFFECTIVE_DATE;
                    foundData.EXPIRY_DATE = countryLimit.EXPIRY_DATE;
                    foundData.LOG.MODIFYBYUSERID = countryLimit.LOG.MODIFYBYUSERID;
                    foundData.LOG.MODIFYDATE = countryLimit.LOG.MODIFYDATE;

                    unitOfWork.Commit();
                }
            }

            return countryLimit;
        }