Exemplo n.º 1
0
        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 };
            }
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
            }
        }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
        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;
        }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 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();
 }
Exemplo n.º 9
0
        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();
            }
        }
Exemplo n.º 10
0
        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);
            }
        }
Exemplo n.º 11
0
        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);
            }
        }
Exemplo n.º 12
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;
        }
        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);
            }
        }
Exemplo n.º 14
0
        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 };
            }
        }
Exemplo n.º 15
0
        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 };
            }
        }
Exemplo n.º 16
0
        public List<MA_USER_PROFILE> GetProfileByFilter(SessionInfo sessioninfo, string name, string sorting)
        {
            try
            {
                //IEnumerable<MA_USER> query;
                IEnumerable<MA_USER_PROFILE> sortedRecords;
                using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
                {
                    var query = unitOfWork.MA_USER_PROFILERepository.GetAll().AsQueryable();

                    //Filters
                    if (!string.IsNullOrEmpty(name))
                    {
                        query = query.Where(p => p.LABEL.IndexOf(name, StringComparison.OrdinalIgnoreCase) >= 0);
                    }
                    //Sorting
                    string[] sortsp = sorting.Split(' ');
                    IQueryable<MA_USER_PROFILE> 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);
            }
        }
Exemplo n.º 17
0
 public DA_LOGIN_AUDIT GetUserLogged(SessionInfo sessioninfo)
 {
     using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
     {
         //return unitOfWork.DA_LOGIN_AUDITRepository.GetBySessionInfo(sessioninfo);
         return unitOfWork.DA_LOGIN_AUDITRepository.GetByID(sessioninfo.ID);
     }
 }
Exemplo n.º 18
0
 public void DeleteUser(SessionInfo sessioninfo, Guid ID)
 {
     using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
     {
         var foundUser = unitOfWork.MA_USERRepository.All().FirstOrDefault(p => p.ID == ID);
         unitOfWork.MA_USERRepository.Delete(foundUser);
         unitOfWork.Commit();
     }
 }
Exemplo n.º 19
0
        public static List<LimitAuditReportModel> GetLimitAuditExport(SessionInfo sessioninfo, string strLogDatefrom, string strLogDateto, string strCtpy, string strCountry, string strEvent)
        {
            ReportBusiness _reportBusiness = new ReportBusiness();
            CounterpartyBusiness _counterpartyBusiness = new CounterpartyBusiness();
            LookupBusiness _lookupBusiness = new LookupBusiness();
            UserBusiness _userBusiness = new UserBusiness();
            List<LimitAuditReportModel> logs = _reportBusiness.GetLimitAuditReport(sessioninfo, strLogDatefrom, strLogDateto, strCtpy, strCountry, strEvent);

               return logs;
        }
Exemplo n.º 20
0
        public void ImportCashflows(SessionInfo sessioninfo, List<DA_TRN_CASHFLOW> cashflows)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                foreach (DA_TRN_CASHFLOW cashflow in cashflows)
                {
                    unitOfWork.DA_TRN_CASHFLOWRepository.Add(cashflow);
                }

                unitOfWork.Commit();
            }
        }
Exemplo n.º 21
0
 public static object Delete(SessionInfo sessioninfo, Guid ID)
 {
     try
     {
         UserBusiness _userBusiness = new UserBusiness();
         _userBusiness.DeleteUser(sessioninfo, ID);
         return new { Result = "OK" };
     }
     catch (Exception ex)
     {
         return new { Result = "ERROR", Message = ex.Message };
     }
 }
Exemplo n.º 22
0
        public MA_PCCF CreatePCCF(SessionInfo sessioninfo, MA_PCCF pccf)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_PCCFRepository.GetAll().FirstOrDefault(p => p.LABEL.ToLower().Equals(pccf.LABEL.ToLower()));
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);

                unitOfWork.MA_PCCFRepository.Add(pccf);
                unitOfWork.Commit();
            }

            return pccf;
        }
Exemplo n.º 23
0
 public static object GetPCCFFXSpotByLabel(SessionInfo sessioninfo, string CCYPairLabel)
 {
     StaticDataBusiness _staticBusiness = new StaticDataBusiness();
     LookupBusiness _lookupBusiness = new LookupBusiness();
     var productID = _lookupBusiness.GetProductAll().FirstOrDefault(p => p.LABEL.Replace(" ", string.Empty) == ProductCode.FXSPOT.ToString()).ID;
     MA_PCCF pccf = _staticBusiness.GetPCCFByLabelProduct(sessioninfo, CCYPairLabel, productID);
     if (pccf != null)
     {
         return null;// new { CURRENCY1 = pccf.MA_CURRENCY1.LABEL, CURRENCY2 = pccf.MA_CURRENCY2.LABEL, CURRENCYID1 = pccf.MA_CURRENCY1.ID, CURRENCYID2 = pccf.MA_CURRENCY2.ID, FLAG_MULTIPLY = pccf.FLAG_MULTIPLY };
     }
     else {
         throw new Exception("Invalid currency pair.");
     }
 }
Exemplo n.º 24
0
        public MA_FUNCTIONAL CreateFunction(SessionInfo sessioninfo, MA_FUNCTIONAL function)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                var checkDuplicate = unitOfWork.MA_FUNCTIONALRepository.GetAll().FirstOrDefault(p => p.USERCODE.ToLower().Equals(function.USERCODE.ToLower()));
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);

                unitOfWork.MA_FUNCTIONALRepository.Add(function);
                unitOfWork.Commit();
            }

            return function;
        }
Exemplo n.º 25
0
        public MA_USER_PROFILE CreateUserProfile(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()));
                if (checkDuplicate != null)
                    throw this.CreateException(new Exception(), "Profile is duplicated");

                unitOfWork.MA_USER_PROFILERepository.Add(userprofile);
                unitOfWork.Commit();
            }

            return userprofile;
        }
 public void DeleteProfileFunction(SessionInfo sessioninfo, Guid guID)
 {
     using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
     {
         var foundprofilefunction = unitOfWork.MA_PROFILE_FUNCTIONALRepository.All().FirstOrDefault(p => p.ID == guID);
         if (foundprofilefunction == null)
             throw this.CreateException(new Exception(), Messages.DATA_NOT_FOUND);
         else
         {
             unitOfWork.MA_PROFILE_FUNCTIONALRepository.Delete(foundprofilefunction);
             unitOfWork.Commit();
         }
     }
 }
Exemplo n.º 27
0
 public void TraceAuditLogoutUser(SessionInfo sessioninfo)
 {
     using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
     {
         //DA_LOGIN_AUDIT foundaudit = unitOfWork.DA_LOGIN_AUDITRepository.GetBySessionInfo(sessioninfo);
         DA_LOGIN_AUDIT foundaudit = unitOfWork.DA_LOGIN_AUDITRepository.GetByID(sessioninfo.ID);
         if (foundaudit != null)
         {
             foundaudit.LOGOUT_DATE = DateTime.Now;
             foundaudit.RESULT = String.Format("Logout the system on {0}", DateTime.Now.ToString());
         }
         unitOfWork.Commit();
     }
 }
Exemplo n.º 28
0
        public static DA_TRN GenerateFITransactionObject(SessionInfo sessionInfo
                                                            , string strTradeDate
                                                            , string strBuySell
                                                            , string strInstrument
                                                            , string strCtpy
                                                            , string strPortfolio
                                                            , string strSettlementDate
                                                            , string strYield
                                                            , string strUnit
                                                            , string strCleanPrice
                                                            , string strGrossPrice
                                                            , string strNotional
                                                            , string strCCY
                                                            , string strPceFlag
                                                            , string strSettleFlag
                                                            , string strYeildType
                                                            , string strReportBy
                                                            , string strPurpose
                                                            , string strTerm
                                                            , string strRate
                                                            , string strTBMARemark
                                                            , string strRemark
                                                            , string strProductId)
        {
            DealBusiness _dealBusiness = new DealBusiness();

                return _dealBusiness.GenerateFITransactionObject(sessionInfo
                                                                , strTradeDate
                                                                , strBuySell
                                                                , strInstrument
                                                                , strCtpy
                                                                , strPortfolio
                                                                , strSettlementDate
                                                                , strYield
                                                                , strUnit
                                                                , strCleanPrice
                                                                , strGrossPrice
                                                                , strNotional
                                                                , strCCY
                                                                , strPceFlag
                                                                , strSettleFlag
                                                                , strYeildType
                                                                , strReportBy
                                                                , strPurpose
                                                                , strTerm
                                                                , strRate
                                                                , strTBMARemark
                                                                , strRemark
                                                                , strProductId);
        }
        public MA_PROFILE_FUNCTIONAL CreateProfileFunction(SessionInfo sessioninfo, MA_PROFILE_FUNCTIONAL profilefunction)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (ValidateProfileFunction(profilefunction))
                {
                    unitOfWork.MA_PROFILE_FUNCTIONALRepository.Add(profilefunction);
                    unitOfWork.Commit();
                }
                else
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
            }

            return profilefunction;
        }
Exemplo n.º 30
0
        public MA_LIMIT_PRODUCT CreateLimitProduct(SessionInfo sessioninfo, MA_LIMIT_PRODUCT limitproduct)
        {
            using (EFUnitOfWork unitOfWork = new EFUnitOfWork())
            {
                if (ValidateProfileFunction(limitproduct))
                {
                    unitOfWork.MA_LIMIT_PRODUCTRepository.Add(limitproduct);
                    unitOfWork.Commit();
                }
                else
                    throw this.CreateException(new Exception(), Messages.DUPLICATE_DATA);
            }

            return limitproduct;
        }