Exemplo n.º 1
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            if (tbPayPwd.Text != StaticData.userLocal.UserPayPwd)
            {
                MessageBox.Show("支付密码错误");
                return;
            }
            if (remainTime.TotalMinutes < -30)
            {
                decimal  extraCost;
                CostRule costRule = ruleDal.RuleSelectByUserLevel(order.UserLevel);
                var      hours    = Convert.ToDecimal(remainTime.TotalHours);
                hours     = Math.Ceiling(hours);
                extraCost = Math.Abs(hours * costRule.HourCost);
                MessageBox.Show("你已超时还车超过30分钟, 我们将按时租价格额外收取你:" + extraCost.ToString("c"));
                StaticData.userLocal.RemainMoney -= extraCost;
                new UserDal().UpdateUser(StaticData.userLocal);
                order.OrderCost += extraCost;
            }
            order.EndTime = DateTime.Now;
            order.Status  = RentalOrder.OrderStatus.已完成;

            orderDal.UpdateOrder(order);
            carInfo.Status = CarInfo.CarStatus.在库;
            carInfo.UserId = 0;
            new CarDal().CarUpdate(carInfo);
            MessageBox.Show("已还车");
            this.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 日租扣费规则更新
        /// </summary>
        /// <param name="costRule"></param>
        /// <returns></returns>
        public bool CostRuleUpdate(CostRule costRule)
        {
            int result;

            try
            {
                string         sql  = "COST_RULE_UPDATE";
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@CRID", SqlDbType.Int),
                    new SqlParameter("@CRNAME", SqlDbType.VarChar, 50),
                    new SqlParameter("@COSTPH", SqlDbType.Money),
                    new SqlParameter("@COSTTIME", SqlDbType.Int),
                    new SqlParameter("@COSTBEGIN", SqlDbType.Money),
                    new SqlParameter("@CRKID", SqlDbType.Int),
                    new SqlParameter("@CONTIME", SqlDbType.Int),
                    new SqlParameter("@LVID", SqlDbType.Int)
                };
                para[0].Value = costRule.CrId;
                para[1].Value = costRule.CrName;
                para[2].Value = costRule.CostPh;
                para[3].Value = costRule.CostTime;
                para[4].Value = costRule.costBegin;
                para[5].Value = costRule.crKind;
                para[6].Value = costRule.conTime;
                para[7].Value = costRule.LvId;
                result        = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para);
                return(result > 0 ? true : false);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("修改日租扣费规则出错:" + ex.Message, "CostRuleUpdate", DateTime.Now);
                return(false);
            }
        }
Exemplo n.º 3
0
        public bool UpdateRule(CostRule rule)
        {
            string sql = "UPDATE_COST_RULE";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@ID", SqlDbType.Int),
                    new SqlParameter("@USER_LEVEL", SqlDbType.Int),
                    new SqlParameter("@HOUR_COST", SqlDbType.Decimal),
                    new SqlParameter("@DAY_COST", SqlDbType.Decimal),
                    new SqlParameter("@WEEK_COST", SqlDbType.Decimal),
                    new SqlParameter("@MONTH_COST", SqlDbType.Decimal),
                    new SqlParameter("@SEASON_COST", SqlDbType.Decimal),
                    new SqlParameter("@YEAR_COST", SqlDbType.Decimal),
                };
                para[0].Value = rule.Id;
                para[1].Value = rule.UserLevel;
                para[2].Value = rule.HourCost;
                para[3].Value = rule.DayCost;
                para[4].Value = rule.WeekCost;
                para[5].Value = rule.MonthCost;
                para[6].Value = rule.SeasonCost;
                para[7].Value = rule.YearCost;
                int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para);
                return(result > 0 ? true : false);
            }
            catch (Exception)
            {
                return(false);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 获取所有日租扣费规则
        /// </summary>
        /// <returns></returns>
        public List <CostRule> CostRuleSelect()
        {
            string          sql          = "COST_RULE_SELECT";
            List <CostRule> listCostRule = new List <CostRule>();

            dt = new DataTable();
            try
            {
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, null))
                {
                    dt.Load(dr);
                }
                CostRule costRuleTemp;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    costRuleTemp           = new CostRule();
                    costRuleTemp.CrId      = Convert.ToInt32(dt.Rows[i]["CRID"]);
                    costRuleTemp.CrName    = Convert.ToString(dt.Rows[i]["CRNAME"]);
                    costRuleTemp.CostPh    = Convert.ToDouble(dt.Rows[i]["COSTPH"]);
                    costRuleTemp.CostTime  = Convert.ToInt32(dt.Rows[i]["COSTTIME"]);
                    costRuleTemp.costBegin = Convert.ToDouble(dt.Rows[i]["COSTBEGIN"]);
                    costRuleTemp.crKind    = Convert.ToInt32(dt.Rows[i]["CRKID"]);
                    costRuleTemp.conTime   = Convert.ToInt32(dt.Rows[i]["CONTIME"]);
                    costRuleTemp.LvId      = Convert.ToInt32(dt.Rows[i]["LVID"]);
                    listCostRule.Add(costRuleTemp);
                }
                return(listCostRule);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("查询日租扣费规则出错:" + ex.Message, "CostRuleSelect", DateTime.Now);
                return(null);
            }
        }
Exemplo n.º 5
0
        public List <CostRule> GetRuleList()
        {
            string          sql       = "GET_COST_RULE";
            List <CostRule> costRules = new List <CostRule>();

            try
            {
                dt = new DataTable();
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql))
                {
                    dt.Load(dr);
                }
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CostRule rule = new CostRule();
                    rule.Id         = Convert.ToInt32(dt.Rows[i]["ID"]);
                    rule.UserLevel  = Convert.ToInt32(dt.Rows[i]["USER_LEVEL"]);
                    rule.HourCost   = Convert.ToDecimal(dt.Rows[i]["HOUR_COST"]);
                    rule.DayCost    = Convert.ToDecimal(dt.Rows[i]["DAY_COST"]);
                    rule.WeekCost   = Convert.ToDecimal(dt.Rows[i]["WEEK_COST"]);
                    rule.MonthCost  = Convert.ToDecimal(dt.Rows[i]["MONTH_COST"]);
                    rule.SeasonCost = Convert.ToDecimal(dt.Rows[i]["SEASON_COST"]);
                    rule.YearCost   = Convert.ToDecimal(dt.Rows[i]["YEAR_COST"]);
                    costRules.Add(rule);
                }
                return(costRules);
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 6
0
        public CostRule RuleSelectByUserLevel(int userLevel)
        {
            string   sql  = "SELECT_COST_RULE_BY_USER_LEVEL";
            CostRule rule = new CostRule();

            try
            {
                dt = new DataTable();
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql))
                {
                    dt.Load(dr);
                }
                if (dt.Rows.Count > 0)
                {
                    rule.Id         = Convert.ToInt32(dt.Rows[0]["ID"]);
                    rule.UserLevel  = Convert.ToInt32(dt.Rows[0]["USER_LEVEL"]);
                    rule.HourCost   = Convert.ToDecimal(dt.Rows[0]["HOUR_COST"]);
                    rule.DayCost    = Convert.ToDecimal(dt.Rows[0]["DAY_COST"]);
                    rule.WeekCost   = Convert.ToDecimal(dt.Rows[0]["WEEK_COST"]);
                    rule.MonthCost  = Convert.ToDecimal(dt.Rows[0]["MONTH_COST"]);
                    rule.SeasonCost = Convert.ToDecimal(dt.Rows[0]["SEASON_COST"]);
                    rule.YearCost   = Convert.ToDecimal(dt.Rows[0]["YEAR_COST"]);
                    return(rule);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 7
0
 private void  除扣费规则ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (lvRule.SelectedItems.Count != 1)
     {
         MessageBox.Show("请选择一行!");
     }
     else
     {
         DialogResult result = MessageBox.Show("该操作不可逆,请问您确认删除该用户吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
         if (result == DialogResult.No)
         {
             return;
         }
         int      id       = Convert.ToInt32(lvRule.SelectedItems[0].Tag);
         string   ruleName = lvRule.SelectedItems[0].SubItems[1].Text;
         CostRule ruleInfo = new CostRule();
         ruleInfo.CrId   = id;
         ruleInfo.CrName = ruleName;
         if (ruleBLL.CostRuleDelete(ruleInfo as CostRule))
         {
             LogInfo logInfo = new LogInfo();
             logInfo.UserId  = StaticData.userLocal.UserId;
             logInfo.Content = "删除了名称为‘" + (ruleInfo as CostRule).CrName + "'的扣费规则";
             logInfo.LogTime = DateTime.Now;
             logInfo.DpId    = StaticData.departLocal.DpId;
             bool b = new LogBLL().LogInsert(logInfo);
             MessageBox.Show("删除成功!");
         }
         else
         {
             MessageBox.Show("删除失败!");
         }
         bg.RunWorkerAsync();
     }
 }
Exemplo n.º 8
0
 void bg_DoWork(object sender, DoWorkEventArgs e)
 {
     listlV           = vipLvBLL.VipLevelSelect();
     ruleTemp         = ruleBLL.CostRuleSelectById(ruleModel);
     ruleModel.crKind = ruleTemp.crKind;
     lvId             = ruleTemp.LvId;
 }
Exemplo n.º 9
0
        /// <summary>
        /// 根据会员等级和租车类型获得扣费规则
        /// </summary>
        /// <returns></returns>
        public CostRule CostRuleSelectByLevelAndKind(CostRule costRule)
        {
            string sql = "COST_RULE_SELECT_BY_LEVELANDKIND";

            dt = new DataTable();
            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@LVID", SqlDbType.Int),
                    new SqlParameter("@KIND", SqlDbType.Int),
                };
                para[0].Value = costRule.LvId;
                para[1].Value = costRule.crKind;
                using (SqlDataReader dr = SqlHelper.ExecuteReader(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para))
                {
                    dt.Load(dr);
                }
                CostRule costRuleInfo = new CostRule();
                costRuleInfo.CrId      = Convert.ToInt32(dt.Rows[0]["CRID"]);
                costRuleInfo.CrName    = Convert.ToString(dt.Rows[0]["CRNAME"]);
                costRuleInfo.CostPh    = Convert.ToDouble(dt.Rows[0]["COSTPH"]);
                costRuleInfo.CostTime  = Convert.ToInt32(dt.Rows[0]["COSTTIME"]);
                costRuleInfo.costBegin = Convert.ToDouble(dt.Rows[0]["COSTBEGIN"]);
                costRuleInfo.crKind    = Convert.ToInt32(dt.Rows[0]["CRKID"]);
                costRuleInfo.conTime   = Convert.ToInt32(dt.Rows[0]["CONTIME"]);
                costRule.LvId          = Convert.ToInt32(dt.Rows[0]["LVID"]);
                return(costRuleInfo);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("查询日租扣费规则出错:" + ex.Message, "CostRuleSelectById", DateTime.Now);
                return(null);
            }
        }
        private void btnSaveCostRule_Click(object sender, EventArgs e)
        {
            try
            {
                if (costRule != null)
                {
                    //Edit
                    int result = CRUDStatusCode.ERROR;
                    costRule.ShowTypeId = (int)cboShowType.SelectedValue;
                    costRule.Price      = (double)txtPrice.MoneyValue;
                    costRule.Length     = (int)cboDuration.SelectedValue;
                    _costRuleService    = new CostRuleService();

                    result = _costRuleService.EditCostRule(costRule);
                    if (result == CRUDStatusCode.SUCCESS)
                    {
                        LoadDGV();
                        Utilities.ShowMessage(CommonMessage.EDIT_SUCESSFULLY);
                        Logging.LogBusiness(string.Format("{0} {1} {2}",
                                                          Common.Session.GetUserName(),
                                                          Common.Constants.LogAction.Update, "giá tiền " + costRule.Length + " loại hình " + costRule.ShowTypeId + " của thời điểm " + model.Code),
                                            Common.Constants.BusinessLogType.Update);
                    }
                }
                else
                {
                    //Add
                    int result = CRUDStatusCode.ERROR;
                    _costRuleService = new CostRuleService();

                    CostRule newCodeRule = new CostRule()
                    {
                        Length     = (int)cboDuration.SelectedValue,
                        Price      = (double)txtPrice.MoneyValue,
                        TimeSlotId = model.Id,
                        ShowTypeId = (int)cboShowType.SelectedValue
                    };
                    result = _costRuleService.AddCostRule(newCodeRule);
                    if (result == CRUDStatusCode.SUCCESS)
                    {
                        Utilities.ShowMessage(CommonMessage.ADD_SUCESSFULLY);
                        LoadDGV();
                        Logging.LogBusiness(string.Format("{0} {1} {2}",
                                                          Common.Session.GetUserName(),
                                                          Common.Constants.LogAction.Create, "giá tiền " + newCodeRule.Length + " loại hình " + newCodeRule.ShowTypeId + " của thời điểm " + model.Code),
                                            Common.Constants.BusinessLogType.Create);
                    }
                }
            }
            catch (Exception ex)
            {
                throw;
            }
            finally
            {
                _costRuleService = null;
            }
        }
Exemplo n.º 11
0
 private void buttoncomfirm_Click(object sender, EventArgs e)
 {
     if (textUserLevel.Text.Trim() == "")
     {
         MessageBox.Show("请输入规则目标用户等级", "提示");
         return;
     }
     if (textHourCost.Text == "")
     {
         MessageBox.Show("请输入时租费用", "提示");
         return;
     }
     if (textDayCost.Text == "")
     {
         MessageBox.Show("请输入日租费用", "提示");
         return;
     }
     if (textWeekCost.Text == "")
     {
         MessageBox.Show("请输入周租费用", "提示");
         return;
     }
     if (textMonthCost.Text == "")
     {
         MessageBox.Show("请输入月租费用", "提示");
         return;
     }
     if (textSeasonCost.Text == "")
     {
         MessageBox.Show("请输入季租费用", "提示");
         return;
     }
     if (textYearCost.Text == "")
     {
         MessageBox.Show("请输入年租费用", "提示");
         return;
     }
     try
     {
         CostRule rule = new CostRule();
         Debug.WriteLine("UserLevel");
         rule.UserLevel = int.Parse(textUserLevel.Text);
         Debug.WriteLine("HourCost");
         rule.HourCost   = decimal.Parse(textHourCost.Text);
         rule.DayCost    = decimal.Parse(textDayCost.Text);
         rule.WeekCost   = decimal.Parse(textWeekCost.Text);
         rule.MonthCost  = decimal.Parse(textMonthCost.Text);
         rule.SeasonCost = decimal.Parse(textSeasonCost.Text);
         rule.YearCost   = decimal.Parse(textYearCost.Text);
         costRuleDal.AddCostRule(rule);
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "错误");
     }
 }
Exemplo n.º 12
0
        public async Task <HttpResponseMessage> GetCosts()
        {
            var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId);

            CostRule costRule  = new CostRule();
            var      costQuery = await costRule.GetAllByOrganIdAsync(organId);

            return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = ZhivarEnums.ResultCode.Successful, data = costQuery.ToList() }));
        }
Exemplo n.º 13
0
 string[] danwei     = { "分钟", "小时", "天", "月" }; //单位
 #region 窗体实例化
 public RuleManageWindow()
 {
     InitializeComponent();
     ruleModel              = new CostRule();
     ruleBLL                = new CostRuleBLL();
     vipLvBLL               = new VipLevelBLL();
     levelModel             = new VipLevelInfo();
     levelBLL               = new VipLevelBLL();
     bg.DoWork             += new DoWorkEventHandler(bg_DoWork);                         //异步操作时要做的操作,一般去查列表,这个列表在本页面内先声明,然后在这个dowork方法里去取数填充他
     bg.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); //这个是取数完成后进行的操作,去到数后,这里取用去到的列表绑定到控件
 }
Exemplo n.º 14
0
        public bool IsExistLengthAndTimeSlotId(int timeSlotId, int length)
        {
            bool     result   = false;
            CostRule CostRule = _CostRuleRepository.Get(q => q.TimeSlotId == timeSlotId && q.Length == length).FirstOrDefault();

            if (CostRule != null)
            {
                result = true;
            }

            return(result);
        }
Exemplo n.º 15
0
 private void btnUpdateRule_Click(object sender, EventArgs e)
 {
     if (lvRuleList.SelectedItems.Count > 0)
     {
         int            UserLevel      = Convert.ToInt32(lvRuleList.SelectedItems[0].SubItems[1].Text);
         CostRule       ruleTemp       = costRuleDal.RuleSelectByUserLevel(UserLevel);
         UpdateRuleForm updateRuleForm = new UpdateRuleForm(ruleTemp);
         updateRuleForm.ShowDialog();
     }
     else
     {
         MessageBox.Show("请先选择要修改的规则");
     }
 }
Exemplo n.º 16
0
 string[] danwei      = { "分钟", "小时", "天", "月" };//单位
 #region 窗体实例化
 public ChangeRuleWindow(int crid)
 {
     InitializeComponent();
     crId                   = crid;
     ruleModel              = new CostRule();
     ruleBLL                = new CostRuleBLL();
     vipLvBLL               = new VipLevelBLL();
     levelModel             = new VipLevelInfo();
     levelBLL               = new VipLevelBLL();
     listlV                 = new List <VipLevelInfo>();
     ruleModel.CrId         = crid;
     bg.DoWork             += new DoWorkEventHandler(bg_DoWork);
     bg.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted);
 }
Exemplo n.º 17
0
        public async Task <HttpResponseMessage> DeleteCosts([FromBody] string strIds)
        {
            try
            {
                var organId = Convert.ToInt32(SecurityManager.CurrentUserContext.OrganizationId);

                string failurs = "";

                string[] values = strIds.Split(',');
                for (int i = 0; i < values.Length - 1; i++)
                {
                    var id = Convert.ToInt32(values[i].Trim());

                    PayRecevieRule payRecevieRule  = new PayRecevieRule();
                    var            payRecevieQuery = await payRecevieRule.GetByCostIdAsync(id);

                    if (payRecevieQuery.Any())
                    {
                        failurs += "<br/>" + "برای این صورت هزینه دریافت/ پرداخت انجام شده است برای حذف باید دریافت و پرداخت حذف گردد.";
                    }
                    else
                    {
                        CostRule costRule = new CostRule();
                        await costRule.DeleteAsync(id);

                        await costRule.SaveChangesAsync();
                    }
                }



                if (!string.IsNullOrEmpty(failurs))
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = ZhivarEnums.ResultCode.ValidationError, data = failurs }));
                }
                else
                {
                    return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = ZhivarEnums.ResultCode.Successful, data = "" }));
                }
            }

            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 18
0
        public int EditCostRule(CostRule input)
        {
            int result   = CRUDStatusCode.ERROR;
            var CostRule = _CostRuleRepository.GetById(input.Id);

            if (CostRule != null)
            {
                CostRule.Length     = input.Length;
                CostRule.Price      = input.Price;
                CostRule.ShowTypeId = input.ShowTypeId;

                _CostRuleRepository.Update(CostRule);
                result = CRUDStatusCode.SUCCESS;
            }

            return(result);
        }
        private CostRule GetCostRuleById(int id)
        {
            try
            {
                _costRuleService = new CostRuleService();
                CostRule costRule = _costRuleService.GetById(id);

                return(costRule);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                _costRuleService = null;
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 删除日租扣费规则
        /// </summary>
        /// <param name="costRule"></param>
        /// <returns></returns>
        public bool CostRuleDelete(CostRule costRule)
        {
            string sql = "COST_RULE_DELETE";

            try
            {
                SqlParameter[] para = new SqlParameter[]
                {
                    new SqlParameter("@CRID", SqlDbType.Int)
                };
                para[0].Value = costRule.CrId;
                int result = SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringShop, CommandType.StoredProcedure, sql, para);
                return(result > 0 ? true : false);
            }
            catch (Exception ex)
            {
                except.ExceptionInsert("删除日租扣费规则出错:" + ex.Message, "CostRuleDelete", DateTime.Now);
                return(false);
            }
        }
Exemplo n.º 21
0
        public int AddCostRule(CostRule input)
        {
            int result = CRUDStatusCode.ERROR;

            if (input != null)
            {
                bool isExisted = _CostRuleRepository.Exist(t => t.TimeSlotId == input.TimeSlotId &&
                                                           t.ShowTypeId == input.ShowTypeId &&
                                                           t.Length == input.Length);
                if (!isExisted)
                {
                    _CostRuleRepository.Add(input);
                    result = CRUDStatusCode.SUCCESS;
                }
                else
                {
                    result = CRUDStatusCode.EXISTED;
                }
            }

            return(result);
        }
        private void adgv_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            var selectedRow = adgv.SelectedRows[0];

            //Prepare model
            if (selectedRow.Cells[0].Value.ToString() != "0")
            {
                int id = int.Parse(selectedRow.Cells[0].Value.ToString());
                costRule = GetCostRuleById(id);

                //Binding data
                if (costRule != null)
                {
                    cboDuration.SelectedValue = costRule.Length;
                    cboShowType.SelectedValue = costRule.ShowTypeId;
                    txtPrice.Text             = Utilities.DoubleMoneyToText(costRule.Price);
                }
            }
            else
            {
                costRule = null;
            }
        }
Exemplo n.º 23
0
        private async Task <string> createNumberCost(int organId)
        {
            var      count     = 0;
            CostRule costRule  = new CostRule();
            var      costQuery = await costRule.GetAllByOrganIdAsync(organId);

            count = costQuery.Count();
            count++;
            string code = "";

            if (count < 10)
            {
                code = "00000" + count;
            }
            else if (count < 100)
            {
                code = "0000" + count;
            }
            else if (count < 1000)
            {
                code = "000" + count;
            }
            else if (count < 10000)
            {
                code = "00" + count;
            }
            else if (count < 100000)
            {
                code = "0" + count;
            }
            else
            {
                code = count.ToString();
            }

            return(code);
        }
Exemplo n.º 24
0
 /// <summary>
 /// 根据会员等级和租车类型获得扣费规则
 /// </summary>
 /// <returns></returns>
 public CostRule CostRuleSelectByLevelAndKind(CostRule costRule)
 {
     return(costRuleDal.CostRuleSelectByLevelAndKind(costRule));
 }
Exemplo n.º 25
0
 /// <summary>
 /// 根据CRID获得日租扣费规则
 /// </summary>
 /// <returns></returns>
 public CostRule CostRuleSelectById(CostRule costRule)
 {
     return(costRuleDal.CostRuleSelectById(costRule));
 }
Exemplo n.º 26
0
 /// <summary>
 /// 删除日租扣费规则
 /// </summary>
 /// <param name="costRule"></param>
 /// <returns></returns>
 public bool CostRuleDelete(CostRule costRule)
 {
     return(costRuleDal.CostRuleDelete(costRule));
 }
Exemplo n.º 27
0
 /// <summary>
 /// 日租扣费规则更新
 /// </summary>
 /// <param name="costRule"></param>
 /// <returns></returns>
 public bool CostRuleUpdate(CostRule costRule)
 {
     return(costRuleDal.CostRuleUpdate(costRule));
 }
Exemplo n.º 28
0
 /// <summary>
 /// 日租扣费规则添加
 /// </summary>
 /// <param name="costRule"></param>
 /// <returns></returns>
 public bool CostRuleInsert(CostRule costRule)
 {
     return(costRuleDal.CostRuleInsert(costRule));
 }
Exemplo n.º 29
0
 public void CostRule(CostRule rule)
 {
     Rules.Add(rule);
 }
Exemplo n.º 30
0
 public void CostRule(CostRule rule)
 {
     Rules.Add(rule);
 }
Exemplo n.º 31
0
        private void btnOKDay_Click(object sender, EventArgs e)
        {
            if (txtNameDay.Text.Trim() == "" || txtNameDay.Text.Trim() == null)
            {
                epName.SetError(txtNameDay, "请输入规则名称!");
                return;
            }
            else
            {
                epName.SetError(txtNameDay, "");
            }
            if (txtMoneyPerHour.Text.Trim() == "" || txtMoneyPerHour.Text.Trim() == null)
            {
                epName.SetError(txtMoneyPerHour, "请输入单位时间扣费金额!");
                return;
            }
            else
            {
                epName.SetError(txtMoneyPerHour, "");
            }
            if (!Regex.IsMatch(txtMoneyPerHour.Text.Trim(), @"^[0-9]*[1-9][0-9]*$"))
            {
                epName.SetError(txtMoneyPerHour, "请输入正确的金额!");
                return;
            }
            else
            {
                epName.SetError(txtMoneyPerHour, "");
            }
            if (txtContentTimeDay.Text.Trim() == "" || txtContentTimeDay.Text.Trim() == null)
            {
                epName.SetError(txtContentTimeDay, "请输入扣费活动时间!");
                return;
            }
            else if (!Regex.IsMatch(txtContentTimeDay.Text.Trim(), @"^[0-9]*[1-9][0-9]*$"))
            {
                epName.SetError(txtContentTimeDay, "请输入正确的时间!");
                return;
            }
            else
            {
                epName.SetError(txtContentTimeDay, "");
            }
            if (txtContTimeDay.Text.Trim() == "" || txtContTimeDay.Text.Trim() == null)
            {
                epName.SetError(txtContTimeDay, "请输入初始扣费包含时间!");
                return;
            }
            else if (!Regex.IsMatch(txtContTimeDay.Text.Trim(), @"^[0-9]*[1-9][0-9]*$"))
            {
                epName.SetError(txtContTimeDay, "请输入正确的时间!");
                return;
            }
            else
            {
                epName.SetError(txtContTimeDay, "");
            }
            if (txtInitMoneyDay.Text.Trim() == "" || txtInitMoneyDay.Text.Trim() == null)
            {
                epName.SetError(txtInitMoneyDay, "请输入初始扣费金额!");
                return;
            }
            else if (!Regex.IsMatch(txtInitMoneyDay.Text.Trim(), @"^[0-9]*[1-9][0-9]*$"))
            {
                epName.SetError(txtInitMoneyDay, "请输入正确的金额!");
                return;
            }
            else
            {
                epName.SetError(txtInitMoneyDay, "");
            }

            progressBar1.Visible = true;
            btnOKDay.Enabled     = false;
            costRule             = new CostRule();
            costRule.CrName      = txtNameDay.Text.Trim();
            costRule.CostPh      = double.Parse(txtMoneyPerHour.Text.Trim());
            costRule.CostTime    = int.Parse(txtContentTimeDay.Text.Trim()); //扣费活动时间
            costRule.costBegin   = double.Parse(txtInitMoneyDay.Text.Trim());
            costRule.conTime     = int.Parse(txtContTimeDay.Text.Trim());    //起始金额包含时间
            costRule.crKind      = (int)BorrowKindEnum.Day;
            costRule.LvId        = (int)cmbVipLvDay.SelectedValue;
            LogInfo logInfo = new LogInfo();

            logInfo.UserId  = StaticData.userLocal.UserId;
            logInfo.Content = "添加了日租扣费规则,名称为‘" + txtNameDay.Text + "'";
            logInfo.LogTime = DateTime.Now;
            logInfo.DpId    = StaticData.departLocal.DpId;

            backgroundWorker2.RunWorkerAsync();
        }