/// <summary> /// get jifenshangpinfangshis /// </summary> /// <param name="shangPinId"></param> /// <returns></returns> IList <EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo> GetJiFenShangPinFangShis(string shangPinId) { IList <EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo> items = new List <EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo>(); DbCommand cmd = _db.GetSqlStringCommand(SQL_SELECT_GetJiFenShangPinFangShis); _db.AddInParameter(cmd, "@ShangPinId", DbType.AnsiStringFixedLength, shangPinId); using (var rdr = DbHelper.ExecuteReader(cmd, _db)) { while (rdr.Read()) { var item = new EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo(); item.FangShi = (EyouSoft.Model.EnumType.YlStructure.JiFenDuiHuanFangShi)rdr.GetByte(rdr.GetOrdinal("FangShi")); item.JiFen = rdr.GetDecimal(rdr.GetOrdinal("JiFen")); item.JinE = rdr.GetDecimal(rdr.GetOrdinal("JinE")); items.Add(item); } } return(items); }
/// <summary> /// baocun /// </summary> void BaoCun() { var info = new EyouSoft.Model.YlStructure.MWzJiFenShangPinInfo(); info.CompanyId = CurrentUserCompanyID; info.FangShis = new List <EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo>(); info.FuJians = null; info.IssueTime = DateTime.Now; info.MingCheng = Utils.GetFormValue(txtMingCheng.UniqueID); info.OperatorId = SiteUserInfo.UserId; info.PeiSongFangShi = Utils.GetFormValue(txtPeiSongFangShi.UniqueID); info.ShangPinId = ShangPinId; info.ShuoMing = Utils.GetYlEditorText(Request.Form[txtShuoMing.UniqueID]); info.Status = Utils.GetEnumValue <EyouSoft.Model.EnumType.YlStructure.JiFenShangPinStatus>(Utils.GetFormValue("txtStatus"), EyouSoft.Model.EnumType.YlStructure.JiFenShangPinStatus.架); info.XuZhi = Utils.GetYlEditorText(Request.Form[txtXuZhi.UniqueID]); info.ShuLiang = Utils.GetInt(Utils.GetFormValue(txtShuLiang.UniqueID)); info.FaPiaoKuaiDiJinE = Utils.GetDecimal(Utils.GetFormValue(txtFaPiaoKuaiDiJinE.UniqueID)); info.ShangPinJinE = Utils.GetDecimal(Utils.GetFormValue(txtShangPinJinE.UniqueID)); var items1 = upload1.Files; var items2 = upload1.YuanFiles; var items3 = new List <EyouSoft.Model.YlStructure.MFuJianInfo>(); if (items1 != null && items1.Count > 0) { foreach (var item in items1) { var item1 = new EyouSoft.Model.YlStructure.MFuJianInfo(); item1.Filepath = item.FilePath; items3.Add(item1); } } if (items2 != null && items2.Count > 0) { foreach (var item in items2) { var item1 = new EyouSoft.Model.YlStructure.MFuJianInfo(); item1.Filepath = item.FilePath; items3.Add(item1); } } info.FuJians = items3; var fangShi1 = new EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo(); var fangShi2 = new EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo(); var fangShi3 = new EyouSoft.Model.YlStructure.MWzJiFenShangPinFangShiInfo(); decimal jiFen1 = Utils.GetDecimal(Utils.GetFormValue(txtJiFen1.UniqueID)); //decimal jiFen2 = Utils.GetDecimal(Utils.GetFormValue(txtJiFen2.UniqueID)); decimal jiFen3 = Utils.GetDecimal(Utils.GetFormValue(txtJiFen3.UniqueID)); //decimal jinE2 = Utils.GetDecimal(Utils.GetFormValue(txtJinE2.UniqueID)); decimal jinE3 = Utils.GetDecimal(Utils.GetFormValue(txtJinE3.UniqueID)); if (jiFen1 > 0) { fangShi1.FangShi = EyouSoft.Model.EnumType.YlStructure.JiFenDuiHuanFangShi.积分; fangShi1.JiFen = jiFen1; info.FangShis.Add(fangShi1); } /*if (jiFen2 > 0 || jinE2 > 0) * { * fangShi2.FangShi = EyouSoft.Model.EnumType.YlStructure.JiFenDuiHuanFangShi.积分礼品卡; * fangShi2.JiFen = jiFen2; * fangShi2.JinE = jinE2; * * info.FangShis.Add(fangShi2); * }*/ if (jiFen3 > 0 || jinE3 > 0) { fangShi3.FangShi = EyouSoft.Model.EnumType.YlStructure.JiFenDuiHuanFangShi.积分现金; fangShi3.JiFen = jiFen3; fangShi3.JinE = jinE3; info.FangShis.Add(fangShi3); } if (info.FangShis.Count == 0) { RCWE(UtilsCommons.AjaxReturnJson("0", "请填写积分兑换方式")); } int bllRetCode = 0; if (string.IsNullOrEmpty(ShangPinId)) { bllRetCode = new EyouSoft.BLL.YlStructure.BDuiHuan().InsertJiFenShangPin(info); } else { bllRetCode = new EyouSoft.BLL.YlStructure.BDuiHuan().UpdateJiFenShangPin(info); } if (bllRetCode == 1) { RCWE(UtilsCommons.AjaxReturnJson("1", "操作成功")); } else { RCWE(UtilsCommons.AjaxReturnJson("0", "操作失败")); } }