/// <summary> /// 更新V币详细 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateMSVAcctDetail(MSVAcctDetail model) { string safeslq = ""; safeslq = "UPDATE MS_VAcctDetail SET "; if (model.Amount != null && model.Amount.ToString() != "") { safeslq += "Amount=" + model.Amount + ","; } if (model.ChargeType != null && model.ChargeType.ToString() != "") { safeslq += "ChargeType='" + model.ChargeType + "',"; } if (model.Ext_Fld1 != null && model.Ext_Fld1.ToString() != "") { safeslq += "Ext_Fld1='" + model.Ext_Fld1 + "',"; } safeslq += " where CustID='" + model.CustID + "' and SiteCode='" + model.SiteCode + "' "; int rowsAffected = DbHelperSQL.ExecuteSql(safeslq.ToString()); if (rowsAffected > 0) { return(true); } else { return(false); } }
/// <summary> /// 添加V币详细 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool AddMSVAcctDetail(MSVAcctDetail model) { string sql = @"INSERT INTO [MS_VAcctDetail] ([CustID],[Amount],[ChargeType],[SiteCode],[Ext_Fld1],[IsReceive],[Vdate]) VALUES (@CustID,@Amount,@ChargeType,@SiteCode,@Ext_Fld1,@IsReceive,@Vdate)"; System.Data.SqlClient.SqlParameter[] paras = new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@CustID", model.CustID), new System.Data.SqlClient.SqlParameter("@Amount", model.Amount), new System.Data.SqlClient.SqlParameter("@ChargeType", model.ChargeType), new System.Data.SqlClient.SqlParameter("@SiteCode", model.SiteCode), new System.Data.SqlClient.SqlParameter("@Ext_Fld1", model.Ext_Fld1), new System.Data.SqlClient.SqlParameter("@IsReceive", (model.IsReceive == 1?1:0)), new System.Data.SqlClient.SqlParameter("@Vdate", DateTime.Now) }; int rowsAffected = DbHelperSQL.ExecuteSql(sql.ToString(), paras); if (rowsAffected > 0) { return(true); } else { return(false); } }
void GetHtmlPage() { int vcoin = 0; int IsReceive = 0; List <MSVAcctDetail> vcoindetaillist = new List <MSVAcctDetail>(); if (struid != null && struid != "") { MSVAcctDAL VAD = new MSVAcctDAL(); MSVAcctDetailDAL MVA = new MSVAcctDetailDAL(); #region -获取V币详细 //try //{ // IsReceive = Convert.ToInt32(MVA.GetMSVAcctDetailByUID("IsReceive", struid).ToString()); //} //catch (Exception) //{ //} try { vcoin = Convert.ToInt32(VAD.GetMSVAcct("V_Amont", struid).ToString()); } catch (Exception) { } //if (IsReceive == 0) //{ // vcoin = 0; //} #endregion #region -获取用户V币详情列表 string vcoinwhere = " Where CustID='" + struid + "' "; DataSet detailds = MVA.GetMSVAcctDetailList(vcoinwhere); if (detailds != null && detailds.Tables.Count > 0 && detailds.Tables[0].Rows.Count > 0) { foreach (DataRow item in detailds.Tables[0].Rows) { MSVAcctDetail vcoinmodel = DataConvert.DataRowToModel <MSVAcctDetail>(item); vcoindetaillist.Add(vcoinmodel); } } #endregion } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/Vcoin.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["errormsg"] = errormsg; context.TempData["vcoin"] = vcoin; context.TempData["vcoinlist"] = vcoindetaillist; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
/// <summary> /// 用户注册 /// </summary> void ToSaveUserInfo() { string inputphone = string.Empty; string logpwd = string.Empty; if (Request["inputphone"] != null && Request["inputphone"] != "") { inputphone = Common.Common.NoHtml(Request["inputphone"]); } if (Request["logpwd"] != null && Request["logpwd"] != "") { logpwd = Common.Common.NoHtml(Request["logpwd"]); } if (inputphone.Trim() != null && inputphone.Trim() != "" && logpwd.Trim() != null && logpwd.Trim() != "") { MSCustomersDAL customerDal = new MSCustomersDAL(); if (customerDal.ExistCustomer(strOpenID, inputphone, "", "")) { Response.Write("{\"error\":true,\"msg\":\"该用户已经存在\"}"); } else { MSCustomers customerModel = new MSCustomers(); string strID = string.Empty; strID = Guid.NewGuid().ToString("N").ToUpper(); customerModel.ID = strID; customerModel.Phone = inputphone; customerModel.OpenID = strOpenID; customerModel.NickName = regNickName; customerModel.Sex = regSex; customerModel.HeadImg = regHeadImg; customerModel.UserPwd = Common.Common.MD5(logpwd); customerModel.IsDel = 0; MSVAcctDetailDAL vacctdetailDal = new MSVAcctDetailDAL(); MSVAcctDAL vacctDal = new MSVAcctDAL(); if (customerDal.AddCustomers(customerModel)) { int vcount = 2; if (!vacctDal.ExistMSVAcct(strID, "")) { MSVAcct vaccModel = new MSVAcct(); vaccModel.CustID = strID; vaccModel.SiteCode = "VYIGO"; vaccModel.V_Amont = vcount; MSVAcctDetail vaccDetailModel = new MSVAcctDetail(); vaccDetailModel.Amount = vcount; vaccDetailModel.ChargeType = "注册"; vaccDetailModel.CustID = strID; vaccDetailModel.Ext_Fld1 = ""; vaccDetailModel.IsReceive = 1; vaccDetailModel.SiteCode = "VYIGO"; //vacctDal.AddMSVAcct(vaccModel); //vacctdetailDal.AddMSVAcctDetail(vaccDetailModel); } Response.Write("{\"success\":true,\"msg\":\"操作成功\"}"); } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}"); } } } Response.End(); }
void PrintPhoto(string imgsrc) { string imgname = string.Empty; string[] imgarray = imgsrc.Split('.'); imgname = imgarray[0]; string openid = string.Empty; if (userid != null && userid != "") { MSCustomersDAL customerDal = new MSCustomersDAL(); try { openid = customerDal.GetCustomerValueByID("OpenID", userid).ToString(); } catch (Exception) { } } if (openid == null || openid == "") { openid = strID; } DAL.HP.PhotoDAL dalPhoto = new DAL.HP.PhotoDAL(); //照片处理 strSFilePath = "../../PalmShop/ShopCode/" + imgsrc; strFilePath = imgsrc; string[] urls = strSFilePath.Split('.'); string _url = openid + "." + urls.Last(); string saveurl = "../../HP_Photo/"; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } string inputurl = Server.MapPath("../../PalmShop/ShopCode/") + strFilePath; string outputurl = Server.MapPath("../../HP_Photo/") + _url; int width = 260; int height = 310; System.IO.FileStream fs = new System.IO.FileStream(inputurl, System.IO.FileMode.Open); //ZoomAuto(fs, outputurl,width, height, "", ""); CutForCustom(fs, outputurl, width, height, 100); fs.Close(); string SiteCode = "VYIGO"; if (Session["strSiteCode"].ToString() != null && Session["strSiteCode"].ToString() != "") { SiteCode = Session["strSiteCode"].ToString(); } // DAL.HP.PrintCodeDAL dalPrintCode = new DAL.HP.PrintCodeDAL(); // DataSet printds = dalPrintCode.AddPrintCode(1, SiteCode,"0000", "2014-01-01", "2019-12-31"); //string strPID = string.Empty; //if (printds != null && printds.Tables.Count > 0 && printds.Tables[0].Rows.Count > 0) //{ // strPID = printds.Tables[0].Rows[0]["ID"].ToString(); //} string strPID = Guid.NewGuid().ToString("N"); Model.HP.Photo modelPhoto = new Model.HP.Photo() { ID = strPID, OpenId = openid, SiteCode = SiteCode, ClientID = "WSY01", PrintCode = "1111", Img = openid + "." + imgsrc.Split('.').Last(), AttachText = AttachText.Text + "\r\n" }; dalPhoto.InsertInfo(modelPhoto); //插入V币记录 if (userid != null && userid != "" && strPID != null && strPID != "") { int award = GetAwardChance(); MSVAcct msvModel = new MSVAcct(); MSVAcctDAL msvDal = new MSVAcctDAL(); MSVAcctDetail msvdetailModel = new MSVAcctDetail(); MSVAcctDetailDAL msvdetailDal = new MSVAcctDetailDAL(); if (!msvDal.ExistMSVAcct(userid, SiteCode)) { msvModel.CustID = userid; msvModel.SiteCode = SiteCode; msvModel.V_Amont = award; msvDal.AddMSVAcct(msvModel); } else { int count = Convert.ToInt32(msvDal.GetMSVAcct("V_Amont", userid).ToString()); count = count + award; msvModel.CustID = userid; msvModel.SiteCode = SiteCode; msvModel.V_Amont = count; msvDal.UpdateMSVAcct(msvModel); } msvdetailModel.CustID = userid; msvdetailModel.Amount = award; msvdetailModel.ChargeType = "首次购物"; msvdetailModel.Ext_Fld1 = strPID; msvdetailModel.SiteCode = SiteCode; msvdetailDal.AddMSVAcctDetail(msvdetailModel); } //插入活动券 if (!string.IsNullOrEmpty(openid)) { string strGuid = Guid.NewGuid().ToString("N"); DAL.ACT.CouponDAL cdal = new DAL.ACT.CouponDAL(); if (!cdal.ExistCoupon(SiteCode, "56DBFD79AFF94FD6B0FE7E72CE7589E6", openid)) { Model.ACT.Coupon coupon = null; coupon = new Model.ACT.Coupon() { ID = strGuid, SiteCode = SiteCode, SiteActivityID = "56DBFD79AFF94FD6B0FE7E72CE7589E6", OpenID = openid, CouponStatus = 0 }; cdal.InsertInfo(coupon); } } }