/// <summary> /// 保存 /// </summary> private void Save() { string[] hidIncome = Utils.GetFormValues("hidIncome"); string[] txtRealIncome = Utils.GetFormValues("txtRealIncome"); string[] hidOrderId = Utils.GetFormValues("hidOrderId"); EyouSoft.Model.TourStructure.MTourOrderSales model = new EyouSoft.Model.TourStructure.MTourOrderSales(); model.Operator = this.SiteUserInfo.Name; model.OperatorId = this.SiteUserInfo.UserId; model.CollectionRefundState = EyouSoft.Model.EnumType.TourStructure.CollectionRefundState.收款; model.CollectionRefundDate = System.DateTime.Now; model.CollectionRefundOperator = this.SiteUserInfo.Name; model.CollectionRefundOperatorID = this.SiteUserInfo.UserId; model.IsGuideRealIncome = true; EyouSoft.BLL.TourStructure.BTourOrder bll = new EyouSoft.BLL.TourStructure.BTourOrder(); for (int i = 0; i < hidIncome.Length; i++) { model.OrderId = hidOrderId[i]; decimal income = Utils.GetDecimal(hidIncome[i]); model.CollectionRefundAmount = Utils.GetDecimal(txtRealIncome[i]); bll.UpdateGuideRealIncome(model.OrderId, income, model.CollectionRefundAmount, "", model); } }
/// <summary> /// 验证 /// </summary> /// <param name="sales"></param> /// <param name="msg"></param> /// <returns></returns> private bool ValidateForm(ref EyouSoft.Model.TourStructure.MTourOrderSales sales, ref string msg) { string id = EyouSoft.Common.Utils.GetFormValue("id"); if (!string.IsNullOrEmpty(id)) { EyouSoft.BLL.TourStructure.BTourOrder bOrder = new EyouSoft.BLL.TourStructure.BTourOrder(); sales = bOrder.GetTourOrderSalesById(id); } else { sales.OrderId = Utils.GetFormValue("OrderId"); } sales.CollectionRefundOperatorID = SiteUserInfo.UserId; sales.CollectionRefundOperator = SiteUserInfo.Name; sales.OperatorId = SiteUserInfo.UserId; sales.Operator = SiteUserInfo.Name; DateTime?collectionRefundDate = Utils.GetDateTimeNullable(Utils.GetFormValue("txt_collectionRefundDate")); if (!collectionRefundDate.HasValue) { msg += "付款时间格式不正确!<br/>"; } decimal collectionRefundAmount = Utils.GetDecimal(Utils.GetFormValue("txt_collectionRefundAmount")); if (collectionRefundAmount <= 0) { msg += "付款金额格式不正确!<br/>"; } int collectionRefundMode = Utils.GetInt(Utils.GetFormValue("ddl_CollectionRefundMode")); if (collectionRefundMode <= 0) { msg += "请选择付款方式!"; } sales.CollectionRefundDate = (collectionRefundDate); sales.CollectionRefundAmount = collectionRefundAmount; sales.CollectionRefundMode = collectionRefundMode; sales.CollectionRefundState = EyouSoft.Model.EnumType.TourStructure.CollectionRefundState.收款; sales.Memo = Utils.GetFormValue("txt_Memo"); sales.IsCheck = false; return(msg.Length <= 0); }
private string Save(string type) { string msg = string.Empty; EyouSoft.Model.TourStructure.MTourOrderSales sales = new EyouSoft.Model.TourStructure.MTourOrderSales(); switch (type) { case "Add": if (ValidateForm(ref sales, ref msg)) { EyouSoft.BLL.TourStructure.BTourOrder bOrder = new EyouSoft.BLL.TourStructure.BTourOrder(); if (bOrder.AddTourOrderSales(sales)) { msg = UtilsCommons.AjaxReturnJson("1", "添加成功!"); } else { msg = UtilsCommons.AjaxReturnJson("0", "添加失败!"); } } else { msg = UtilsCommons.AjaxReturnJson("0", msg + "<br/>添加失败!"); } break; case "Update": if (ValidateForm(ref sales, ref msg)) { EyouSoft.BLL.TourStructure.BTourOrder bOrder = new EyouSoft.BLL.TourStructure.BTourOrder(); if (bOrder.UpdateTourOrderSales(sales)) { msg = UtilsCommons.AjaxReturnJson("1", "修改成功!"); } else { msg = UtilsCommons.AjaxReturnJson("0", "修改失败!"); } } else { msg = UtilsCommons.AjaxReturnJson("0", msg + "<br/>修改失败!"); } break; case "Delete": string id = EyouSoft.Common.Utils.GetFormValue("id"); if (!string.IsNullOrEmpty(id)) { EyouSoft.BLL.TourStructure.BTourOrder bOrder = new EyouSoft.BLL.TourStructure.BTourOrder(); if (bOrder.DeleteTourOrderSales(id)) { msg = UtilsCommons.AjaxReturnJson("1", "删除成功!"); } else { msg = UtilsCommons.AjaxReturnJson("0", "删除失败!"); } } else { msg = UtilsCommons.AjaxReturnJson("0", "删除失败!"); } break; default: msg = UtilsCommons.AjaxReturnJson("0", "操作失败,服务器忙!"); break; } return(msg); }