当前位置: 首页>>代码示例>>C#>>正文


C# Common.SessionInfo类代码示例

本文整理汇总了C#中KK.DealMaker.Core.Common.SessionInfo的典型用法代码示例。如果您正苦于以下问题:C# SessionInfo类的具体用法?C# SessionInfo怎么用?C# SessionInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionInfo类属于KK.DealMaker.Core.Common命名空间,在下文中一共展示了SessionInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public static object Create(SessionInfo sessioninfo, MA_USER record, int intCheckAD)
        {
            try
            {
                UserBusiness _userBusiness = new UserBusiness();
                if (intCheckAD == 1)
                {
                    bool validUser = LDAPHelper.UserExists(record.USERCODE);
                    if (!validUser)
                        return new { Result = "ERROR", Message = "User is not exist."};
                }

                record.ID = Guid.NewGuid();
                record.DEPARTMENT = record.DEPARTMENT.ToUpper();
                record.NAME = record.NAME.ToUpper();
                record.USER_OPICS = record.USER_OPICS.ToUpper();
                record.USERCODE = record.USERCODE.ToUpper();
                record.ISACTIVE = record.ISACTIVE == null || !record.ISACTIVE.HasValue ? false : true;
                record.ISLOCKED = record.ISLOCKED == null || !record.ISACTIVE.HasValue ? false : true;
                record.LOG.INSERTDATE = DateTime.Now;
                record.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                var addedStudent = _userBusiness.CreateUser(sessioninfo, record);
                return new { Result = "OK", Record = addedStudent };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:29,代码来源:UserUIP.cs

示例2: UpdateLimitProduct

        public MA_LIMIT_PRODUCT UpdateLimitProduct(SessionInfo sessioninfo, MA_LIMIT_PRODUCT limitproduct)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_LIMIT_PRODUCTRepository.GetAll().FirstOrDefault(p => p.LIMIT_ID == limitproduct.LIMIT_ID & p.PRODUCT_ID == limitproduct.PRODUCT_ID && p.ID != limitproduct.ID);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);

                var foundlimitproduct = unitOfWork.MA_LIMIT_PRODUCTRepository.All().FirstOrDefault(p => p.ID == limitproduct.ID);
                if (foundlimitproduct == null)
                    throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND);
                else
                {

                    foundlimitproduct.ID = limitproduct.ID;
                    foundlimitproduct.LIMIT_ID = limitproduct.LIMIT_ID;
                    foundlimitproduct.MA_LIMIT = limitproduct.MA_LIMIT;
                    foundlimitproduct.MA_PRODUCT = limitproduct.MA_PRODUCT;
                    foundlimitproduct.PRODUCT_ID = limitproduct.PRODUCT_ID;

                    unitOfWork.Commit();

                }
            }

            return limitproduct;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:27,代码来源:LimitProductBusiness.cs

示例3: UpdateUserProfile

        public MA_USER_PROFILE UpdateUserProfile(SessionInfo sessioninfo, MA_USER_PROFILE userprofile)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_USER_PROFILERepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(userprofile.LABEL.ToLower()) && p.ID != userprofile.ID);
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), "Profile is duplicated");

                var founduserprofile = unitOfWork.MA_USER_PROFILERepository.All().FirstOrDefault(p => p.ID == userprofile.ID);
                if (founduserprofile == null)
                    throw this.CreateException(new Exception(), "Data not found!");
                else
                {

                    founduserprofile.ID = userprofile.ID;
                    founduserprofile.LABEL = userprofile.LABEL;
                    founduserprofile.ISACTIVE = userprofile.ISACTIVE;

                    unitOfWork.Commit();

                }
            }

            return userprofile;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:25,代码来源:ProfileBusiness.cs

示例4: GetByID

        public MA_INSTRUMENT GetByID(SessionInfo sessioninfo, Guid guID)
        {
            try
            {
                MA_INSTRUMENT instrument = null;
                using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
                {
                    instrument = unitOfWork.MA_INSTRUMENTRepository.GetByID(guID);
                }

                //if (instruments.Count == 1)
                //{
                //    return instruments[0];
                //}
                //else
                //{
                //    throw this.CreateException(new Exception() , "Found multiple instruments with label " + strLabel);
                //}
                return instrument;
            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:25,代码来源:InstrumentBusiness.cs

示例5: SessionInfoToString

        /// <summary>
        /// Sessions the info to string.
        /// </summary>
        /// <param name="sessionInfo">The session info.</param>
        /// <returns></returns>
        public static string SessionInfoToString(SessionInfo sessionInfo)
        {
            if (sessionInfo == null)
                return null;

            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);

            XmlSerializer xml = new XmlSerializer(typeof(SessionInfo));
            xml.Serialize(sw, sessionInfo);
            sw.Flush();

            CryptoString cry = new CryptoString(_key, CryptoString.Method.Encrypt, sb.ToString());
            string ret = cry.Execute();
            sb.Remove(0, sb.Length);
            if (Regex.IsMatch(ret, @".*[Oo][Nn][a-zA-Z]*=*$"))
            {
                sessionInfo.ConnectionString += ';';
                xml.Serialize(sw, sessionInfo);
                sw.Flush();
                cry = new CryptoString(_key, CryptoString.Method.Encrypt, sb.ToString());
                ret = cry.Execute();
            }

            sw.Close();
            return ret;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:32,代码来源:SessionInfoSerializer.cs

示例6: Create

        public MA_COUNTRY Create(SessionInfo sessioninfo, MA_COUNTRY country)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate1 = unitOfWork.MA_COUNTRYRepository.All().FirstOrDefault(p => p.LABEL == country.LABEL);
                if (checkDuplicate1 != null)
                    throw this.CreateException(new Exception(), "Short name is duplicated");

                //Prepare Country-Limit data
                MA_COUNTRY_LIMIT ctLimit = new MA_COUNTRY_LIMIT();

                ctLimit.ID = Guid.NewGuid();
                ctLimit.COUNTRY_ID = country.ID;
                ctLimit.AMOUNT = 0;
                ctLimit.EFFECTIVE_DATE = sessioninfo.Process.CurrentDate;
                ctLimit.EXPIRY_DATE = sessioninfo.Process.CurrentDate;
                ctLimit.ISACTIVE = true;
                ctLimit.ISTEMP = false;
                ctLimit.FLAG_CONTROL = true;
                ctLimit.LOG.INSERTDATE = DateTime.Now;
                ctLimit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;

                unitOfWork.MA_COUNTRYRepository.Add(country);
                unitOfWork.MA_COUNTRY_LIMITRepository.Add(ctLimit);
                unitOfWork.Commit();
            }

            return country;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:29,代码来源:CountryBusiness.cs

示例7: CancelDeal

 public DA_TRN CancelDeal(SessionInfo sessioninfo, DA_TRN trn)
 {
     LookupBusiness _lookupBusiness = new LookupBusiness();
     using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
     {
         var foundTrn = unitOfWork.DA_TRNRepository.GetById(trn.ID,true);
         if (foundTrn == null)
             throw this.CreateException(new Exception(), "Data not found!");
         else if (!Guid.Equals(foundTrn.LOG.INSERTBYUSERID, sessioninfo.CurrentUserId))
         {
             throw this.CreateException(new Exception(), "You have no right to cancel this transaction");
         }
         else if (!(foundTrn.ENGINE_DATE.Date == sessioninfo.Process.CurrentDate && foundTrn.SOURCE == "INT"))
         {
             throw this.CreateException(new Exception(), "You cannot cancel the past deals");
         }
         else
         {
             //foundTrn.STATUS_ID = new Guid("1ccd7506-b98c-4afa-838e-24378d9b3c2e");
             foundTrn.REMARK = trn.REMARK;
             foundTrn.STATUS_ID = _lookupBusiness.GetStatusAll().FirstOrDefault(p => p.LABEL == StatusCode.CANCELLED.ToString()).ID;
             foundTrn.LOG.MODIFYBYUSERID = sessioninfo.CurrentUserId;
             foundTrn.LOG.MODIFYDATE = DateTime.Now;
             trn = foundTrn;
             unitOfWork.Commit();
         }
     }
     return trn;
 }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:29,代码来源:DealBusiness.cs

示例8: GetDealViewExport

 public static List<DealViewModel> GetDealViewExport(SessionInfo sessioninfo
                                             , string strDMKNo
                                             , string strOPICNo
                                             , string strProduct
                                             , string strCtpy
                                             , string strPortfolio
                                             , string strTradeDate
                                             , string strEffDate
                                             , string strMatDate
                                             , string strInstrument
                                             , string strUser
                                             , string strStatus
                                             , string strOverStatus
                                             , string strProcDate
                                             , string strSettleStatus)
 {
     return View.DealViewUIP.GetDealInquiryData(sessioninfo
                                                 , strDMKNo
                                                 , strOPICNo
                                                 , strProduct
                                                 , strCtpy
                                                 , strPortfolio
                                                 , strTradeDate
                                                 , strEffDate
                                                 , strMatDate
                                                 , strInstrument
                                                 , strUser
                                                 , strStatus
                                                 , strOverStatus
                                                 , strProcDate
                                                 , strSettleStatus).AsQueryable().OrderBy(t => t.DMK_NO).ThenBy(t => t.EntryDate).ToList();
 }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:32,代码来源:ReportUIP.cs

示例9: TraceAuditLoginUser

        public void TraceAuditLoginUser(SessionInfo sessioninfo)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {

                List<DA_LOGIN_AUDIT> foundaudits = unitOfWork.DA_LOGIN_AUDITRepository.GetByUserID(sessioninfo.CurrentUserId);
                if (foundaudits.Count > 0)
                {
                    foreach (DA_LOGIN_AUDIT foundaudit in foundaudits.Where(p => !p.LOGOUT_DATE.HasValue))
                    {
                        foundaudit.LOGOUT_DATE = DateTime.Now;
                        foundaudit.RESULT = String.Format("Logout the system on {0}, because someone use this user to login the system from another machine or computer place.", DateTime.Now.ToString());
                    }
                }
                DA_LOGIN_AUDIT audit = new DA_LOGIN_AUDIT();
                audit.ID = sessioninfo.ID;
                audit.LOG.INSERTBYUSERID = sessioninfo.CurrentUserId;
                audit.LOG.INSERTDATE = DateTime.Now;
                audit.LOGON_DATE = DateTime.Now;
                audit.RESULT = "Logon System";
                audit.TERMINAL = sessioninfo.IPAddress;
                audit.USER_ID = sessioninfo.CurrentUserId;
                unitOfWork.DA_LOGIN_AUDITRepository.Add(audit);
                unitOfWork.Commit();
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:26,代码来源:AuditBusiness.cs

示例10: GetBondsByFilter

        public List<MA_INSTRUMENT> GetBondsByFilter(SessionInfo sessioninfo, string label, string sorting)
        {
            try
            {
                IEnumerable<MA_INSTRUMENT> sortedRecords;
                using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
                {
                    var query = unitOfWork.MA_INSTRUMENTRepository.GetAll().Where(p => p.MA_PRODUCT.LABEL.Equals(ProductCode.BOND.ToString())).AsQueryable();
                    //Filters
                    if (!string.IsNullOrEmpty(label))
                    {
                        query = query.Where(p => p.LABEL.IndexOf(label, StringComparison.OrdinalIgnoreCase) >= 0);
                    }

                    //Sorting
                    string[] sortsp = sorting.Split(' ');
                    IQueryable<MA_INSTRUMENT> orderedRecords = query.OrderBy(sortsp[0], sortsp[1]);
                    sortedRecords = orderedRecords.ToList();
                }
                //Return result to jTable
                return sortedRecords.ToList();

            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:28,代码来源:InstrumentBusiness.cs

示例11: GetLimitProductByFilter

        public List<MA_LIMIT_PRODUCT> GetLimitProductByFilter(SessionInfo sessioninfo,string strproduct,string strlimit, string sorting)
        {
            try
            {
                IEnumerable<MA_LIMIT_PRODUCT> sortedRecords;
                using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
                {
                    var query = unitOfWork.MA_LIMIT_PRODUCTRepository.GetAll().AsQueryable();
                    Guid guTemp;

                    //Filters
                    if (Guid.TryParse(strproduct, out guTemp)) //Function
                    {
                        query = query.Where(p => p.PRODUCT_ID == Guid.Parse(strproduct));
                    }
                    if (Guid.TryParse(strlimit, out guTemp)) //profile
                    {
                        query = query.Where(p => p.LIMIT_ID == Guid.Parse(strlimit));
                    }

                    //Sorting
                    string[] sortsp = sorting.Split(' ');
                    IQueryable<MA_LIMIT_PRODUCT> orderedRecords = query.OrderBy(sortsp[0], sortsp[1]);
                    sortedRecords = orderedRecords.ToList();
                }
                //Return result to jTable
                return sortedRecords.ToList();

            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:34,代码来源:LimitProductBusiness.cs

示例12: CreateTempLimit

        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;
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:28,代码来源:CountryBusiness.cs

示例13: GetProfileFunctionByFilter

        public List<MA_PROFILE_FUNCTIONAL> GetProfileFunctionByFilter(SessionInfo sessioninfo,string strprofile,string strfunction,string sorting)
        {
            try
            {
                IEnumerable<MA_PROFILE_FUNCTIONAL> sortedRecords;
                using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
                {
                    var query = unitOfWork.MA_PROFILE_FUNCTIONALRepository.GetAll().AsQueryable();
                    Guid guTemp;

                    //Filters
                    if (Guid.TryParse(strfunction, out guTemp)) //Function
                    {
                        query = query.Where(p => p.FUNCTIONAL_ID == Guid.Parse(strfunction));
                    }
                    if (Guid.TryParse(strprofile, out guTemp)) //profile
                    {
                        query = query.Where(p => p.USER_PROFILE_ID == Guid.Parse(strprofile));
                    }

                    //Sorting
                    string[] sortsp = sorting.Split(' ');
                    IQueryable<MA_PROFILE_FUNCTIONAL> orderedRecords = query.OrderBy(sortsp[0], sortsp[1]);
                    sortedRecords = orderedRecords.ToList();
                }

                return sortedRecords.ToList();

            }
            catch (DataServicesException ex)
            {
                throw this.CreateException(ex, null);
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:34,代码来源:UserProfileFunctionBusiness.cs

示例14: GetByFilter

        public static object GetByFilter(SessionInfo sessioninfo, string label, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                CountryBusiness _countryBusiness = new CountryBusiness();
                //Get data from database
                List<MA_COUNTRY> countries = _countryBusiness.GetByFilter(sessioninfo, label, jtSorting);

                //Return result to jTable
                return new
                {
                    Result = "OK",
                    Records = jtPageSize > 0 ? countries.Skip(jtStartIndex).Take(jtPageSize).ToList() : countries,
                    TotalRecordCount = countries.Count
                };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:25,代码来源:CountryUIP.cs

示例15: GetBondsByFilter

        public static object GetBondsByFilter(SessionInfo sessioninfo, string label, int jtStartIndex, int jtPageSize, string jtSorting)
        {
            try
            {
                InstrumentBusiness _instrumentBusiness = new InstrumentBusiness();
                //Get data from database
                List<MA_INSTRUMENT> ins = _instrumentBusiness.GetBondsByFilter(sessioninfo, label, jtSorting);

                //Return result to jTable
                return new
                {
                    Result = "OK",
                    Records = jtPageSize > 0 ? ins.Skip(jtStartIndex).Take(jtPageSize).ToList() : ins,
                    TotalRecordCount = ins.Count
                };
            }
            catch (BusinessWorkflowsException bex)
            {
                return new { Result = "ERROR", Message = bex.Message };
            }
            catch (Exception ex)
            {
                return new { Result = "ERROR", Message = ex.Message };
            }
        }
开发者ID:Theeranit,项目名称:DealMarker,代码行数:25,代码来源:InstrumentUIP.cs


注:本文中的KK.DealMaker.Core.Common.SessionInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。