/// <summary> /// 查询该月的消费信息 /// </summary> /// <param name="user"></param> /// <param name="month">如果为0,则表示当月的数据,</param> private void bindMonthXFinfo(Model.wx_ucard_users user, int month) { int year = DateTime.Now.Year; int todayMonth = DateTime.Now.Month; if (month == 0) { month = todayMonth; } IList <Model.wx_ucard_users_consumeinfo> clist = cBll.GetModelList("sId=" + sid + " and uid=" + user.id + " and moduleType!='签到' and year(addTime)=" + year + " and month(addTime)=" + month + " order by addTime desc"); StringBuilder xfSb = new StringBuilder(""); decimal ttMoney = 0; int ttScore = 0; if (clist != null && clist.Count > 0) { Model.wx_ucard_users_consumeinfo c = new Model.wx_ucard_users_consumeinfo(); for (int i = 0; i < clist.Count; i++) { c = clist[i]; xfSb.Append("<tr><td>" + c.addTime.Value.ToString("yyyy-MM-dd") + "</td> <td>" + MyCommFun.Obj2Decimal(c.consumeMoney, 0) + "</td> <td>" + MyCommFun.Obj2Int(c.score) + "</td> </tr>"); ttMoney += MyCommFun.Obj2Decimal(c.consumeMoney, 0); ttScore += MyCommFun.Obj2Int(c.score); } BindDaysDetailInfo(clist); } litXFStr.Text = xfSb.ToString(); litttMoney.Text = ttMoney.ToString(); litttScore.Text = ttScore.ToString(); }
/// <summary> /// 商品的sku库存信息 /// </summary> /// <returns></returns> private List <Model.wx_shop_sku> AddSku() { List <Model.wx_shop_sku> skulist = new List <Model.wx_shop_sku>(); string attrStr = hidSkuVauleStr.Value; if (attrStr == null || attrStr.Trim() == "") { return(null); } string[] attrStrArr = Utils.SplitString(attrStr, "||"); string[] tmpattrValue; Model.wx_shop_sku attrEntity = new Model.wx_shop_sku(); foreach (string attr in attrStrArr) { if (attr.Length <= 0) { continue; } tmpattrValue = Utils.SplitString(attr, "_"); if (tmpattrValue != null && tmpattrValue.Length > 0) { attrEntity = new Model.wx_shop_sku(); attrEntity.attributeId = MyCommFun.Str2Int(tmpattrValue[1]); attrEntity.price = MyCommFun.Obj2Decimal(tmpattrValue[3], 0); attrEntity.attributeValue = MyCommFun.ObjToStr(tmpattrValue[5]); skulist.Add(attrEntity); } } return(skulist); }
private bool DoAdd() { #region Model 赋值 //产品编号 ModelInfo.sProductNum = MyCommFun.ObjToStr(productID); //产品规格 ModelInfo.sName = this.txt_sName.Text.Trim(); //排序序号 ModelInfo.sSortNum = MyCommFun.Obj2Int(this.txtSortid.Text.ToString()); //计量单位 ModelInfo.sUnit = this.txt_sUnit.Text; //重量 ModelInfo.sWeight = MyCommFun.Obj2Decimal(this.txt_sWeight.Text, 0); //体积 ModelInfo.sVolume = MyCommFun.Obj2Decimal(this.txt_sVolume.Text, 0); //价格 ModelInfo.sPrice = MyCommFun.Obj2Decimal(this.txt_sPrice.Text, 0); //备注 //ModelInfo.sRemark = this.txt_Remark.Text.Trim(); #endregion if (bll.Insert(ModelInfo) > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加产品规格:" + ModelInfo.sName); //记录日志 return(true); } return(false); }
private bool DoEdit(int _id) { bool result = false; #region Model 赋值 //全局唯一键 ModelInfo.ID = _id; //产品编号 ModelInfo.sProductNum = MyCommFun.ObjToStr(productID); //产品规格 ModelInfo.sName = this.txt_sName.Text.Trim(); //排序序号 ModelInfo.sSortNum = MyCommFun.Obj2Int(this.txtSortid.Text.ToString()); //计量单位 ModelInfo.sUnit = this.txt_sUnit.Text; //重量 ModelInfo.sWeight = MyCommFun.Obj2Decimal(this.txt_sWeight.Text, 0); //体积 ModelInfo.sVolume = MyCommFun.Obj2Decimal(this.txt_sVolume.Text, 0); //价格 ModelInfo.sPrice = MyCommFun.Obj2Decimal(this.txt_sPrice.Text, 0); //备注 //ModelInfo.sRemark = this.txt_Remark.Text.Trim(); #endregion if (bll.Update(ModelInfo)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改产品规格:" + ModelInfo.sName); //记录日志 result = true; } return(result); }
private bool DoEdit(int _id) { bool result = false; #region Model 赋值 //全局唯一键 ModelInfo.ID = _id; //存放仓库 ModelInfo.WareHouse = ddl_WareHouse.SelectedValue; //客户姓名 ModelInfo.CustomerName = txt_CustomerName.Text.Trim(); //移动电话 ModelInfo.Mobile = txt_Mobile.Text.Trim(); //固定电话 ModelInfo.Tel = txt_Tel.Text.Trim(); //代发银行 ModelInfo.BankName = ddl_BankName.SelectedValue; //银行账号 ModelInfo.BankAccount = txt_BankAccount.Text.Trim(); //户名 ModelInfo.AccountName = txt_AccountName.Text.Trim(); //产品名称ID ModelInfo.ProjectId = MyCommFun.Obj2Int(ddl_ProductName.SelectedValue); //产品名称 ModelInfo.ProductName = ddl_ProductName.SelectedItem.Text; //产品规格ID ModelInfo.ProductStandardId = MyCommFun.Obj2Int(ddl_ProductStandard.SelectedValue); //产品规格名称 ModelInfo.ProductStandard = ddl_ProductStandard.SelectedItem.Text; //单位 ModelInfo.Unit = txt_Unit.Text.Trim(); //毛重 ModelInfo.GrossWeight = MyCommFun.Obj2Decimal(txt_GrossWeight.Text, 0); //皮重 ModelInfo.Tare = MyCommFun.Obj2Decimal(txt_Tare.Text, 0); //净重 ModelInfo.NetWeight = MyCommFun.Obj2Decimal(txt_NetWeight.Value, 0); //价格 ModelInfo.Price = MyCommFun.Obj2Decimal(txt_Price.Text, 0); //金额 ModelInfo.Amount = MyCommFun.Obj2Decimal(txt_Amount.Value, 0); //备注 ModelInfo.Remark = this.txt_Remark.Text.Trim(); //修改人 ModelInfo.ModifyPerson = manager_model.real_name; //修改时间 ModelInfo.ModifyTime = DateTime.Now; #endregion if (bll.Update(ModelInfo)) { AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改收料单:" + ModelInfo.BNum); //记录日志 result = true; } return(result); }
private bool DoAdd() { #region Model 赋值 //收料编号 ModelInfo.BNum = Item.BLL.Common.GetMinSerial.GetMinBH("T_Bill", "BNum", DateTime.Now.ToString("yyMMdd"), 4); //存放仓库 ModelInfo.WareHouse = ddl_WareHouse.SelectedValue; //客户姓名 ModelInfo.CustomerName = txt_CustomerName.Text.Trim(); //移动电话 ModelInfo.Mobile = txt_Mobile.Text.Trim(); //固定电话 ModelInfo.Tel = txt_Tel.Text.Trim(); //代发银行 ModelInfo.BankName = ddl_BankName.SelectedValue; //银行账号 ModelInfo.BankAccount = txt_BankAccount.Text.Trim(); //户名 ModelInfo.AccountName = txt_AccountName.Text.Trim(); //产品名称ID ModelInfo.ProjectId = MyCommFun.Obj2Int(ddl_ProductName.SelectedValue); //产品名称 ModelInfo.ProductName = ddl_ProductName.SelectedItem.Text; //产品规格ID ModelInfo.ProductStandardId = MyCommFun.Obj2Int(ddl_ProductStandard.SelectedValue); //产品规格名称 ModelInfo.ProductStandard = ddl_ProductStandard.SelectedItem.Text; //单位 ModelInfo.Unit = txt_Unit.Text.Trim(); //毛重 ModelInfo.GrossWeight = MyCommFun.Obj2Decimal(txt_GrossWeight.Text, 0); //皮重 ModelInfo.Tare = MyCommFun.Obj2Decimal(txt_Tare.Text, 0); //净重 ModelInfo.NetWeight = MyCommFun.Obj2Decimal(txt_NetWeight.Value, 0); //价格 ModelInfo.Price = MyCommFun.Obj2Decimal(txt_Price.Text, 0); //金额 ModelInfo.Amount = MyCommFun.Obj2Decimal(txt_Amount.Value, 0); //备注 ModelInfo.Remark = this.txt_Remark.Text.Trim(); //添加人 ModelInfo.AddPerson = manager_model.real_name; //添加时间 ModelInfo.AddTime = DateTime.Now; #endregion result = bll.Insert(ModelInfo); if (result > 0) { AddAdminLog(MXEnums.ActionEnum.Add.ToString(), "添加收料单:" + ModelInfo.BNum); //记录日志 return(true); } return(false); }
//保存 protected void btnSubmit_Click(object sender, EventArgs e) { decimal accb = MyCommFun.Obj2Decimal(txtaccountBalance.Text.Trim(), -1); if (accb == -1) { JscriptMsg("余额输入有错误!", "", "Error"); return; } BLL.wx_xjhongbao_base wxpayBll = new wx_xjhongbao_base(); int id = MyCommFun.Obj2Int(hidId.Value, 0); Model.wx_xjhongbao_base baseModel = new Model.wx_xjhongbao_base(); if (id == 0) { //新增 Model.wx_userweixin weixin = GetWeiXinCode(); baseModel.wid = weixin.id; baseModel.createDate = DateTime.Now; baseModel.totalLQMoney = 0; } else { //修改 baseModel = wxpayBll.GetModel(id); } baseModel.accountBalance = (int)(accb * 100); baseModel.remark = txtremark.Value.Trim(); bool ret = false; if (id == 0) { int retNum = wxpayBll.Add(baseModel); if (retNum > 0) { ret = true; } } else { ret = wxpayBll.Update(baseModel); } if (ret) { JscriptMsg("修改信息成功!", "basesetting.aspx", "Success"); } else { JscriptMsg("保存过程中发生错误!", "", "Error"); return; } }
/// <summary> /// 更新一条记录,并且将用户的总积分随之变动 /// </summary> /// <param name="model"></param> /// <param name="oldMoney"></param> /// <param name="oldScore"></param> /// <returns></returns> public bool UpdateInfoAndUserTT(MxWeiXinPF.Model.wx_ucard_users_consumeinfo model, decimal oldMoney, int oldScore) { using (SqlConnection conn = new SqlConnection(DbHelperSQL.connectionString)) { conn.Open(); using (SqlTransaction trans = conn.BeginTransaction()) { try { StringBuilder strSql = new StringBuilder(); strSql.Append("update wx_ucard_users_consumeinfo set "); strSql.Append("sId=@sId,"); strSql.Append("uid=@uid,"); strSql.Append("moduleType=@moduleType,"); strSql.Append("moduleTypeId=@moduleTypeId,"); strSql.Append("moduleActionName=@moduleActionName,"); strSql.Append("moduleActionId=@moduleActionId,"); strSql.Append("cScoreType=@cScoreType,"); strSql.Append("score=@score,"); strSql.Append("cMoneyType=@cMoneyType,"); strSql.Append("consumeMoney=@consumeMoney,"); strSql.Append("cContent=@cContent,"); strSql.Append("remark=@remark,"); strSql.Append("addTime=@addTime,"); strSql.Append("sort_id=@sort_id,"); strSql.Append("sn=@sn,"); strSql.Append("operName=@operName,"); strSql.Append("pwd=@pwd"); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@sId", SqlDbType.Int, 4), new SqlParameter("@uid", SqlDbType.Int, 4), new SqlParameter("@moduleType", SqlDbType.VarChar, 80), new SqlParameter("@moduleTypeId", SqlDbType.Int, 4), new SqlParameter("@moduleActionName", SqlDbType.VarChar, 200), new SqlParameter("@moduleActionId", SqlDbType.Int, 4), new SqlParameter("@cScoreType", SqlDbType.Int, 4), new SqlParameter("@score", SqlDbType.Int, 4), new SqlParameter("@cMoneyType", SqlDbType.Int, 4), new SqlParameter("@consumeMoney", SqlDbType.Float, 8), new SqlParameter("@cContent", SqlDbType.VarChar, 800), new SqlParameter("@remark", SqlDbType.VarChar, 300), new SqlParameter("@addTime", SqlDbType.DateTime), new SqlParameter("@sort_id", SqlDbType.Int, 4), new SqlParameter("@sn", SqlDbType.VarChar, 50), new SqlParameter("@operName", SqlDbType.VarChar, 50), new SqlParameter("@pwd", SqlDbType.VarChar, 50), new SqlParameter("@id", SqlDbType.Int, 4) }; parameters[0].Value = model.sId; parameters[1].Value = model.uid; parameters[2].Value = model.moduleType; parameters[3].Value = model.moduleTypeId; parameters[4].Value = model.moduleActionName; parameters[5].Value = model.moduleActionId; parameters[6].Value = model.cScoreType; parameters[7].Value = model.score; parameters[8].Value = model.cMoneyType; parameters[9].Value = model.consumeMoney; parameters[10].Value = model.cContent; parameters[11].Value = model.remark; parameters[12].Value = model.addTime; parameters[13].Value = model.sort_id; parameters[14].Value = model.sn; parameters[15].Value = model.operName; parameters[16].Value = model.pwd; parameters[17].Value = model.id; DbHelperSQL.ExecuteSql(conn, trans, strSql.ToString(), parameters); StringBuilder strSql2 = new StringBuilder(); strSql2.Append("update wx_ucard_users set ttScore=ttScore-@oldscore+@newscore, consumeMoney=consumeMoney-@oldMoney+@newMoney where id=@uid"); SqlParameter[] parameters2 = { new SqlParameter("@oldscore", SqlDbType.Int, 4), new SqlParameter("@newscore", SqlDbType.Int, 4), new SqlParameter("@oldMoney", SqlDbType.Decimal, 4), new SqlParameter("@newMoney", SqlDbType.Decimal, 4), new SqlParameter("@uid", SqlDbType.Int, 4) }; parameters2[0].Value = oldScore; parameters2[1].Value = MyCommFun.Obj2Int(model.score); parameters2[2].Value = oldMoney; parameters2[3].Value = MyCommFun.Obj2Decimal(model.consumeMoney, 0); parameters2[4].Value = model.uid; DbHelperSQL.ExecuteSql(conn, trans, strSql2.ToString(), parameters2); trans.Commit(); } catch { trans.Rollback(); return(false); } } } return(true); }
/// <summary> /// 增加一条数据 /// </summary> /// <param name="model"></param> /// <param name="isXiaoFei">是否为消费积分</param> /// <returns></returns> public int Add(MxWeiXinPF.Model.wx_ucard_users_consumeinfo model, bool isXiaoFei) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into wx_ucard_users_consumeinfo("); strSql.Append("sId,uid,moduleType,moduleTypeId,moduleActionName,moduleActionId,cScoreType,score,cMoneyType,consumeMoney,cContent,remark,addTime,sort_id,sn,operName,pwd)"); strSql.Append(" values ("); strSql.Append("@sId,@uid,@moduleType,@moduleTypeId,@moduleActionName,@moduleActionId,@cScoreType,@score,@cMoneyType,@consumeMoney,@cContent,@remark,@addTime,@sort_id,@sn,@operName,@pwd)"); strSql.Append(";set @ReturnValue= @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@sId", SqlDbType.Int, 4), new SqlParameter("@uid", SqlDbType.Int, 4), new SqlParameter("@moduleType", SqlDbType.VarChar, 80), new SqlParameter("@moduleTypeId", SqlDbType.Int, 4), new SqlParameter("@moduleActionName", SqlDbType.VarChar, 200), new SqlParameter("@moduleActionId", SqlDbType.Int, 4), new SqlParameter("@cScoreType", SqlDbType.Int, 4), new SqlParameter("@score", SqlDbType.Int, 4), new SqlParameter("@cMoneyType", SqlDbType.Int, 4), new SqlParameter("@consumeMoney", SqlDbType.Float, 8), new SqlParameter("@cContent", SqlDbType.VarChar, 800), new SqlParameter("@remark", SqlDbType.VarChar, 300), new SqlParameter("@addTime", SqlDbType.DateTime), new SqlParameter("@sort_id", SqlDbType.Int, 4), new SqlParameter("@sn", SqlDbType.VarChar, 50), new SqlParameter("@operName", SqlDbType.VarChar, 50), new SqlParameter("@pwd", SqlDbType.VarChar, 50), new SqlParameter("@ReturnValue", SqlDbType.Int) }; parameters[0].Value = model.sId; parameters[1].Value = model.uid; parameters[2].Value = model.moduleType; parameters[3].Value = model.moduleTypeId; parameters[4].Value = model.moduleActionName; parameters[5].Value = model.moduleActionId; parameters[6].Value = model.cScoreType; parameters[7].Value = model.score; parameters[8].Value = model.cMoneyType; parameters[9].Value = model.consumeMoney; parameters[10].Value = model.cContent; parameters[11].Value = model.remark; parameters[12].Value = model.addTime; parameters[13].Value = model.sort_id; parameters[14].Value = model.sn; parameters[15].Value = model.operName; parameters[16].Value = model.pwd; parameters[17].Direction = ParameterDirection.Output; List <CommandInfo> sqllist = new List <CommandInfo>(); CommandInfo cmd = new CommandInfo(strSql.ToString(), parameters); sqllist.Add(cmd); StringBuilder strSql2 = new StringBuilder(); string xfStr = ""; if (isXiaoFei) { xfStr = ",consumeScore=consumeScore+" + (model.score == null ? 0 : model.score.Value); } strSql2.Append("update wx_ucard_users set ttScore=ttScore+@newscore , consumeMoney=consumeMoney+@newMoney" + xfStr + " where id=@uid"); SqlParameter[] parameters2 = { new SqlParameter("@newscore", SqlDbType.Int, 4), new SqlParameter("@newMoney", SqlDbType.Decimal, 4), new SqlParameter("@uid", SqlDbType.Int, 4) }; parameters2[0].Value = MyCommFun.Obj2Int(model.score); parameters2[1].Value = MyCommFun.Obj2Decimal(model.consumeMoney, 0); parameters2[2].Value = model.uid; cmd = new CommandInfo(strSql2.ToString(), parameters2); sqllist.Add(cmd); DbHelperSQL.ExecuteSqlTranWithIndentity(sqllist); return((int)parameters[17].Value); }
/// <summary> /// 绑定每天消费的详情 /// </summary> /// <param name="clist"></param> private void BindDaysDetailInfo(IList <Model.wx_ucard_users_consumeinfo> clist) { StringBuilder dStr = new StringBuilder(""); Model.wx_ucard_users_consumeinfo tmpCon = clist[0]; IList <Model.wx_ucard_users_consumeinfo> tmplist = (from c in clist where c.addTime.Value.Year == tmpCon.addTime.Value.Year && c.addTime.Value.Month == tmpCon.addTime.Value.Month && c.addTime.Value.Day == tmpCon.addTime.Value.Day select c).ToArray <Model.wx_ucard_users_consumeinfo>(); if (tmplist != null) { decimal ttMoney = tmplist.Sum(t => t.consumeMoney == null ? 0 : t.consumeMoney.Value); int ttScore = tmplist.Sum(t => t.score == null ? 0 : t.score.Value); //处理逻辑 dStr.Append(" <div id=\"test" + tmpCon.id + "-header\" class=\"accordion_headings\">"); dStr.Append(" <div class=\"tab\"> <span class=\"title\">" + tmpCon.addTime.Value.ToString("yyyy-MM-dd") + "消费详情<p>消费" + ttMoney + "元 获得积分" + ttScore + "分</p>"); dStr.Append(" </span> </div>"); dStr.Append(" <div id=\"test" + tmpCon.id + "-content\" style=\"display: none; overflow: hidden;\">"); dStr.Append(" <div class=\"accordion_child\">"); dStr.Append(" <table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" class=\"integral_table\">"); dStr.Append("<thead> <tr> <th>消费详情</th> <th>消费金额</th> <th>积分</th> </tr> </thead> <tbody>"); for (int i = 0; i < tmplist.Count; i++) { dStr.Append(" <tr> <td>" + tmplist[i].moduleActionName + "</td> <td>" + MyCommFun.Obj2Decimal(tmplist[i].consumeMoney, 0) + "</td> <td>" + MyCommFun.Obj2Int(tmplist[i].score) + "</td> </tr>"); clist.Remove(tmplist[i]); } dStr.Append(" </tbody> <tfoot> <tr> <td class=\"right\">合计</td> <td><span class=\"heji\">" + ttMoney + "元 </span></td> <td><span class=\"heji\">" + ttScore + " 积分 </span></td>"); dStr.Append(" </tr> </tfoot> </table> </div> </div> </div>"); detailStr += dStr.ToString(); //最终 if (clist.Count > 0) { BindDaysDetailInfo(clist); } } }