Example #1
0
        public static List <PlanCommission> getListPlanCommission(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <PlanCommission> l    = new List <PlanCommission>();
                NpgsqlCommand         Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader      lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        PlanCommission a = new PlanCommission();
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.Nature      = lect["nature_commission"].ToString();
                        a.Reference   = lect["reference"].ToString();
                        a.Commissions = BLL.CommissionBll.Liste("select * from yvs_com_commission where plan = " + a.Id);
                        a.Update      = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #2
0
        public static PlanCommission getOnePlanCommission(long id)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                String           search = "select * from yvs_com_plan_commission where id = " + id + "";
                NpgsqlCommand    Lcmd   = new NpgsqlCommand(search, con);
                NpgsqlDataReader lect   = Lcmd.ExecuteReader();
                PlanCommission   a      = new PlanCommission();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        a.Id          = Convert.ToInt64(lect["id"].ToString());
                        a.Nature      = lect["nature_commission"].ToString();
                        a.Reference   = lect["reference"].ToString();
                        a.Commissions = BLL.CommissionBll.Liste("select * from yvs_com_commission where plan = " + a.Id);
                        a.Update      = true;
                    }
                    lect.Close();
                }
                return(a);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #3
0
        public void InsertPlanCommission(PlanCommission plancommission)
        {
            Guard.NotNull(plancommission, nameof(plancommission));

            _planCommissionRepository.Insert(plancommission);

            _requestCache.RemoveByPattern(PLANCOMMISSION_PATTERN_KEY);
        }
Example #4
0
        public ActionResult PlanCommission(PlanModel model)
        {
            try
            {
                PlanCommission planCommission = new PlanCommission();
                planCommission.PlanId = model.PlanId;
                planCommission.CommissionPercentage = model.Commission;
                planCommission.Id      = model.Id;
                planCommission.LevelId = model.LevelId;
                _planService.InsertPlanCommission(planCommission);
                NotifySuccess(T("Plan.PlancommissionSave"));
            }
            catch (Exception ex)
            {
                NotifyError(T("Plan.PlancommissionSaveError"));
            }

            return(View(model));
        }
Example #5
0
        public static PlanCommission getAjoutPlanCommission(PlanCommission a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        insert = "";
                NpgsqlCommand cmd    = new NpgsqlCommand(insert, con);
                cmd.ExecuteNonQuery();
                a.Id = getCurrent();
                return(a);
            }
            catch
            {
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #6
0
        public static bool getUpdatePlanCommission(PlanCommission a)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                string        update = "";
                NpgsqlCommand Ucmd   = new NpgsqlCommand(update, con);
                Ucmd.ExecuteNonQuery();
                return(true);
            }
            catch (Exception e)
            {
                Messages.Exception(e);
                return(false);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #7
0
        public void UpdatePlanCommission(PlanCommission plancommission)
        {
            Guard.NotNull(plancommission, nameof(plancommission));

            _planCommissionRepository.Update(plancommission);
        }
Example #8
0
 public PlanCommissionBll(PlanCommission unPlanCommission)
 {
     plan = unPlanCommission;
 }