Esempio n. 1
0
        public bool check_user_right(string username, int requiredRight)
        {
            bool isSuccess = false;

            using (Models.MerchantService db = new MerchantService())
            {
                t_Users u = db.t_Users.Where(x => x.UserID == username).SingleOrDefault();

                mUser mU = new mUser();
                mU.UserID    = u.UserID;
                mU.UserLevel = u.UserLevel;

                if (requiredRight == 1)
                {
                    if (mU.UserLevel == 1 || mU.UserLevel == 3)
                    {
                        isSuccess = true;
                    }
                }
                if (requiredRight == 2)
                {
                    if (mU.UserLevel == 2 || mU.UserLevel == 3)
                    {
                        isSuccess = true;
                    }
                }
            }

            return(isSuccess);
        }
        public bool InsertTran()
        {
            bool is_success = false;

            using (Models.MerchantService db = new MerchantService())
            {
                t_Transactions tran = new t_Transactions();

                tran.CardNo               = CardNo;
                tran.CardType             = CardType;
                tran.ProcessingCode       = ProcessingCode;
                tran.TrxAmount            = TrxAmount;
                tran.SettAmount           = SettAmount;
                tran.MPU_Merchant_ID      = MPU_Merchant_ID;
                tran.TrxDate              = TrxDate;
                tran.MDRValue             = MDRValue;
                tran.SettConversationRate = SettConversationRate;
                tran.CurrencyCode         = CurrencyCode;
                tran.SettCurrencyCode     = SettCurrencyCode;
                tran.TerminalID           = TerminalID;
                tran.TRXRemark            = TRXRemark;
                tran.RecordType           = RecordType;
                tran.TRXMDRRate           = TRXMDRRate;

                db.t_Transactions.Add(tran);
                db.SaveChanges();
                is_success = true;
            }

            return(is_success);
        }
Esempio n. 3
0
        public string get_card_type()
        {
            using (MerchantService db = new MerchantService())
            {
                t_CardBin bin = db.t_CardBin.Where(x => x.BINCode == BINCode).SingleOrDefault();
                if (bin != null)
                {
                    BINCode  = bin.BINCode;
                    CardType = bin.CardType;
                }
                else
                {
                    BINCode  = BINCode;
                    CardType = "Unknown Card";
                }
            }

            return(CardType);
        }
Esempio n. 4
0
        public Double get_mdr_rate_mpunotonus(mMerchant merchant)
        {
            Double MDR = 0;

            using (Models.MerchantService db = new MerchantService())
            {
                t_Merchant_Info merchant_info = new t_Merchant_Info();
                merchant_info = db.t_Merchant_Info.Where(x => x.MPU_Merchant_ID == merchant.MPU_Merchant_ID).SingleOrDefault();
                if (merchant_info != null)
                {
                    MDR = Convert.ToDouble(merchant_info.MPURate);
                }
                else
                {
                    MDR = -123;
                }
            }

            return(MDR);
        }