Exemplo n.º 1
0
        //check if collection account is available

        public bool Get_GL_coll(crm_EmployeeSchemeFundRepo ESFRepo)
        {
            try
            {
                //Get connection
                var con   = new AppSettings();
                var param = new DynamicParameters();
                param.Add("P_SFID", ESFRepo.New_Scheme_Fund_Id, DbType.String, ParameterDirection.Input);
                param.Add("VDATA", null, DbType.Decimal, ParameterDirection.Output);
                con.GetConnection().Execute("SEL_CH_COLL_ACC", param, commandType: CommandType.StoredProcedure);
                decimal ESBENEFIT = param.Get <decimal>("VDATA");
                if (ESBENEFIT > 0)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        //check cash available


        public bool Get_GL_Balance(crm_EmployeeSchemeFundRepo ESFRepo)
        {
            try
            {
                //Get connection
                var con   = new AppSettings();
                var param = new DynamicParameters();
                param.Add("P_SFID", ESFRepo.Scheme_Fund_Id, DbType.String, ParameterDirection.Input);
                param.Add("P_ESFID", ESFRepo.Cust_No + ESFRepo.Scheme_Fund_Id, DbType.String, ParameterDirection.Input);
                param.Add("VDATA", null, DbType.Decimal, ParameterDirection.Output);
                param.Add("GB", null, DbType.Decimal, ParameterDirection.Output);
                con.GetConnection().Execute("SEL_CH_CASH_FOR_SF", param, commandType: CommandType.StoredProcedure);
                decimal ESBENEFIT    = param.Get <decimal>("VDATA");
                decimal CASH_BALANCE = param.Get <decimal>("GB") * -1;
                ESFRepo.ESF_BAL = ESBENEFIT;
                if (ESBENEFIT < CASH_BALANCE)
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public void SaveRecord(crm_EmployeeSchemeFundRepo ESFRepo)
        {
            try
            {
                //Get Connection
                AppSettings app = new AppSettings();
                con = app.GetConnection();
                DynamicParameters param = new DynamicParameters();

                param.Add(name: "P_ESF_ID", value: ESFRepo.Cust_No + ESFRepo.Scheme_Fund_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_SCHEME_FUND_ID", value: ESFRepo.Scheme_Fund_Id, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_EMPLOYEE_UNIT_BALANCE", value: 0, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                param.Add(name: "P_EMPLOYER_UNIT_BALANCE", value: 0, dbType: DbType.Decimal, direction: ParameterDirection.Input);
                param.Add(name: "P_CUST_NO", value: ESFRepo.Cust_No, dbType: DbType.String, direction: ParameterDirection.Input);
                param.Add(name: "P_MAKER_ID", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input);

                con.Execute("MIX_REMIT_EMPLOYEE_SCHEME_FUND", param, commandType: CommandType.StoredProcedure);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (con.State == ConnectionState.Open)
                {
                    con.Close();
                    if (con != null)
                    {
                        con = null;
                    }
                }
            }
        }
Exemplo n.º 4
0
        // change employer
        public bool ChangeRecordemployer(crm_EmployeeSchemeFundRepo ESFRepo)
        {
            var app = new AppSettings();


            TransactionOptions tsOp = new TransactionOptions();

            tsOp.IsolationLevel = System.Transactions.IsolationLevel.Snapshot;
            TransactionScope ts = new TransactionScope(TransactionScopeOption.RequiresNew, tsOp);

            tsOp.Timeout = TimeSpan.FromMinutes(20);

            using (OracleConnection conn = new OracleConnection(app.conString()))  //
            {
                try
                {
                    DynamicParameters param = new DynamicParameters();
                    param.Add("p_esf_id", ESFRepo.Employer_Id, DbType.String, ParameterDirection.Input);
                    param.Add("p_new_esf_id", ESFRepo.New_Employer_Id, DbType.String, ParameterDirection.Input);
                    param.Add("p_cust_no", ESFRepo.Cust_No, DbType.String, ParameterDirection.Input);
                    param.Add(name: "p_Maker_Id", value: GlobalValue.User_ID, dbType: DbType.String, direction: ParameterDirection.Input);
                    conn.Execute(sql: "CHG_CRM_EMPLOYER", param: param, commandType: CommandType.StoredProcedure);

                    ts.Complete();

                    return(true);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    ts.Dispose();
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }