Example #1
0
        public Commission GetCommissionDetails()
        {
            List <Commission> commission = new List <Commission>();

            Commission response = new Commission()
            {
                TotalMonthlyPayout = 7338.16,
                YTDCommissionsPaid = 19092.57,
                RevenueAdjustments = -29.91,
                ChargeBacks        = 0
            };

            return(response);
        }
Example #2
0
        public List <Meeting> GetMeetingsForCommission(Commission commission)
        {
            var meetingRepository = RepositoryFactory.GetMeetingRepository();

            try
            {
                var meetings = meetingRepository.Filter(e => e.CommissionId == commission.Id).ToList();
                return(meetings);
            }
            catch (RepositoryException ex)
            {
                throw new MeetingServiceException(ex);
            }
        }
Example #3
0
        // GET: Commission/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Commission commission = db.Commission.Find(id);

            if (commission == null)
            {
                return(HttpNotFound());
            }
            return(View(commission));
        }
Example #4
0
 public IHttpActionResult Post(Commission commission)
 {
     try
     {
         var commissionManager = new CommissionManagement();
         commissionManager.Create(commission);
         apiResponse = new ApiResponse();
         return(Ok(apiResponse));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
Example #5
0
        public override int GetHashCode()
        {
            var hashCode = -2052112293;

            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(ExecId);

            hashCode = hashCode * -1521134295 + Commission.GetHashCode();
            hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(Currency);

            hashCode = hashCode * -1521134295 + RealizedPnl.GetHashCode();
            hashCode = hashCode * -1521134295 + Yield.GetHashCode();
            hashCode = hashCode * -1521134295 + YieldRedemptionDate.GetHashCode();
            return(hashCode);
        }
Example #6
0
        public async Task HandleTestAsync()
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Commission, CommissionDTO>();
            });
            var mapper           = new Mapper(config);
            var utils            = new Utils();
            var commissionRepo   = utils.commissionRepo;
            var parcelLockerRepo = utils.parcelLockerRepo;

            var cmr     = (await utils.CommissionerRepo.FindAll()).First();
            var rcp     = (await utils.recipientRepo.FindAll()).First();
            var parlock = (await utils.parcelLockerRepo.FindAll()).First();
            var parc    = (await utils.parcelRepo.FindAll()).First();

            Commission commission = new Commission()
            {
                Commissioner      = cmr,
                Recipient         = rcp,
                Price             = 10,
                TargetParceLocker = parlock,
                Parcel            = parc,
                CommissionStatus  = Domain.Statuses.CommissionStatus.Draft,
                DeliveryStatus    = Domain.DeliveryStatus.NotStarted,
                Id = 100
            };

            await commissionRepo.Add(commission);

            Commission lightCommission = new Commission()
            {
                Id = 100
            };

            ParcelLocker pr = (await utils.parcelLockerRepo.FindAll()).ElementAt(1);

            FinishCreatingCommissionCommand cmd = new FinishCreatingCommissionCommand(commission, pr);

            FinishCreatingCommissionCommandHandler handler = new FinishCreatingCommissionCommandHandler(commissionRepo, parcelLockerRepo, mapper);

            await handler.Handle(cmd, CancellationToken.None);

            var updatedCommission = (await commissionRepo.FindById(100));

            Assert.IsTrue(
                updatedCommission.SourceParcelLocker == pr
                );
        }
        // GET api/<controller>/5
        public Commission Get(string id)
        {
            SqlConnection con = new SqlConnection(constr);

            con.Open();
            string        QueryString = "select * from commission where id = '" + id + "'";
            SqlCommand    cmd         = new SqlCommand(QueryString, con);
            SqlDataReader reader      = cmd.ExecuteReader();
            Commission    data        = new Commission();

            while (reader.Read())
            {
                data.id = reader["id"].ToString();
                data.marketing_firstname = reader["marketing_firstname"].ToString();
                data.marketing_lastname  = reader["marketing_lastname"].ToString();
                data.marketing_id        = reader["marketing_id"].ToString();
                data.marketing_team      = reader["marketing_team"].ToString();

                data.customer_firstname = reader["customer_firstname"].ToString();
                data.customer_lastname  = reader["customer_lastname"].ToString();
                data.customer_bank_id   = reader["customer_bank_id"].ToString();
                data.customer_id        = reader["customer_id"].ToString();

                data.percent_option_1 = reader["percent_option_1"].ToString();
                data.percent_option_2 = reader["percent_option_2"].ToString();
                data.percent_option_3 = reader["percent_option_3"].ToString();
                data.percent_option_4 = reader["percent_option_4"].ToString();

                data.note_text = reader["note_text"].ToString();
                data.note_file = reader["note_file"].ToString();

                data.boss_1_comment = reader["boss_1_comment"].ToString();
                data.boss_2_comment = reader["boss_2_comment"].ToString();

                data.percent_option_1_first_comment = reader["percent_option_1_first_comment"].ToString();
                data.percent_option_2_first_comment = reader["percent_option_2_first_comment"].ToString();
                data.percent_option_3_first_comment = reader["percent_option_3_first_comment"].ToString();
                data.percent_option_4_first_comment = reader["percent_option_4_first_comment"].ToString();

                data.percent_option_1_second_comment = reader["percent_option_1_second_comment"].ToString();
                data.percent_option_2_second_comment = reader["percent_option_2_second_comment"].ToString();
                data.percent_option_3_second_comment = reader["percent_option_3_second_comment"].ToString();
                data.percent_option_4_second_comment = reader["percent_option_4_second_comment"].ToString();

                data.boss_1_done = reader["boss_1_done"].ToString();
                data.boss_2_done = reader["boss_2_done"].ToString();
            }
            return(data);
        }
Example #8
0
    protected void btn_validate_Click(object sender, EventArgs e)
    {
        Commission com = new Commission();

        com.name        = btn_validate.CommandArgument;
        com.memberName  = tbx_membre.Text;
        com.rotary_year = 2015;
        com.job         = tbx_job.Text;
        if (hfd_id.Value != "")
        {
            com.id = int.Parse(hfd_id.Value);
        }
        DataMapping.InsertCommission(com);
        Response.Redirect(Globals.NavigateURL());
    }
Example #9
0
 public IHttpActionResult Post3(Commission commission)
 {
     try
     {
         var commissionManager = new CommissionManagement();
         var tmpCommission     = commissionManager.IsAdminHotelRegistered(commission.Id);
         apiResponse      = new ApiResponse();
         apiResponse.Data = tmpCommission;
         return(Ok(apiResponse));
     }
     catch (Exception e)
     {
         return(InternalServerError(e));
     }
 }
        // GET: /Comision/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Commission commission = db.Commissions.Find(id);

            if (commission == null)
            {
                return(HttpNotFound());
            }
            ViewBag.EntityTypeID = new SelectList(db.EntityTypes, "ID", "Name", commission.EntityTypeID);
            ViewBag.StateID      = new SelectList(db.States, "ID", "Name", commission.StateID);
            return(View(commission));
        }
Example #11
0
        // GET: Commissions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Commission commission = db.Commissions.Find(id);

            if (commission == null)
            {
                return(HttpNotFound());
            }
            ViewBag.QtrId         = new SelectList(db.Qtrs, "QtrId", "QtrId", commission.QtrId);
            ViewBag.SalesPersonId = new SelectList(db.SalesPersons, "SalesPersonId", "FirstName", commission.SalesPersonId);
            return(View(commission));
        }
Example #12
0
 public static Stockist WithTenPercentCommission(this Stockist model)
 {
     return(new()
     {
         StockistId = model.StockistId,
         StockistCode = "TLM",
         Details = model.Details,
         Commission = new Commission
         {
             StartDate = model.Commission.StartDate,
             EndDate = model.Commission.EndDate,
             Rate = 10,
         },
         StatusCode = model.StatusCode,
     });
 }
Example #13
0
        private void ViewMeetingComissions_Load(object sender, System.EventArgs e)
        {
            var unitOfWork        = new UnitOfWork(_context);
            var commissionService = new CommissionService(unitOfWork, unitOfWork);
            var meetingService    = new MeetingService(unitOfWork, unitOfWork);

            _commission = commissionService.GetCommissionById(_commissionId);

            Commission = String.Format("Commission name: {0}", _commission.Name);
            Profile    = String.Format("Commisiion profile name - {0}", _commission.Profile.Description);

            var meetings = meetingService.GetMeetingsForCommission(_commission);

            dgvMeetings.DataSource = meetings;

            unitOfWork.Commit();
        }
Example #14
0
        public void CommissionSave(IList <CommissionDTO> listCommissionDTO, int restaurantBookingId)
        {
            var listNewCommissionId = new List <int>();

            foreach (var commissionDTO in listCommissionDTO)
            {
                Commission commission = null;
                var        amount     = 0.0;
                try
                {
                    amount = Double.Parse(commissionDTO.amount);
                }
                catch { }
                var commissionDTORestaurantBookingId = 0;
                try
                {
                    commissionDTORestaurantBookingId = Convert.ToInt32(commissionDTO.restaurantBookingId);
                }
                catch { }
                if (commissionDTO.id <= 0)
                {
                    commission = new Commission();
                }
                else if (commissionDTO.id > 0)
                {
                    commission = BookingViewingBLL.CommissionGetById(commissionDTO.id);
                }
                commission.PayFor            = commissionDTO.payFor;
                commission.Amount            = amount;
                commission.RestaurantBooking = BookingViewingBLL.RestaurantBookingGetById(commissionDTO.restaurantBookingId);
                BookingViewingBLL.CommissionSaveOrUpdate(commission);
                listNewCommissionId.Add(commission.Id);
            }
            var listCommission             = BookingViewingBLL.CommissionGetAllByBookingId(restaurantBookingId);
            var listIdOfCommission         = listCommission.Select(x => x.Id).ToList();
            var listIdOfCommissionDTO      = listCommissionDTO.Where(x => x.id > 0).Select(x => x.id).ToList();
            var listCommissionIdNeedRemove = listIdOfCommission.Except(listIdOfCommissionDTO).Except(listNewCommissionId);

            foreach (var commissionIdNeedRemove in listCommissionIdNeedRemove)
            {
                var commissionNeedRemove = BookingViewingBLL.CommissionGetById(commissionIdNeedRemove);
                BookingViewingBLL.CommissionDelete(commissionNeedRemove);
            }
            Dispose();
        }
Example #15
0
        //卖出按钮
        private void btn_submit_Click(object sender, EventArgs e)
        {
            if (this.sell_quantity == 0)
            {
                MessageBox.Show("请输入卖出数量!");
                return;
            }

            if (this.canSell == 0)
            {
                MessageBox.Show("当前股票可用股票为0不可卖出!");
                return;
            }

            if (this.sell_quantity > this.canSell)
            {
                this.sell_quantity = 100;
                this.numericUpDown_sell_quantity.Value = 100;
                MessageBox.Show("卖出数量不能超过可买数量!");
                return;
            }

            //MessageBox.Show(string.Format("卖出价格:{0}, 卖出数量:{1}", this.sell_price, this.sell_quantity));

            //生成卖出的委托记录
            Commission model = new Commission();

            model.hold_stock_info   = this.hold_stock_info_select;
            model.commission_price  = this.sell_price;
            model.commission_amount = this.sell_quantity;
            // 1.买入 2. 卖出
            model.direction = 2;
            // 状态:1.已撤销 2.已成交 3.已提交(默认值)
            model.state          = 3;
            model.remain         = this.sell_quantity;
            model.stockholder_id = Utility.user.id;

            commissionService.AddCommission(model);
            hold_stock_infoService.UpdateAmountUseable(this.hold_stock_info_select.amount_useable - this.sell_quantity, this.hold_stock_info_select);
            //委托交易成功后,增加 bankroll_freezed的金额

            this.DialogResult = DialogResult.OK;
            //关闭窗口
            this.Close();
        }
Example #16
0
        public static List <Commission> getListCommission(String query)
        {
            NpgsqlConnection con = Connexion.Connection();

            try
            {
                List <Commission> l    = new List <Commission>();
                NpgsqlCommand     Lcmd = new NpgsqlCommand(query, con);
                NpgsqlDataReader  lect = Lcmd.ExecuteReader();
                if (lect.HasRows)
                {
                    while (lect.Read())
                    {
                        Commission a = new Commission();
                        a.Id             = Convert.ToInt64(lect["id"].ToString());
                        a.Nature         = lect["nature_montant"].ToString();
                        a.DateDebut      = Convert.ToDateTime((lect["date_debut"] != null) ? (!lect["date_debut"].ToString().Trim().Equals("") ? lect["date_debut"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                        a.DateFin        = Convert.ToDateTime((lect["date_fin"] != null) ? (!lect["date_fin"].ToString().Trim().Equals("") ? lect["date_fin"].ToString().Trim() : "00/00/0000") : "00/00/0000");
                        a.Actif          = Convert.ToBoolean((lect["actif"] != null) ? (!lect["actif"].ToString().Trim().Equals("") ? lect["actif"].ToString().Trim() : "false") : "false");
                        a.Permanent      = Convert.ToBoolean((lect["permanent"] != null) ? (!lect["permanent"].ToString().Trim().Equals("") ? lect["permanent"].ToString().Trim() : "false") : "false");
                        a.Montant        = (Double)((lect["montant_commission"] != null) ? (!lect["montant_commission"].ToString().Trim().Equals("") ? lect["montant_commission"] : 0.0) : 0.0);
                        a.MontantMaximal = (Double)((lect["montant_maximal"] != null) ? (!lect["montant_maximal"].ToString().Trim().Equals("") ? lect["montant_maximal"] : 0.0) : 0.0);
                        a.MontantMinimal = (Double)((lect["montant_minimun"] != null) ? (!lect["montant_minimun"].ToString().Trim().Equals("") ? lect["montant_minimun"] : 0.0) : 0.0);
                        a.Article        = (lect["article"] != null
                            ? (!lect["article"].ToString().Trim().Equals("")
                            ? BLL.ArticleComBll.One(Convert.ToInt64(lect["article"].ToString()))
                            : new ArticleCom())
                            : new ArticleCom());
                        a.Update = true;
                        l.Add(a);
                    }
                    lect.Close();
                }
                return(l);
            }
            catch (NpgsqlException e)
            {
                Messages.Exception(e);
                return(null);
            }
            finally
            {
                Connexion.Deconnection(con);
            }
        }
Example #17
0
        //插入委托记录 持有的
        public void AddCommissionHave(Commission model)
        {
            string sql = "insert into t_commission ("
                         + "hold_stock_info_id, commission_price, direction,time,commission_amount,state,remain,stockholder_id) "
                         + "values( @hold_stock_info_id, @commission_price, @direction, now(), @commission_amount, @state, @remain, @stockholder_id) ";

            List <MySqlParameter> Paramter = new List <MySqlParameter>();

            Paramter.Add(new MySqlParameter("@hold_stock_info_id", model.hold_stock_info.id));
            Paramter.Add(new MySqlParameter("@commission_price", model.commission_price));
            Paramter.Add(new MySqlParameter("@direction", model.direction));
            Paramter.Add(new MySqlParameter("@commission_amount", model.commission_amount));
            Paramter.Add(new MySqlParameter("@state", model.state));
            Paramter.Add(new MySqlParameter("@remain", model.remain));
            Paramter.Add(new MySqlParameter("@stockholder_id", model.stockholder_id));

            DBHelperSQL.Ins.ExecuteNonquery(sql, Paramter.ToArray());
        }
Example #18
0
        public ActionResult Create(Commission commission)
        {
            if (ModelState.IsValid)
            {
                commission.UserType = 0;
                db.Commission.Add(commission);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CompanyId         = new SelectList(db.Company, "Id", "Address", commission.CompanyId);
            ViewBag.ItemId            = new SelectList(db.Item, "Id", "Name", commission.ItemId);
            ViewBag.UnitId            = new SelectList(db.Unit, "Id", "Name", commission.UnitId);
            ViewBag.UserMasId         = new SelectList(db.UserMas, "Id", "Name", commission.UserMasId);
            ViewBag.ProductCategoryId = new SelectList(db.ProductCategory, "Id", "Name", commission.Item.ProductCategoryId);

            return(View(commission));
        }
Example #19
0
 protected void gvw_com_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "GEdit")
     {
         Commission com = DataMapping.GetListCommission("id = '" + e.CommandArgument + "'").FirstOrDefault();
         tbx_job.Text    = com.job;
         tbx_membre.Text = com.memberName;
         btn_validate.CommandArgument = com.name;
         pnl_add.Visible = true;
         hfd_id.Value    = "" + com.id;
         Panel1.Visible  = false;
     }
     else if (e.CommandName == "GDelete")
     {
         DataMapping.DeleteCommission(int.Parse("" + e.CommandArgument));
         Response.Redirect(Globals.NavigateURL());
     }
 }
Example #20
0
 /// <summary>
 /// 保存提成
 /// </summary>
 /// <param name="cableid">电路ID</param>
 /// <param name="salerid">销售ID</param>
 /// <param name="salerType">销售人员类型</param>
 public static void saveCommission(int cableid, int salerid, int salerType, string cablestatus, DateTime startTime, int cableclass, int businessTypeid, RatioDate ratio)
 {
     try
     {
         decimal ratiovalue = 0;
         decimal taxvalue   = 0;
         string  dataname   = cablestatus;
         //DataTable tb = getCableRatio(cableclass,businessTypeid);
         if (salerType == (int)EnmDataType.主销售渠道)
         {
             //dataname = "主销售渠道" + dataname;
             //DataRow row = tb.Select("dataname='" + dataname + "'")[0];
             ratiovalue = ratio.RatioMian;
             taxvalue   = ratio.TaxMain;
         }
         else if (salerType == (int)EnmDataType.完工录入)
         {
             //dataname = "完工录入" + dataname;
             //DataRow row = tb.Select("dataname='" + dataname + "'")[0];
             ratiovalue = ratio.RatioWrite;
             taxvalue   = ratio.TaxWrite;
         }
         else if (salerType == (int)EnmDataType.销售渠道)
         {
             //dataname = "销售渠道" + dataname;
             //DataRow row = tb.Select("dataname='" + dataname + "'")[0];
             ratiovalue = ratio.RatioSaler;
             taxvalue   = ratio.TaxSaler;
         }
         Commission c = new Commission();
         c.Cableid   = cableid;
         c.Userid    = salerid;
         c.Usertype  = salerType;
         c.Tax       = taxvalue;
         c.Ratio     = ratiovalue;
         c.Begintime = startTime.Date;
         c.Isdeleted = (int)EnmIsdeleted.使用中;
         c.Create();
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage("E999", ex.Message);
     }
 }
 public Schema()
     : base() {
     InstanceType = typeof(__Frtransact__);
     Properties.ClearExposed();
     City = Add<__TString__>("City$");
     City.DefaultValue = "";
     City.Editable = true;
     City.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__City__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__City__ = (System.String)_v_; }, false);
     Country = Add<__TString__>("Country$");
     Country.DefaultValue = "";
     Country.Editable = true;
     Country.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Country__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Country__ = (System.String)_v_; }, false);
     Name = Add<__TString__>("Name$");
     Name.DefaultValue = "";
     Name.Editable = true;
     Name.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Name__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Name__ = (System.String)_v_; }, false);
     Number = Add<__TString__>("Number$");
     Number.DefaultValue = "";
     Number.Editable = true;
     Number.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Number__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Number__ = (System.String)_v_; }, false);
     Street = Add<__TString__>("Street$");
     Street.DefaultValue = "";
     Street.Editable = true;
     Street.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Street__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Street__ = (System.String)_v_; }, false);
     ZipCode = Add<__TString__>("ZipCode$");
     ZipCode.DefaultValue = "";
     ZipCode.Editable = true;
     ZipCode.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__ZipCode__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__ZipCode__ = (System.String)_v_; }, false);
     Date = Add<__TString__>("Date$");
     Date.DefaultValue = "";
     Date.Editable = true;
     Date.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Date__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Date__ = (System.String)_v_; }, false);
     SalesPrice = Add<__TLong__>("SalesPrice$");
     SalesPrice.DefaultValue = 0L;
     SalesPrice.Editable = true;
     SalesPrice.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__SalesPrice__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__SalesPrice__ = (System.Int64)_v_; }, false);
     Commission = Add<__TLong__>("Commission$");
     Commission.DefaultValue = 0L;
     Commission.Editable = true;
     Commission.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Commission__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Commission__ = (System.Int64)_v_; }, false);
     Address = Add<__TString__>("Address");
     Address.DefaultValue = "";
     Address.SetCustomAccessors((_p_) => { return ((__Frtransact__)_p_).__bf__Address__; }, (_p_, _v_) => { ((__Frtransact__)_p_).__bf__Address__ = (System.String)_v_; }, false);
 }
 public FetchOfferDto(int id, string code, string etat, string intitule, string description, string placeDepot, DateTime dateLimit, string placeOpened, DateTime dateOpened, string manager, bool publish)
 {
     this.id          = id;
     this.code        = code;
     this.etat        = etat;
     this.intitule    = intitule;
     this.description = description;
     this.placeDepot  = placeDepot;
     this.placeOpened = placeOpened;
     this.dateLimit   = dateLimit;
     this.dateOpened  = dateOpened;
     this.manager     = manager;
     this.publish     = publish;
     files            = new List <FileContentResult>();
     categorie        = new Categorie();
     direction        = new Direction();
     commission       = new Commission();
     bidders          = new List <BidderDto>();
 }
        public void Seed(DumaContext context)
        {
            //TODO: First variables.

            var member = new Member
            {
                Name         = "Lesha",
                Surname      = "Yurchak",
                Patronymic   = "Vladimirovich",
                PassportData = "MP"
            };

            context.Members.Add(member);
            context.SaveChanges();

            var commission = new Commission {
                Name = "Hello", President = member
            };

            context.Commissions.Add(commission);

            var roleCom = new RoleCommission {
                Value = "Commandor"
            };

            context.RoleCommissions.Add(roleCom);

            context.SaveChanges();
            commission.Consist.Add(member);

            var record = new JournalRecord
            {
                EntryDate  = DateTime.Now,
                ExitDate   = DateTime.Now.AddDays(3),
                Member     = member,
                Commission = commission,
                Role       = roleCom
            };

            commission.JournalRecords.Add(record);

            context.SaveChanges();
        }
Example #24
0
 public static bool delSaler(int cableid, int salerid, DateTime endDate)
 {
     try
     {
         Commission c = CommissionDao.FindFirst(new EqExpression("Userid", salerid), new EqExpression("Cableid", cableid), new EqExpression("Isdeleted", (int)EnmIsdeleted.使用中));
         if (c != null)
         {
             c.Endtime   = endDate;
             c.Isdeleted = (int)EnmIsdeleted.已删除;
             c.Update();
         }
         return(true);
     }
     catch (Exception ex)
     {
         MessageHelper.ShowMessage("E999", "删除渠道比例失败!");
         return(false);
     }
 }
Example #25
0
        public Meeting SetMeetingForCommission(Meeting meeting, Commission commission)
        {
            var meetingRepository = RepositoryFactory.GetMeetingRepository();

            meetingRepository.Create(meeting);

            try
            {
                UnitOfWork.PreSave();
            }
            catch (Exception ex)
            {
                throw new MeetingServiceException(ex);
            }

            commission.Meetings.Add(meeting);

            return(meeting);
        }
 public int Insert(Commission obj)
 {
     using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
     {
         if (db.State == ConnectionState.Closed)
         {
             db.Open();
         }
         var p = new DynamicParameters();
         p.Add("@Event", value: 1, dbType: DbType.Int32, direction: ParameterDirection.Input);
         p.Add("@CommissionID", dbType: DbType.Int32, direction: ParameterDirection.Output);
         p.AddDynamicParams(new
         {
             obj.CommissionName,
             obj.CommissionAmount
         });
         db.Execute("proc_Commission", p, commandType: CommandType.StoredProcedure);
         return(p.Get <int>("@CommissionID"));
     }
 }
 public bool Update(Commission obj, int CommissionID)
 {
     using (IDbConnection db = new SqlConnection(Helper.ConnectionString))
     {
         if (db.State == ConnectionState.Closed)
         {
             db.Open();
         }
         var p = new DynamicParameters();
         p.Add("@Event", dbType: DbType.Int32, direction: ParameterDirection.Input, value: 3);
         p.Add("@CommissionID", dbType: DbType.Int32, direction: ParameterDirection.Input, value: CommissionID);
         p.AddDynamicParams(new
         {
             obj.CommissionName,
             obj.CommissionAmount
         });
         var result = db.Execute("proc_Commission", p, commandType: CommandType.StoredProcedure);
         return(result != 0);
     }
 }
Example #28
0
    /// <summary>
    /// Only for update 5009
    /// </summary>
    public static void UpdateCommissionSystem()
    {
        var memberships = Membership.GetAll();
        var levels      = AppSettings.Referrals.ReferralEarningsUpToTier;

        foreach (var m in memberships)
        {
            for (int i = 1; i <= levels; i++)
            {
                decimal tierEarnings = 1;
                if (i != 1)
                {
                    var intEarnings = (int)TableHelper.SelectScalar(string.Format("SELECT ReferralEarningsFromTier{0} FROM ApplicationSettings", i));
                    tierEarnings = ((int)TableHelper.SelectScalar(string.Format("SELECT ReferralEarningsFromTier{0} FROM ApplicationSettings", i))) / 100m;
                }

                var commission = TableHelper.GetListFromRawQuery <Commission>(
                    string.Format("SELECT * FROM Commissions WHERE MembershipId = {0} AND RefLevel = {1}"
                                  , m.Id, i)).FirstOrDefault();

                if (commission == null)
                {
                    commission = new Commission()
                    {
                        RefLevel     = i,
                        MembershipId = m.Id,
                        MembershipPurchasePercent      = m.DirectReferralMembershipPurchaseEarnings * tierEarnings,
                        BannerPurchasePercent          = m.DirectReferralBannerPurchaseEarnings * tierEarnings,
                        AdPackPurchasePercent          = m.DirectReferralAdPackPurchaseEarnings * tierEarnings,
                        OfferwallPercent               = m.RefPercentEarningsOfferwalls * tierEarnings,
                        CPAOfferPercent                = m.RefPercentEarningsCPA * tierEarnings,
                        TrafficGridPurchasePercent     = m.DirectReferralTrafficGridPurchaseEarnings * tierEarnings,
                        PointsForAdPackPurchasePercent = 0,
                        AccountActivationFeePercent    = 0,
                        JackpotPvpStageBuyFeePercent   = 0
                    };
                    commission.Save();
                }
            }
        }
    }
        private void AddChangeComission_Load(object sender, EventArgs e)
        {
            var unitOfWork               = new UnitOfWork(_context);
            var commissionService        = new CommissionService(unitOfWork, unitOfWork);
            var profileCommissionService = new ProfileCommissionService(unitOfWork, unitOfWork);
            var membershipService        = new MembershipService(unitOfWork, unitOfWork);

            var membersForPresident = membershipService.GetMembersForPresident();
            var profiles            = profileCommissionService.GetAllProfiles();

            if (_commissionId != 0)
            {
                _commission    = commissionService.GetCommissionById(_commissionId);
                CommissionName = _commission.Name;

                cmbxProfile.DataSource = profiles;
                if (_commission.Profile == null)
                {
                    cmbxProfile.SelectedItem = 0;
                }
                cmbxProfile.Text = _commission.Profile.Description;

                cmbxPresident.DataSource = membersForPresident;
                cmbxPresident.Text       = _commission.President.NSP;

                var membersForList    = GetMembersNonCommission(unitOfWork);
                var commissionMembers = commissionService.GetMembersOfCommission(_commission.Id);

                lbxMembers.DataSource           = membersForList;
                lbxCommissionMembers.DataSource = commissionMembers;

                unitOfWork.Commit();
            }
            else
            {
                CommissionName           = String.Empty;
                cmbxProfile.DataSource   = profiles;
                cmbxPresident.DataSource = membersForPresident;
                unitOfWork.Commit();
            }
        }
Example #30
0
        public Commission CreateCommission(string name)
        {
            var commissionRepository = RepositoryFactory.GetCommissionRepository();

            var commission = new Commission {
                Name = name
            };

            commissionRepository.Create(commission);

            try
            {
                UnitOfWork.PreSave();
            }
            catch (RepositoryException ex)
            {
                throw new CommissionServiceException(ex);
            }

            return(commission);
        }
    protected void txtAmount_TextChanged(object sender, EventArgs e)
    {
        try
        {
            TextBox txt = (TextBox)sender;
            DataControlFieldCell gridcell = (DataControlFieldCell)txt.Parent;
            GridViewRow row = (GridViewRow)gridcell.Parent;
            TextBox txtAmount = (TextBox)row.FindControl("txtAmount");
            if (txtAmount.Text == "")
                txtAmount.Text = "0";

            txtAmount.Text = Utils.CleanHTML(txtAmount.Text);
            txtAmount.Text = txtAmount.Text.Replace("$", " ").Trim();
            txtAmount.Text = txtAmount.Text.Replace("%", " ").Trim();
            try
            {
                double i = 0.0;
                if (txtAmount.Text != "")
                    i = double.Parse(txtAmount.Text);
                else if (txtAmount.Text.Trim() == "")
                {
                    lblerror.Text = "Please enter numeric/decimal only";
                    return;
                }
            }
            catch (Exception ex)
            {
                lblerror.CssClass = "error";
                lblerror.Text = "Please enter numeric/decimal only";

                return;
            }
            if (ddlcountry.SelectedIndex == 0)
            {
                lblerror.Text = "Please select the role first";
            }

            else
            {


                //TextBox txtPercentage = (TextBox)row.FindControl("txtpercentage");
                RadioButtonList rbList = (RadioButtonList)row.FindControl("rbType");

                int feeTypeId = Conversion.ParseInt(gvCommissionType.DataKeys[row.RowIndex]["LookupTypeID"]);
                int countryId = Int32.Parse(ddlcountry.SelectedValue);
                int organizationId = Int32.Parse(ddlstewardshiptype.SelectedValue);
                Commission com = new Commission();

                com.CommissionId = 0;
                com.Amount = Conversion.ParseDecimal(txtAmount.Text.Replace('$', ' ').Trim());
                com.Percentage = Conversion.ParseDecimal(txtAmount.Text.Replace('%', ' ').Trim());
                // com.Percentage = clsCommon.ParseDecimal(txtPercentage.Text);
                com.TypeId = feeTypeId;
                com.CountryId = countryId;

                com.OrganizationId = organizationId;
                com.CreatedById = LoginMemberId;
                com.TntCommissionType = Conversion.ParseInt(rbList.SelectedValue);

                com.IsActive = true;

                if (rbList.SelectedValue == "1")
                {
                    com.Percentage = 0;
                }
                else if (rbList.SelectedValue == "2")
                {
                    com.Amount = 0;
                    if (Conversion.ParseDouble(txtAmount.Text.Trim()) >= 9)
                    {
                        Response.Write("<script> alert('hi'); </script>");
                        //   ScriptManager.RegisterStartupScript(upnlsearch, upnlsearch.GetType(), "confirm", "return confirm('Changing the language will clear the text in the textboxes. Click OK to proceed.');", true);

                        //ScriptManager.RegisterClientScriptBlock
                    }
                }
                else
                {
                    com.Amount = 0;
                    com.Percentage = 0;
                }

                if (Commission.CommissionSetting(com))
                {
                    lblerror.Text = "Commission updated successfully.";
                    LoadCommissionInfo(Int32.Parse(ddlcountry.SelectedValue), Int32.Parse(ddlstewardshiptype.SelectedValue), 2);
                }
            }
        }
        catch (Exception ex)
        {
            new SqlLog().InsertSqlLog(0, "commission.txtAmount_TextChanged", ex);
        }
    }
Example #32
0
 protected override void Create()
 {
     var commission = new Commission
                          {
                              CommissionType = CommissionTypeValue,
                              InternalBPId = SelectInternalCustomerID,
                              IsDefaultRule = true
                          };
     using (var commissionService = SvcClientManager.GetSvcClient<CommissionServiceClient>(SvcType.CommissionSvc)
         )
     {
         commissionService.CreateDocument(CurrentUser.Id, commission, AddCommissionLineList);
     }
 }
        void ConvertQuoteRecord(ref Quote quote, Commission? commission, QUOTERECORD pRec)
        {
            quote.Ask = (0 == pRec.dAsk) ? (decimal?)null : (decimal)pRec.dAsk;
            quote.Bid = (0 == pRec.dBid) ? (decimal?)null : (decimal)pRec.dBid;

            MBTradingConnectionManager manager = _manager;
            if (commission.HasValue && (manager != null && manager.Adapter != null && manager.Adapter.ApplyQuoteCommission))
            {
                commission.Value.ApplyCommissions(manager.Adapter, ref quote);
            }

            quote.High = (0 == pRec.dHigh) ? (decimal?)null : (decimal)pRec.dHigh;
            quote.Low = (0 == pRec.dLow) ? (decimal?)null : (decimal)pRec.dLow;

            quote.Open = (decimal)pRec.dOpen;
            quote.Volume = pRec.lVolume;
            quote.Time = pRec.UTCDateTime;
        }
Example #34
0
 public static Commission CreateCommission(int commissionRunID, int customerID, decimal earnings, decimal previousBalance, decimal balanceForward, decimal fee, decimal total, int paidRankID)
 {
     Commission commission = new Commission();
     commission.CommissionRunID = commissionRunID;
     commission.CustomerID = customerID;
     commission.Earnings = earnings;
     commission.PreviousBalance = previousBalance;
     commission.BalanceForward = balanceForward;
     commission.Fee = fee;
     commission.Total = total;
     commission.PaidRankID = paidRankID;
     return commission;
 }
    private void saveCommission(  GridViewRow gr)
    {

        
            try
            {
                //TextBox txt = (TextBox)sender;
                //DataControlFieldCell gridcell = (DataControlFieldCell)txt.Parent;
                GridViewRow row = gr;
                TextBox txtAmount = (TextBox)row.FindControl("txtAmount");
                if (txtAmount.Text == "")
                    txtAmount.Text = "0";

                txtAmount.Text = Utils.CleanHTML(txtAmount.Text);
                txtAmount.Text = txtAmount.Text.Replace("$", " ").Trim();
                txtAmount.Text = txtAmount.Text.Replace("%", " ").Trim();
                try
                {
                    double i = 0.0;
                    if (txtAmount.Text != "")
                        i = double.Parse(txtAmount.Text);
                    else if (txtAmount.Text.Trim() == "")
                    {
                        lblerror.Text = "Please enter numeric/decimal only";
                        Flag = false;
                        return;
                    }
                }
                catch (Exception ex)
                {
                    lblerror.CssClass = "custom-absolute-alert alert-danger";
                    lblerror.Text = "Please enter numeric/decimal only";
                    ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                    Flag = false;
                    return;
                }
                if (ddlcountry.SelectedIndex == 0)
                {
                    Flag = false;
                    lblerror.Text = "Please select the country first";
                    ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                }

                else
                {


                    //TextBox txtPercentage = (TextBox)row.FindControl("txtpercentage");
                    RadioButtonList rbList = (RadioButtonList)row.FindControl("rbType");

                    int OrganizationSubTypeId = Conversion.ParseInt(gvCommissionType.DataKeys[row.RowIndex]["OrganizationSubTypeId"]);
                    int countryId = Int32.Parse(ddlcountry.SelectedValue);
                    int StewardshipID = Int32.Parse(ddlstewardshiptype.SelectedValue);
                    Commission com = new Commission();

                    com.CommissionId = 0;
                    com.Amount = Conversion.ParseDecimal(txtAmount.Text.Replace('$', ' ').Trim());
                    com.Percentage = Conversion.ParseDecimal(txtAmount.Text.Replace('%', ' ').Trim());
                    // com.Percentage = Conversion.ParseDecimal(txtPercentage.Text);
                    com.OrganizationSubTypeId = OrganizationSubTypeId;
                    com.CountryId = countryId;

                    com.StewardshipID = StewardshipID;
                    com.CreatedById = LoginMemberId;
                    com.TntCommissionType = Conversion.ParseInt(rbList.SelectedValue);

                    com.IsActive = true;

                    if (rbList.SelectedValue == "1")
                    {
                        com.Percentage = 0;
                    }
                    else if (rbList.SelectedValue == "2")
                    {
                        com.Amount = 0;
                        if (Conversion.ParseDouble(txtAmount.Text.Trim()) > 100)
                        {
                           Response.Write("<script> alert('invalid percentage'); </script>");
                           ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                           Flag = false;
                            //   ScriptManager.RegisterStartupScript(upnlsearch, upnlsearch.GetType(), "confirm", "return confirm('Changing the language will clear the text in the textboxes. Click OK to proceed.');", true);

                            //ScriptManager.RegisterClientScriptBlock
                        }
                    }
                    else
                    {
                        com.Amount = 0;
                        com.Percentage = 0;
                    }

                    if (!Commission.CommissionSetting(com))
                    {
                        lblerror.Text = "Please enter numeric/decimal only";
                        ScriptManager.RegisterStartupScript(this, GetType(), "fadeOut", "fadeOut();", true);
                        Flag = false;
                   //     LoadCommissionInfo(Int32.Parse(ddlcountry.SelectedValue), Int32.Parse(ddlstewardshiptype.SelectedValue), 2);
                    } 
                }
            }
            catch (Exception ex)
            {
                Flag = false;
                new SqlLog().InsertSqlLog(0, "commission.txtAmount_TextChanged", ex);
            }
        }
Example #36
0
     private void FixupCommission(Commission previousValue)
     {
         if (IsDeserializing)
         {
             return;
         }
 
         if (previousValue != null && previousValue.CommissionLines.Contains(this))
         {
             previousValue.CommissionLines.Remove(this);
         }
 
         if (Commission != null)
         {
             if (!Commission.CommissionLines.Contains(this))
             {
                 Commission.CommissionLines.Add(this);
             }
 
             CommissionId = Commission.Id;
         }
         if (ChangeTracker.ChangeTrackingEnabled)
         {
             if (ChangeTracker.OriginalValues.ContainsKey("Commission")
                 && (ChangeTracker.OriginalValues["Commission"] == Commission))
             {
                 ChangeTracker.OriginalValues.Remove("Commission");
             }
             else
             {
                 ChangeTracker.RecordOriginalValue("Commission", previousValue);
             }
             if (Commission != null && !Commission.ChangeTracker.ChangeTrackingEnabled)
             {
                 Commission.StartTracking();
             }
         }
     }
Example #37
0
 public void AddToCommissions(Commission commission)
 {
     base.AddObject("Commissions", commission);
 }
        /// <summary>
        /// Call is non confirmative;
        /// Forwarded to requestMessage looped thread.
        /// </summary>
        /// <param name="baseCurrency"></param>
        public bool SubscribeSymbolSession(Symbol symbol, Commission? commission)
        {
            if (IsInitialized == false)
            {
                return false;
            }

            lock (this)
            {
                if (_sessionsHotSwap.ContainsKey(symbol.Name))
                {// BaseCurrency already subscribed.
                    return true;
                }

                Dictionary<string, SessionQuoteInformation> sessionsHotSwap = new Dictionary<string, SessionQuoteInformation>(_sessionsHotSwap);
                sessionsHotSwap.Add(symbol.Name, new SessionQuoteInformation() { Symbol = symbol, Commission = commission });

                _sessionsHotSwap = sessionsHotSwap;

            }

            MbtQuotes client = _quotesClient;
            if (client != null)
            {
                _messageLoopOperator.BeginInvoke(delegate()
                {
                    client.AdviseSymbol(this, symbol.Name, (int)enumQuoteServiceFlags.qsfLevelOne);
                });
                return true;
            }

            return false;
        }