//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.MechanicalEntity MechanicalEntity = new Entity.MechanicalEntity(); Entity.UserEntity parent = new Entity.UserEntity(); Entity.ContactEntity contactEnitty = new Entity.ContactEntity(); if (Request["schClassgcid"] == null || string.IsNullOrEmpty(Request["schClassgcid"].ToString())) { FinalMessage("班级无效!", "Mechanical_Add.aspx", 0); return; } //学生实体相关信息保存 MechanicalEntity.ClassName = ""; MechanicalEntity.Gid = int.Parse(Request["schClassgcid"]); MechanicalEntity.MechIMEI = this.MechIMEI.Text; MechanicalEntity.MechName = this.MechName.Text; MechanicalEntity.MechPhone = this.MechPhone.Text; //保存数据 try { new Daiv_OA.BLL.MechanicalBLL().Add(MechanicalEntity); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "Mechanical_Add.aspx", 1); return; } FinalMessage("操作成功", "Mechanical_List.aspx", 0); }
/// <summary> /// 获取热门标签(索引) /// </summary> /// <param name="type">类型</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.TagsEntity.Root getHotTags(string type, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.type = type; userEntity.imei = IMEI; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/SearchIndex?type=" + type + "&IMEI=" + IMEI + "&postkey=" + getThisKey("SearchIndex", userEntity); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.TagsEntity.Root it = jss.Deserialize <Entity.TagsEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取热门标签失败,原因为:", ex); throw ex; } }
/// <summary> /// 根据分类ID获取视频 /// </summary> /// <param name="page">分页</param> /// <param name="IMEI">手机IMEI码</param> /// <param name="categoryId">分类ID</param> /// <returns></returns> public Entity.MovieListEntity.Root getCategoryVideo(string page, string IMEI, string categoryId) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.page = page; userEntity.imei = IMEI; userEntity.category = categoryId; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/CategoryVideo?Page=" + page + "&Category=" + categoryId + "&IMEI=" + IMEI + "&postkey=" + getThisKey("CategoryVideo", userEntity); Console.WriteLine("根据分类ID获取视频verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieListEntity.Root it = jss.Deserialize <Entity.MovieListEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取分类视频失败,原因为:", ex); throw ex; } }
/// <summary> /// 通过索引或标签进行视频搜索 /// </summary> /// <param name="page">页码</param> /// <param name="tag">搜索内容</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.MovieListEntity.Root searchVideoByTag(string page, string tag, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.search = tag; userEntity.imei = IMEI; userEntity.page = page; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/SearchVideo?Page=" + page + "&Search=" + SecurityHelper.EncodeUrl(tag) + "&IMEI=" + IMEI + "&postkey=" + getThisKey("SearchVideo", userEntity); Console.WriteLine("通过索引或标签进行视频搜索verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieListEntity.Root it = jss.Deserialize <Entity.MovieListEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("通过标签搜索视频失败,原因为:", ex); throw ex; } }
/// <summary> /// 获取视频详情 /// </summary> /// <param name="vid">视频ID</param> /// <param name="uid">用户ID</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.MovieEntity.Root getVideoDetail(string vid, string uid, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.vid = vid; userEntity.imei = IMEI; userEntity.uid = uid; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/VideoDetail?vid=" + vid + "&uid=" + uid + "&IMEI=" + IMEI + "&postkey=" + getThisKey("VideoDetail", userEntity); Console.WriteLine("视频详情verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovieEntity.Root it = jss.Deserialize <Entity.MovieEntity.Root>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取视频详情失败,原因为:", ex); throw ex; } }
/// <summary> /// 获取视频地址 /// </summary> /// <param name="email">用户邮箱</param> /// <param name="pwd">用户密码</param> /// <param name="vid">视频ID</param> /// <param name="type">类型</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public Entity.MovePlayEntity getVideoUrl(string email, string pwd, string vid, string type, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.vid = vid; userEntity.imei = IMEI; userEntity.email = email; userEntity.psw = pwd; userEntity.type = type; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/PlayVideo?mail=" + email + "&psw=" + pwd + "&vid=" + vid + "&Type=" + type + "&IMEI=" + IMEI + "&postkey=" + getThisKey("PlayVideo", userEntity); Console.WriteLine("视频地址verUrl:" + verUrl); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.MovePlayEntity it = jss.Deserialize <Entity.MovePlayEntity>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取视频播放地址失败,原因为:", ex); throw ex; } }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { int PId = 4; Entity.UserEntity userEntity = new Entity.UserEntity(); Entity.PowerEntity powerEntity = new BLL.PowerBLL().GetEntity(PId); userEntity.Pid = PId; userEntity.Uname = this.txtUname.Text; userEntity.Position = this.txtPosition.Text; userEntity.Setting = powerEntity.Setting; userEntity.Did = Str2Int(this.ddlDid.SelectedValue, 0); userEntity.Upwd = JumbotOA.Utils.MD5.Lower32(this.txtPwd.Text.Trim()); if (this.txtIpaddress.Text != "") { userEntity.Uipaddress = this.txtIpaddress.Text; } int i = new JumbotOA.BLL.UserBLL().Add(userEntity); if (i > 0) { Addadminlog("添加用户"); } else { FinalMessage("相同的用户已经存在", "", 1); } }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { int PId = 4; Entity.UserEntity userEntity = new Entity.UserEntity(); Entity.PowerEntity powerEntity = new BLL.PowerBLL().GetEntity(PId); userEntity.Pid = PId; userEntity.Uname = this.txtUname.Text; userEntity.Position = this.txtPosition.Text; userEntity.Setting = powerEntity.Setting; userEntity.Did = Str2Int(this.ddlDid.SelectedValue, 0); userEntity.Upwd = Daiv_OA.Utils.MD5.Lower32(this.txtPwd.Text.Trim()); if (this.txtIpaddress.Text != "") { userEntity.Uipaddress = this.txtIpaddress.Text; } int i = new Daiv_OA.BLL.UserBLL().Add(userEntity); if (i > 0) { Addadminlog("添加用户"); } else { FinalMessage("相同的用户已经存在", "", 1); } }
//个人密码修改 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.UserEntity model = new Entity.UserEntity(); model = new JumbotOA.BLL.UserBLL().GetEntity(UserId); model.Upwd = JumbotOA.Utils.MD5.Lower32(this.txtAgainpwd.Text.Trim()); new JumbotOA.BLL.UserBLL().Update(model); FinalMessage("操作成功", "Password_Edit.aspx", 0); }
//绑定 void Bind() { Entity.UserEntity model = new Entity.UserEntity(); model = new Daiv_OA.BLL.UserBLL().GetEntity(UserId); this.txtUname.Text = model.Uname; ViewState["pid"] = model.Pid.ToString(); this.txtUname.ReadOnly = true; }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.UserEntity model = new Entity.UserEntity(); model = new JumbotOA.BLL.UserBLL().GetEntity(Str2Int(q("id"), 0)); model.Upwd = JumbotOA.Utils.MD5.Lower32(this.txtAgainpwd.Text.Trim()); new JumbotOA.BLL.UserBLL().Update(model); Addadminlog("修改用户密码"); }
//个人密码修改 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.UserEntity model = new Entity.UserEntity(); model = new Daiv_OA.BLL.UserBLL().GetEntity(UserId); model.Upwd = Daiv_OA.Utils.MD5.Lower32(this.txtAgainpwd.Text.Trim()); new Daiv_OA.BLL.UserBLL().Update(model); FinalMessage("操作成功", "Password_Edit.aspx", 0); }
//绑定 void Bind() { Entity.UserEntity model = new Entity.UserEntity(); model = new JumbotOA.BLL.UserBLL().GetEntity(UserId); this.txtUname.Text = model.Uname; ViewState["pid"] = model.Pid.ToString(); this.txtUname.ReadOnly = true; }
public override long _AddUser(Entity.UserEntity user) { var contextUser = ((EntityProject.Utils.Repository <User>)context.GetRepository(typeof(User))); contextUser.Insert(EntityProject.Utils.UserFactoryDB.create(user.Username)); //Users[Users.Count - 1].SetId(Users.Count); contextUser.SubmitChanges(); return(contextUser.GetAll().Count()); }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.UserEntity model = new Entity.UserEntity(); model = new JumbotOA.BLL.UserBLL().GetEntity(Str2Int(q("id"), 0)); // model.Position = this.txtPosition.Text; model.Setting = "," + f("user_setting") + ","; model.Pid = Convert.ToInt32(DropDownList2.SelectedValue.ToString()); model.Did = Convert.ToInt32(DropDownList1.SelectedValue.ToString()); model.Uipaddress = this.txtIpaddress.Text; new JumbotOA.BLL.UserBLL().Update(model); Addadminlog("修改用户权限"); }
/// <summary> /// 获取uname /// </summary> /// <param name="kls_uid"></param> /// <param name="kls_pwd"></param> /// <param name="kls_num"></param> /// <returns></returns> public Entity.UserEntity Getuname(string sql) { Entity.UserEntity userEntity = new Entity.UserEntity(); SqlDataReader dr = DbHelperSQL.ExecuteReader(sql); if (dr.Read()) { userEntity.Uid = Convert.ToInt32(dr["Uid"]); userEntity.Pid = Convert.ToInt32(dr["Pid"]); userEntity.Uname = dr["Uname"].ToString(); userEntity.Upwd = dr["Upwd"].ToString(); } return(userEntity); }
/// <summary> /// 用户登录 /// </summary> /// <returns></returns> public Entity.UserInfoEntity MemberLogin(Entity.UserEntity userEntity) { try { string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/MemberLogin?mail=" + userEntity.email + "&psw=" + userEntity.psw + "&IMEI=" + userEntity.imei + "&postkey=" + getThisKey("MemberLogin", userEntity); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); JavaScriptSerializer jss = new JavaScriptSerializer(); Entity.UserInfoEntity it = jss.Deserialize <Entity.UserInfoEntity>(Reader); return(it); } catch (Exception ex) { Logger.Singleton.Error("获取销售信息失败,原因为:", ex); throw ex; } }
//删除数据 protected void lbDel_Click(object sender, CommandEventArgs e) { User_Load("student-list"); string oname = Getoname(); Daiv_OA.BLL.StudentBLL studentBll = new Daiv_OA.BLL.StudentBLL(); Daiv_OA.BLL.UserBLL userBll = new BLL.UserBLL(); int sid = Convert.ToInt32(e.CommandArgument); Entity.StudentEntity studentEntity = studentBll.GetEntity(sid); studentBll.Delete(sid); Entity.UserEntity userEntity = userBll.GetEntity(studentEntity.Uid); userBll.Delete(studentEntity.Uid);//连同家长的账号也一起删除 logHelper.logInfo("删除学生成功!操作人:" + oname); string stuStr = Newtonsoft.Json.JsonConvert.SerializeObject(studentEntity); string userStr = Newtonsoft.Json.JsonConvert.SerializeObject(studentEntity); logHelper.logInfo("删除学生:" + stuStr); logHelper.logInfo("删除家长:" + userStr); Adminlogadd(oname); Bind(); }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.SchoolGradeEntity SchoolGradeEntity = new Entity.SchoolGradeEntity(); Entity.UserEntity parent = new Entity.UserEntity(); Entity.ContactEntity contactEnitty = new Entity.ContactEntity(); //年级实体相关信息保存 SchoolGradeEntity.SchoolID = int.Parse(this.ddlGid.SelectedValue); SchoolGradeEntity.Name = this.Name.Text; SchoolGradeEntity.CreateDate = DateTime.Now; //保存数据 try { new Daiv_OA.BLL.SchoolGradeBLL().Add(SchoolGradeEntity); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "SchoolGrade_List.aspx?shid=" + schId, 1); return; } FinalMessage("操作成功", "SchoolGrade_List.aspx?shid=" + schId, 0); }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.SchoolEntity SchoolEntity = new Entity.SchoolEntity(); Entity.UserEntity parent = new Entity.UserEntity(); Entity.ContactEntity contactEnitty = new Entity.ContactEntity(); //学校实体相关信息保存 SchoolEntity.Address = this.Address.Text; SchoolEntity.Name = this.Name.Text; SchoolEntity.SchoolSerie = this.SchoolSerie.Text; SchoolEntity.CreateDate = DateTime.Now; //保存数据 try { new Daiv_OA.BLL.SchoolBLL().Add(SchoolEntity); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "School_List.aspx", 1); return; } FinalMessage("操作成功", "School_List.aspx", 0); }
/// <summary> /// 获取情报列表信息 /// </summary> /// <param name="page">页码</param> /// <param name="IMEI">手机IMEI码</param> /// <returns></returns> public string getArticleList(string page, string IMEI) { try { Entity.UserEntity userEntity = new Entity.UserEntity(); userEntity.page = page; userEntity.imei = IMEI; string verUrl = Utils.SecurityHelper.Decode(ApiHost) + Utils.SecurityHelper.Decode(uStr) + "/ArticleList?Page=" + page + "&IMEI=" + IMEI + "&postkey=" + getThisKey("ArticleList", userEntity); req = (HttpWebRequest)HttpWebRequest.Create(verUrl); //设置它提交数据的方式GET req.Method = "GET"; SecurityHelper.SetHeaderValue(req.Headers, "Host", Utils.SecurityHelper.Decode(hostStr)); StreamReader sr = new StreamReader(req.GetResponse().GetResponseStream()); //获取返回的数据 string Reader = sr.ReadToEnd(); return(Reader); } catch (Exception ex) { Logger.Singleton.Error("获取情报列表失败,原因为:", ex); throw ex; } }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { int PId = 1; Entity.UserEntity userEntity = new Entity.UserEntity(); Entity.PowerEntity powerEntity = new BLL.PowerBLL().GetEntity(PId); userEntity.Pid = PId; userEntity.Uname = this.txtUname.Text; userEntity.Position = this.txtPosition.Text; userEntity.Setting = powerEntity.Setting; userEntity.Upwd = Daiv_OA.Utils.MD5.Lower32(this.txtPwd.Text.Trim()); userEntity.UClassID = 0; userEntity.ULongName = this.ULongName.Text; userEntity.UClassName = ""; userEntity.Mphone = this.Mphone.Text; //检查电话号码 //if (!string.IsNullOrEmpty(Mphone.Text) && !Validator.IsMobileNum(Mphone.Text)) //{ // FinalMessage(Mphone.Text + "电话号码无效!", "" , 1); // return; //} if (this.txtIpaddress.Text != "") { userEntity.Uipaddress = this.txtIpaddress.Text; } int i = new Daiv_OA.BLL.UserBLL().Add(userEntity); if (i > 0) { Addadminlog("添加用户"); } else { FinalMessage("相同的用户已经存在", "", 1); } }
//通过参数获取被更改的用户名 string Getoname() { Entity.UserEntity model = new Entity.UserEntity(); model = new Daiv_OA.BLL.UserBLL().GetEntity(UserId); return(model.Uname); }
public override List <Entity.BaseModelEntity> GetAllModelsByUser(Entity.UserEntity user) { return(Models.Where(x => x.UserEntity.Id == user.Id).ToList());//? TODO no se que regresarte aqui }
//更新 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.StudentEntity model = new Entity.StudentEntity(); Daiv_OA.BLL.ContactBLL contactBll = new Daiv_OA.BLL.ContactBLL(); Daiv_OA.BLL.StudentBLL studentBll = new Daiv_OA.BLL.StudentBLL(); Daiv_OA.BLL.GradeBLL gradeBll = new BLL.GradeBLL(); string uuid = Guid.NewGuid().ToString("N"); //修改联系电话 //保存上传文件 string fName = UploadFile(uuid); string path = Path.Combine(Server.MapPath("/"), "upload/" + DateTime.Now.ToString("yyyy/MM").Replace("/", "").Substring(0, 6)); ImportExcel import = new ImportExcel(); import.LoadFile(path + "/" + fName); DataSet ds = import.GetAllTables(true); DataTable dataTable = ds.Tables[0]; //获取班级数据 List <Entity.GradeEntity> glist = gradeBll.GetModelList(""); if (glist == null || glist.Count <= 0) { logHelper.logInfo("未添加任何班级数据!"); FinalMessage("导入失败,请先添加班级数据!", "", 0); } #region 验证表格 //验证表格 if (dataTable.Rows.Count <= 0) { logHelper.logInfo(fName + ",未填写任何学生数据!"); FinalMessage(fName + ",未填写任何学生数据!", "", 0); return; } for (int i = 0; i < colmun.Length; i++) { if (colmun[i] != dataTable.Columns[i].ColumnName) { FinalMessage("导入的excel表与模板excel表不符合!", "", 0); message.Visible = true; return; } } //验证班级数据 int tbCount = dataTable.Rows.Count; string tempCName = string.Empty; if (Request["schClassgcid"] == null || string.IsNullOrEmpty(Request["schClassgcid"].ToString())) { FinalMessage("没有选择班级,请重新选择!", "", 0); return; } try { SchClassId = int.Parse(Request["schClassgcid"].ToString()); } catch (Exception ex) { FinalMessage("班级转换失败,请重新选择!", "", 0); return; } //for (int j = 0; j < tbCount; j++) //{ // tempCName = Convert.ToString(dataTable.Rows[j][colmun[2]]); // if (glist.Where(g=>g.Gname == tempCName).FirstOrDefault() == null) // { // logHelper.logInfo(tempCName + " 未匹配到此班级名称!"); // FinalMessage(tempCName + " 未匹配到此班级名称!", "", 0); // message.Visible = true; // return; // } //} //验证时间的有效性 for (int i = 0; i < tbCount; i++) { try { Convert.ToDateTime(dataTable.Rows[i][colmun[3]]); } catch (Exception) { logHelper.logInfo(string.Format("'{0}' 出生年月日无效!", tempCName)); FinalMessage(Convert.ToString(dataTable.Rows[i][colmun[1]]) + "学生出生时间无效!", "", 0); message.Visible = true; return; } //验证学号 //验证学生序号是否存在 string snumbertemp = Convert.ToString(dataTable.Rows[i][colmun[0]]); bool exixt = new Daiv_OA.BLL.StudentBLL().Exists(snumbertemp); Daiv_OA.BLL.ContactBLL ctBll = new Daiv_OA.BLL.ContactBLL(); if (exixt) { FinalMessage(snumbertemp + "相同的学生学号已经存在", "", 0); message.Visible = true; return; } } #endregion //遍历表格 Entity.StudentEntity studentEntity = null; Entity.UserEntity parent = null; Entity.ContactEntity contactEnitty = null; for (int i = 0; i < tbCount; i++) { studentEntity = new Entity.StudentEntity(); parent = new Entity.UserEntity(); contactEnitty = new Entity.ContactEntity(); //保存数据 try { //学生实体相关信息保存 studentEntity.Gname = glist.Where(g => g.Gid == SchClassId).FirstOrDefault().Gname; //班级名称 列索引:2 studentEntity.Gid = glist.Where(g => g.Gid == SchClassId).FirstOrDefault().Gid; studentEntity.Snumber = Convert.ToString(dataTable.Rows[i][colmun[0]]); //学生学号 列索引:0 studentEntity.Sname = Convert.ToString(dataTable.Rows[i][colmun[1]]); //学生名称 列索引:1 studentEntity.Sbirthday = Convert.ToDateTime(dataTable.Rows[i][colmun[3]]); //出生年月日 列索引:3 //家长实体相关信息保存 parent.Uname = studentEntity.Snumber; string pwd = studentEntity.Sbirthday.ToString("yy") + studentEntity.Sbirthday.ToString("MM") + studentEntity.Sbirthday.ToString("dd"); parent.Upwd = Daiv_OA.Utils.MD5.Lower32(pwd); parent.Pid = 4; parent.Did = 0; parent.Position = "家长"; parent.Mphone = ""; Entity.PowerEntity powerEntity = new BLL.PowerBLL().GetEntity(parent.Pid); parent.Setting = powerEntity.Setting; //联系电话实体相关信息保存 contactEnitty.Cphone = Convert.ToString(dataTable.Rows[i][colmun[4]]); //家长联系电话1 列索引:4 contactEnitty.Cphone2 = Convert.ToString(dataTable.Rows[i][colmun[5]]); //家长联系电话2 列索引:5 contactEnitty.Cphone3 = Convert.ToString(dataTable.Rows[i][colmun[6]]); //家长联系电话3 列索引:6 contactEnitty.Cphone4 = Convert.ToString(dataTable.Rows[i][colmun[7]]); //家长联系电话4 列索引:7 List <Entity.ContactEntity> contactList = new List <Entity.ContactEntity>(); contactList.Add(new Entity.ContactEntity() { CPhoneName = "家长1", Cphone = contactEnitty.Cphone }); contactList.Add(new Entity.ContactEntity() { CPhoneName = "家长2", Cphone = contactEnitty.Cphone2 }); contactList.Add(new Entity.ContactEntity() { CPhoneName = "家长3", Cphone = contactEnitty.Cphone3 }); contactList.Add(new Entity.ContactEntity() { CPhoneName = "家长4", Cphone = contactEnitty.Cphone4 }); //当前操作人对象 Entity.UserEntity opera = new Daiv_OA.BLL.UserBLL().GetEntity(UserId); new Daiv_OA.BLL.StudentBLL().Add(studentEntity, parent, contactList, opera); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "Student_List.aspx", 1); return; } // FinalMessage("操作成功", "Student_List.aspx", 0); } logHelper.logInfo("导入成功!操作人:" + UserId); FinalMessage("导入成功", "Student_List.aspx", 0); }
/// <summary> /// 获取请求key /// </summary> /// <param name="postType">请求类型</param> /// <param name="userEntity">用户实体</param> /// <returns></returns> public string getThisKey(string postType, Entity.UserEntity userEntity) { string encryptStr = ""; string tempuStr = Utils.SecurityHelper.Decode(uStr); switch (postType) { case "MemberLogin": //用户登录 encryptStr = userEntity.email + userEntity.psw + userEntity.imei + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "MemberReg": //用户注册 encryptStr = userEntity.psw + userEntity.email + userEntity.imei + userEntity.sellid + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "UpPSW": //更新密码 encryptStr = userEntity.email + userEntity.psw + userEntity.imei + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "UpNick": //更新用户信息 encryptStr = userEntity.email + userEntity.psw + userEntity.nick + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "ForgetPSW": //忘记密码 encryptStr = userEntity.email + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "AppMonth": // encryptStr = userEntity.email + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "ViewLog": case "OrderLog": encryptStr = userEntity.uid + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "NewVideo": //最新视频 case "ArticleList": //情报列表 encryptStr = userEntity.page + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "VideoDetail": //视频详情 encryptStr = userEntity.vid + userEntity.uid + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "LikeEDIT": //喜欢修改 case "NiceVideo": //好视频 encryptStr = userEntity.uid + userEntity.vid + userEntity.type + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "LikeLIST": //喜欢列表 encryptStr = userEntity.uid + userEntity.page + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "CategoryVideo": //类别视频 encryptStr = userEntity.category + userEntity.page + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "SearchVideo": //搜索视频 encryptStr = userEntity.search + userEntity.page + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "SearchIndex": //搜索索引 encryptStr = userEntity.type + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "PlayVideo": //播放视频 encryptStr = userEntity.email + userEntity.psw + userEntity.imei + userEntity.vid + userEntity.type + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "ArticleContent": //文章内容 encryptStr = userEntity.id + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "MemberLogout": //用户退出 encryptStr = userEntity.email + userEntity.psw + userEntity.imei + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "PushList": //推送列表 encryptStr = userEntity.page + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "VerInfo": //获取版本号 case "AppConfig": //获取系统配置 case "DomainList": //域名列表 encryptStr = DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; case "DomainBad": //域名错误 encryptStr = userEntity.id + DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; default: encryptStr = DateTime.Now.ToString("yyyyMMddHH") + tempuStr; break; } encryptStr = SecurityHelper.MD5Encrypt(encryptStr, true); return(encryptStr); }
//通过参数获取被更改的用户名 string Getoname(int id) { Entity.UserEntity model = new Entity.UserEntity(); model = new JumbotOA.BLL.UserBLL().GetEntity(id); return model.Uname; }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Entity.UserEntity model) { return(dal.Add(model)); }
public ContainerPressureModelBuilder(string title, string description, Entity.UserEntity user, Entity.MaterialEntity material, double width, double height, bool hasExhaust, long id = 0) : base(id, title, description, user, material) { Model = new ContainerPressureModelEntity(title, description, width, height, hasExhaust, id); }
//添加 protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { Entity.StudentEntity studentEntity = new Entity.StudentEntity(); Entity.UserEntity parent = new Entity.UserEntity(); Entity.ContactEntity contactEnitty = new Entity.ContactEntity(); if (Request["schClassgcid"] == null || string.IsNullOrEmpty(Request["schClassgcid"].ToString())) { FinalMessage("班级无效!", "Student_Add.aspx?id=" + q("id"), 0); return; } //学生实体相关信息保存 studentEntity.Gname = ""; studentEntity.Gid = int.Parse(Request["schClassgcid"]); studentEntity.Snumber = this.Snumber.Text; studentEntity.Sname = this.Sname.Text; studentEntity.Sbirthday = Convert.ToDateTime(this.Sbirthday.Text); //家长实体相关信息保存 parent.Uname = studentEntity.Snumber; string pwd = studentEntity.Sbirthday.ToString("yy") + studentEntity.Sbirthday.ToString("MM") + studentEntity.Sbirthday.ToString("dd"); parent.Upwd = Daiv_OA.Utils.MD5.Lower32(pwd); parent.Pid = 4; parent.Did = 0; parent.Position = "家长"; parent.Mphone = ""; Entity.PowerEntity powerEntity = new BLL.PowerBLL().GetEntity(parent.Pid); parent.Setting = powerEntity.Setting; //联系电话实体相关信息保存 //contactEnitty.Cphone = this.Cphone.Text; //contactEnitty.Cphone2 = this.Cphone2.Text; //contactEnitty.Cphone3 = this.Cphone3.Text; //contactEnitty.Cphone4 = this.Cphone4.Text; List <Entity.ContactEntity> contactList = new List <Entity.ContactEntity>(); string[] contactpArr = Request.Form["contactPhone"].Split(','); string[] contactnArr = Request.Form["contactName"].Split(','); for (int i = 0; i < contactpArr.Length; i++) { if (string.IsNullOrEmpty(contactpArr[i]) || string.IsNullOrEmpty(contactnArr[i])) { continue; } contactList.Add(new Entity.ContactEntity() { Cphone = contactpArr[i], CPhoneName = contactnArr[i] }); } //当前操作人对象 Entity.UserEntity opera = new Daiv_OA.BLL.UserBLL().GetEntity(UserId); //保存数据 try { new Daiv_OA.BLL.StudentBLL().Add(studentEntity, parent, contactList, opera); } catch (Exception ex) { FinalMessage("操作失败!" + ex.Message, "Student_List.aspx?cid=" + classId, 1); return; } FinalMessage("操作成功", "Student_List.aspx?cid=" + classId, 0); ////验证学生序号是否存在 //bool exixt = new Daiv_OA.BLL.StudentBLL().Exists(studentEntity.Snumber); //if (exixt) //{ // FinalMessage("相同的学生学号已经存在", "", 1); // return; //} //int pId = 0; //int sid = 0; //try //{ // //添加家长信息 // pId = new Daiv_OA.BLL.UserBLL().Add(parent); // if (pId > 0) // { // studentEntity.Uid = pId; // //添加设置人员 // studentEntity.MechID = UserId; // } // else // { // throw new Exception("添加家长账号失败,请重新添加!"); // } // sid = new Daiv_OA.BLL.StudentBLL().Add(studentEntity); // if (sid > 0) // { // //联系电话实体添加 // contactEnitty.Sid = sid; // new Daiv_OA.BLL.ContactBLL().Add(contactEnitty); // } // else if (sid == 0) // { // throw new Exception("相同的学生已经存在"); // } // else if (sid == -1) // { // throw new Exception("相同的年级已经存在"); // } //} //catch (Exception ex) //{ // if (!ex.Message.Contains("正在中止线程")) // { // try // { // if (pId > 0) // { // new Daiv_OA.BLL.UserBLL().Delete(pId); // } // if (sid > 0) // { // new Daiv_OA.BLL.StudentBLL().Delete(sid); // } // } // catch (Exception) // { // } // logHelper.logInfo("添加学生失败!操作员ID:" + UserId + " 失败原因:" + ex.Message); // FinalMessage("添加失败,请重试!", "", 1); // return; // } //} }
public FanCapacityModelBuilder(string title, string description, Entity.UserEntity user, Entity.MaterialEntity material, double radius, double length, bool complexDesign, long id = 0) : base(id, title, description, user, material) { Model = new FanCapacityModelEntity(title, description, radius, length, complexDesign, id); }
/// <summary> /// ��ȡuname /// </summary> /// <param name="kls_uid"></param> /// <param name="kls_pwd"></param> /// <param name="kls_num"></param> /// <returns></returns> public Entity.UserEntity Getuname(string sql) { Entity.UserEntity userEntity = new Entity.UserEntity(); SqlDataReader dr = DbHelperSQL.ExecuteReader(sql); if (dr.Read()) { userEntity.Uid = Convert.ToInt32(dr["Uid"]); userEntity.Pid = Convert.ToInt32(dr["Pid"]); userEntity.Uname = dr["Uname"].ToString(); userEntity.Upwd = dr["Upwd"].ToString(); } return userEntity; }
/// <summary> /// 更新一条数据 /// </summary> public void Update(Entity.UserEntity model) { dal.Update(model); }
public ModelBuilder(long id, string title, string description, Entity.UserEntity user, Entity.MaterialEntity material) { User = user; Material = material; }
/// <summary> /// 添加数据 /// </summary> /// <param name="studentEntity"></param> /// <param name="parent"></param> /// <param name="contactEnitty"></param> /// <param name="operatModel"></param> /// <returns></returns> public int Add(Entity.StudentEntity studentEntity, Entity.UserEntity parent, List <Entity.ContactEntity> contactList, Entity.UserEntity operatModel) { //验证学生序号是否存在 bool exixt = new Daiv_OA.BLL.StudentBLL().Exists(studentEntity.Snumber); Daiv_OA.BLL.ContactBLL ctBll = new Daiv_OA.BLL.ContactBLL(); if (exixt) { throw new Exception("相同的学生学号已经存在"); } int pId = 0; int sid = 0; try { //验证电话号码 foreach (var item in contactList) { if (!string.IsNullOrEmpty(item.Cphone) && !Validator.IsMobileNum(item.Cphone)) { throw new Exception(item.Cphone + "电话号码无效!"); } } //添加家长信息 pId = new Daiv_OA.BLL.UserBLL().Add(parent); if (pId > 0) { studentEntity.Uid = pId; //添加设置人员 studentEntity.MechID = operatModel.Uid; } else { throw new Exception("添加家长账号失败,请重新添加!"); } sid = new Daiv_OA.BLL.StudentBLL().Add(studentEntity); if (sid > 0) { //删除情亲好 ctBll.DeleteBySid(sid); //联系电话实体添加 foreach (var item in contactList) { item.Sid = sid; new Daiv_OA.BLL.ContactBLL().Add(item); } } else if (sid == 0) { throw new Exception("相同的学生已经存在"); } else if (sid == -1) { throw new Exception("相同的年级已经存在"); } } catch (Exception ex) { if (pId > 0) { new Daiv_OA.BLL.UserBLL().Delete(pId); } if (sid > 0) { Delete(sid); } logHelper.logInfo("添加学生失败!操作员ID:" + operatModel.Uname + " 失败原因:" + ex.Message); throw ex; } return(1); }