protected void init_form(string ctrID) { if (!string.IsNullOrEmpty(ctrID)) { _WG_ScoreEntity = DataProvider.GetInstance().GetWG_ScoreEntity(int.Parse(ctrID)); TextBox_MenberID.Text = _WG_ScoreEntity.MenberID.ToString(); TextBox_Scores.Text = _WG_ScoreEntity.Scores.ToString(); TextBox_Title.Text = _WG_ScoreEntity.Title.ToString(); } }
private MideFrameWork.Data.Entity.WG_ScoreEntity GetWG_Score(DataRow dr) { MideFrameWork.Data.Entity.WG_ScoreEntity info = new MideFrameWork.Data.Entity.WG_ScoreEntity(); if(DBNull.Value==dr["ID"]) info.ID=0; else info.ID=int.Parse(dr["ID"].ToString()); if(DBNull.Value==dr["MenberID"]) info.MenberID=0; else info.MenberID=int.Parse(dr["MenberID"].ToString()); if(DBNull.Value==dr["Scores"]) info.Scores=0; else info.Scores=int.Parse(dr["Scores"].ToString()); if(DBNull.Value==dr["Title"]) info.Title= string.Empty; else info.Title= dr["Title"].ToString(); if(DBNull.Value==dr["CreateDate"]) info.CreateDate=DateTime.Now; else info.CreateDate=DateTime.Parse(dr["CreateDate"].ToString()); return info; }
protected void WG_ScoreAdd() { #region 判断是否可空 var _MenberID = Request.Form["TextBox_MenberID"]; if (string.IsNullOrEmpty(_MenberID)) { Alert("[ 会员ID ]不能为空"); return; } var _Scores = Request.Form["TextBox_Scores"]; if (string.IsNullOrEmpty(_Scores)) { Alert("[ 积分数 ]不能为空"); return; } var _Title = Request.Form["TextBox_Title"]; if (string.IsNullOrEmpty(_Title)) { Alert("[ 积分说明 ]不能为空"); return; } #endregion #region 获取数据 WG_ScoreEntity _WG_ScoreEntity = new WG_ScoreEntity(); _WG_ScoreEntity.MenberID =Convert.ToInt32(_MenberID.ToString()); _WG_ScoreEntity.Scores =Convert.ToInt32(_Scores.ToString()); _WG_ScoreEntity.Title =Convert.ToString(_Title.ToString()); _WG_ScoreEntity.CreateDate =DateTime.Now; try { DataProvider.GetInstance().AddWG_Score(_WG_ScoreEntity); } catch { WriteLog("WG_ScoreAdd", "添加WG_Score", "插入数据库时出错", Common.DailyUtility.MideSmsType.LogType.SystemLog); Alert("添加数据时出错,请重试"); return; } Alert("添加WG_Score成功"); }
public void ProcessRequest(HttpContext context) { context.Response.AddHeader("Access-Control-Allow-Origin", "*"); context.Response.AddHeader("Access-Control-Allow-Methods", "POST"); context.Response.AddHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); context.Response.ContentType = "text/plain"; JsonBaseObject jbo = new JsonBaseObject(); string result = string.Empty; try { string username = context.Request["username"]; string psw = context.Request["psw"]; if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(psw)) { jbo.code = -1; jbo.data = null; jbo.message = "账号或密码不能为空!"; jbo.success = false; result = JsonSerializer<JsonBaseObject>(jbo); context.Response.Write(result); } string whereStr = " Name ='" + username + "'"; IList<WG_MenberEntity> userList = DataProvider.GetInstance().GetWG_MenberList(whereStr); if (userList.Count > 0) { jbo.code = -1; jbo.data = null; jbo.message = "该用户已存在!"; jbo.success = false; } else { try { string sex = context.Request["sex"]; //设置默认 string avatar_url = ConfigurationManager.AppSettings["HostUrl"].ToString()+"imgs/" + context.Request["avatar_url"]; //sex == "男" ? "http://120.24.230.139/AppData/imgs/man.jpg" : "http://120.24.230.139/AppData/imgs/woman.jpg";//context.Request["avatar_url"]; string nickname = context.Request["nickname"]; string birthday = context.Request["birthday"]; string phoneNumber = context.Request["phoneNumber"]; string email = context.Request["email"]; string QQnumber = context.Request["QQnumber"]; string country = context.Request["country"]; string province = context.Request["province"]; string city = context.Request["city"]; string district = context.Request["district"]; string town = context.Request["town"]; string community = context.Request["community"]; string personalid = context.Request["identity"]; string address = context.Request["address"]; string weixinNumber = context.Request["weixinNumber"]; string education = context.Request["education"]; string profession = context.Request["profession"]; string speciality = context.Request["speciality"]; string intention = context.Request["intention"]; string intentionTime = context.Request["intentionTime"]; string flag = context.Request["flag"]; WG_MenberEntity menber = new WG_MenberEntity(); menber.Name = username; menber.NickName = nickname; menber.Psw = psw; menber.Sex = sex; menber.PhotoUrl = avatar_url; menber.Birthday = birthday; menber.Phone = phoneNumber; menber.Email = email; menber.QQ = QQnumber; menber.Country = country; menber.Province = province; menber.City = city; menber.District = district; menber.Town = town; menber.Community = community; menber.PersonalID = personalid; menber.Address = address; menber.WeChat = weixinNumber; menber.Education = education; menber.Major = profession; menber.SpecialSkill = speciality; menber.ServiceIntention = intention; menber.ServiceTimeInterval = intentionTime; //0为游客,1位求助者,2为志愿者。求助者和自愿者才需要审核 if (int.Parse(flag) > 0) menber.Status = 1;//状态:0正常,1待审核,2状态异常 else { menber.Status = 0; } menber.Flag = int.Parse(flag); menber.Scores = 100;//初始积分100 menber.ServiceHours = 0;///初始服务时长为0 menber.CreateDate = DateTime.Now; menber.UpdateDate = DateTime.Now; //新增用户 int mID = DataProvider.GetInstance().AddWG_Menber(menber); //新增得分明细表 WG_ScoreEntity se = new WG_ScoreEntity(); se.MenberID = mID; se.Scores = int.Parse(ConfigurationManager.AppSettings["DefaultScore"].ToString()); se.CreateDate = DateTime.Now; se.Title = "新用户注册获得" + se.Scores + "积分"; DataProvider.GetInstance().AddWG_Score(se); //看看是否心中其他表 #region 通知用户主程成功,等待审核 add by frde 20160130 NoticeEntity ne = new NoticeEntity(); ne.FromUserID = 0; ne.ToUserID = mID.ToString(); ne.Title = "注册成功"; ne.CreateDate = DateTime.Now; ne.NoticeContent = "您的账号注册成功,请等待审核认证。"; //给用户一条消息 DataProvider.GetInstance().AddNotice(ne); #endregion //返回数据 menber.ID = mID; jbo.code = 0; jbo.data = menber; jbo.message = "注册成功!"; jbo.success = true; } catch (Exception ex) { jbo.code = -1; jbo.data = null; jbo.message = "注册过程中发生异常!"; jbo.success = false; } } } catch (Exception ex) { //失败 jbo.code = -1; jbo.data = null; jbo.message = "接口调用过程中出现其他错误"; jbo.success = false; } #region 返回json result = JsonSerializer<JsonBaseObject>(jbo); context.Response.Write(result); #endregion }