/// <summary> /// 根据时间查询日志 /// </summary> /// <param name="time"></param> /// <returns></returns> public List <M_JournalInfo> selJournalInfoByTimes(string time) { List <M_JournalInfo> mj = new List <M_JournalInfo>(); try { //string sql = "select * from [dbo].[M_JournalInfo] where ReleaseTime='"+time+ "' order by ReleaseTime"; SqlParameter[] mysql = new SqlParameter[] { new SqlParameter("@ReleaseTime", time) }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, "selJournalByTime", mysql); while (reader.Read()) { M_JournalInfo j = new M_JournalInfo(); j.LoginName = reader["LoginName"].ToString(); j.ReleaseTime = (DateTime)reader["ReleaseTime"]; j.Content = reader["Content"].ToString(); j.JID = int.Parse(reader["JID"].ToString()); j.Remark = reader["Remark"].ToString(); j.State = reader["State"].ToString(); mj.Add(j); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(mj); }
/// <summary> /// 根据名字模糊查询日志 /// </summary> /// <param name="name"></param> /// <returns></returns> public List <M_JournalInfo> selJournalInfoByName(string name) { List <M_JournalInfo> mj = new List <M_JournalInfo>(); try { SqlParameter[] mysql = new SqlParameter[] { new SqlParameter("@LoginName", name) }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "selJournalByName", mysql); while (reader.Read()) { M_JournalInfo j = new M_JournalInfo(); j.LoginName = reader["LoginName"].ToString(); j.ReleaseTime = (DateTime)reader["ReleaseTime"]; j.Content = reader["Content"].ToString(); j.JID = int.Parse(reader["JID"].ToString()); j.Remark = reader["Remark"].ToString(); j.State = reader["State"].ToString(); mj.Add(j); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(mj); }
/// <summary> /// 通过DID查询任务信息 /// </summary> /// <param name="did"></param> /// <returns></returns> public List <M_TaskInfo> M_SelTaskByDID(int did) { List <M_TaskInfo> ta = new List <M_TaskInfo>(); try { string sql = "select * from M_TaskInfo as a left join [dbo].[U_Department] as b on a.DID=b.DID where a.DID='" + did + "' order by ReleaseTime desc"; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, null); while (reader.Read()) { M_TaskInfo ti = new M_TaskInfo(); ti.TID = string.IsNullOrEmpty(reader["TID"].ToString()) ? 0 : (int)reader["TID"]; ti.TaskName = reader["TaskName"].ToString(); U_Department de = new U_Department(); de.DID = int.Parse(reader["DID"].ToString()); de.DName = reader["DName"].ToString(); ti.DID = de; ti.ReleaseTime = (DateTime)reader["ReleaseTime"]; ti.Remark = reader["Remark"].ToString(); ti.State = reader["State"].ToString(); ti.Content = reader["Content"].ToString(); ta.Add(ti); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(ta); }
/// <summary> /// 添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmission_Click(object sender, EventArgs e) { M_TaskInfo ti = new M_TaskInfo(); ti.TaskName = this.TbTaskName.Text.Trim(); int dd = int.Parse(this.DdlDID.SelectedValue.ToString()); U_Department dt = new U_Department(); dt.DID = dd; dt.DName = this.DdlDID.Text.ToString(); ti.DID = dt; ti.ReleaseTime = DateTime.Now.ToLocalTime(); ti.Content = this.TbContent.Text.ToString(); ti.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(this.TbTaskName.Text) || string.IsNullOrEmpty(this.TbContent.Text)) { JsMessage.jsAlert("任务信息不能为空!"); return; } if (new ManageBll().AddTaskInfo(ti) > 0) { JsMessage.jsAlert("添加成功"); use = (U_User)Session["U_USER"]; Model.M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "发布任务!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); //内容清零 this.TbTaskName.Text = ""; this.TbContent.Text = ""; this.TbRemark.Text = ""; bind(); } }
/// <summary> /// 编辑请假信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmission_Click(object sender, EventArgs e) { use = (U_User)Session["U_USER"]; int i = use.UID; int dp = use.DID.DID; U_Leave le = new U_Leave(); U_User u = new U_User(); u.UID = i; le.UID = u; U_Department d = new U_Department(); d.DID = dp; le.DID = d; le.LReason = this.TbReason.Text.Trim(); le.BeginTime = this.TbAoginTime.Text.Trim(); le.EndTime = this.TbEndTime.Text.Trim(); le.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(this.TbReason.Text) || string.IsNullOrEmpty(TbAoginTime.Text) || string.IsNullOrEmpty(this.TbEndTime.Text) || string.IsNullOrEmpty(this.TbRemark.Text)) { JsMessage.jsAlert("请假信息不能为空,请填写完整!"); return; } if (new UserBll().AddUserLeave(le) > 0) { JsMessage.jsAlert("添加成功!"); } this.TbReason.Text = ""; this.TbAoginTime.Text = ""; this.TbEndTime.Text = ""; this.TbRemark.Text = ""; }
/// <summary> /// 登录按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnLogin_Click(object sender, EventArgs e) { U_User user = new U_User(); user.LoginName = this.TtbName.Value.ToString(); user.LoginPassword = this.TtbPswd.Value.ToString(); if (string.IsNullOrEmpty(TtbName.Value) || string.IsNullOrEmpty(TtbPswd.Value)) { JsMessage.jsAlert("登录信息不能为空"); return; } int type = int.Parse(ddlUserType.SelectedValue.ToString()); U_UserType ut = new U_UserType(); ut.UTID = type; user.UTID = ut; user = new UserBll().GetInfoByNameAndPswAndType(user.LoginName, user.LoginPassword, type); if (user.UID > 0) { M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = user.UserName + "登录进入系统!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = user.LoginName; new UserBll().AddJournalInfo(ji); Session["U_USER"] = user; Response.Redirect("M_Index.aspx"); } else { Common.JsMessage.jsAlert("登录失败!请检查信息输入是否正确!"); return; } }
/// <summary> /// 查询所有辞职信息 /// </summary> /// <returns></returns> public List <U_Resignation> H_selResignation() { List <U_Resignation> re = new List <U_Resignation>(); try { string sql = "select a.RID,a.UID,a.DID,a.Reason,a.Time,a.Remark,b.UserName,b.DID,case when b.State=0 then '正常' else '停用'end as st ,c.* from [dbo].[U_ResignationInfo] as a left join [dbo].[U_UserInfor] as b on a.UID=b.UID left join [dbo].[U_Department] as c on a.DID=c.DID order by Time desc"; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, null); while (reader.Read()) { U_Resignation r = new U_Resignation(); r.RID = int.Parse(reader["RID"].ToString()); U_User user = new U_User(); user.UID = int.Parse(reader["UID"].ToString()); user.UserName = reader["UserName"].ToString(); user.State = reader["st"].ToString(); //user.DID = int.Parse(reader["DID"].ToString()); r.UID = user; U_Department d = new U_Department(); d.DID = int.Parse(reader["DID"].ToString()); d.DName = reader["DName"].ToString(); r.DID = d; r.Reason = reader["Reason"].ToString(); r.Time = DateTime.Parse(reader["Time"].ToString()); r.Remark = reader["Remark"].ToString(); r.State = reader["Remark"].ToString(); re.Add(r); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(re); }
/// <summary> /// 查询所有请假信息 /// </summary> /// <returns></returns> public List <U_Leave> H_selLeave() { List <U_Leave> le = new List <U_Leave>(); try { string sql = "select * from [dbo].[U_Leave] as a left join [dbo].[U_UserInfor] as b on a.UID=b.UID left join [dbo].[U_Department] as c on a.DID=c.DID order by a.BeginTime desc"; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.Text, sql, null); while (reader.Read()) { U_Leave l = new U_Leave(); l.LID = int.Parse(reader["LID"].ToString()); U_User user = new U_User(); user.UID = int.Parse(reader["UID"].ToString()); user.UserName = reader["UserName"].ToString(); l.UID = user; U_Department d = new U_Department(); d.DID = int.Parse(reader["DID"].ToString()); d.DName = reader["DName"].ToString(); l.DID = d; l.LReason = reader["LReason"].ToString(); l.BeginTime = reader["BeginTime"].ToString(); l.EndTime = reader["EndTime"].ToString(); l.Month = reader["Month"].ToString(); l.Remark = reader["Remark"].ToString(); l.State = reader["State"].ToString(); le.Add(l); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(le); }
/// <summary> /// 确认修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnUpd_Click(object sender, EventArgs e) { try { int I = int.Parse(Request.QueryString["TID"]); M_TaskInfo ta = new M_TaskInfo(); ta.TID = I; ta.TaskName = this.TbName.Text.Trim(); ta.ReleaseTime = DateTime.Now.ToLocalTime(); int dd = int.Parse(this.DdlDids.SelectedValue.ToString()); U_Department d = new U_Department(); d.DID = dd; ta.DID = d; ta.Content = this.TbContent.Text.Trim(); ta.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(this.TbName.Text) || string.IsNullOrEmpty(this.TbContent.Text)) { JsMessage.jsAlert("修改信息不能为空"); return; } if (new ManageBll().M_UpdTaskInfos(ta) > 0) { JsMessage.jsAlert("修改成功"); bind(); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } }
/// <summary> /// 更新事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GvUserInfo_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { U_User us = new U_User(); us.UID = Convert.ToInt32((this.GvUserInfo.Rows[e.RowIndex].FindControl("ID") as HiddenField).Value); U_UserType ut = new U_UserType(); ut.UTID = (this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlType") as DropDownList).SelectedValue == "" ? 0 : Convert.ToInt32((this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlType") as DropDownList).SelectedValue); us.UTID = ut; U_Post post = new U_Post(); post.PID = (this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlPost") as DropDownList).SelectedValue == "" ? 0 : Convert.ToInt32((this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlPost") as DropDownList).SelectedValue); us.PID = post; U_Department dp = new U_Department(); dp.DID = (this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlDepartment") as DropDownList).SelectedValue == "" ? 0 : Convert.ToInt32((this.GvUserInfo.Rows[e.RowIndex].FindControl("DdlDepartment") as DropDownList).SelectedValue); us.DID = dp; if (new HrBll().H_UpdUserInfoByPidAndDid(us) > 0) { JsMessage.jsAlert("修改成功"); this.GvUserInfo.EditIndex = -1; use = (U_User)Session["U_USER"]; M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "修改用户信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); //数据绑定 this.bind(); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } }
/// <summary> /// 通过uid查询辞职信息 /// </summary> /// <param name="uid"></param> /// <returns></returns> public DataTable H_SelResignations(int uid) { DataTable r = new DataTable(); try { string sql = "select * from U_ResignationInfo where UID='" + uid + "'"; r = SqlHelper.ExecuteDataset(CommandType.Text, sql, null).Tables[0]; //while (reader.Read()) //{ // r.RID = int.Parse(reader["RID"].ToString()); // U_User user = new U_User(); // user.UID = int.Parse(reader["UID"].ToString()); // user.UserName = reader["UserName"].ToString(); // user.State = reader["st"].ToString(); // //user.DID = int.Parse(reader["DID"].ToString()); // r.UID = user; // U_Department d = new U_Department(); // d.DID = int.Parse(reader["DID"].ToString()); // d.DName = reader["DName"].ToString(); // r.DID = d; // r.Reason = reader["Reason"].ToString(); // r.Time = DateTime.Parse(reader["Time"].ToString()); // r.Remark = reader["Remark"].ToString(); // r.State = reader["Remark"].ToString(); //} } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(r); }
/// <summary> /// 修改用户基本信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnUpd_Click(object sender, EventArgs e) { try { use = (U_User)Session["U_USER"]; int i = use.UID; U_User user = new U_User(); user.UID = i; user.UserName = this.TTbName.Text.Trim(); user.Sex = this.TbSex.Text.ToString(); user.Phone = this.TTbPhone.Text.Trim(); user.IDCard = this.TTbIDCard.Text.Trim(); user.Address = this.TTbAddress.Text.Trim(); U_EducationInfo et = new U_EducationInfo(); et.EID = int.Parse(this.TbEducation.SelectedValue.ToString()); user.EID = et; user.Academy = this.TTbAcademy.Text.Trim(); user.Details = this.TTbDetails.Text.Trim(); user.Remark = this.TbRemark.Text.Trim(); if (string.IsNullOrEmpty(TTbName.Text) || string.IsNullOrEmpty(TTbPhone.Text) || string.IsNullOrEmpty(TTbIDCard.Text) || string.IsNullOrEmpty(TTbAddress.Text) || string.IsNullOrEmpty(TTbAcademy.Text) || string.IsNullOrEmpty(TTbDetails.Text) || string.IsNullOrEmpty(TTbEmail.Text) || string.IsNullOrEmpty(TbRemark.Text)) { JsMessage.jsAlert("登录信息不能为空"); return; } Regex email = new Regex("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"); if (!email.IsMatch(this.TTbEmail.Text)) { JsMessage.jsAlert("邮箱格式不正确!"); return; } Regex mobileReg = new Regex("[0-9]{11,11}"); if (!mobileReg.IsMatch(this.TTbPhone.Text)) { JsMessage.jsAlert("电话号码格式输入错误!"); return; } //Regex idcard = new Regex("d{14}[[0-9],0-9xX]"); //if (!idcard.IsMatch(this.TTbIDCard.Text)) //{ // JsMessage.jsAlert("身份证格式输入有误!"); // return; //} if (new UserBll().UpdUserInfor(user) > 0) { Common.JsMessage.jsAlert("修改成功!"); M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "修改个人信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); this.bind(); } } catch (Exception ex) { Common.JsMessage.jsAlert(ex.Message); } }
/// <summary> /// 确认提交信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSubmission_Click(object sender, EventArgs e) { U_Resignation re = new U_Resignation(); if (string.IsNullOrEmpty(this.TbReason.Text) || string.IsNullOrEmpty(this.TbTime.Text)) { JsMessage.jsAlert("辞职信息不能为空!"); return; } use = (U_User)Session["U_USER"]; int i = use.UID; int dp = use.DID.DID; U_User u = new U_User(); u.UID = i; re.UID = u; U_Department d = new U_Department(); d.DID = dp; re.DID = d; re.Reason = this.TbReason.Text.ToString(); re.Time = Convert.ToDateTime(this.TbTime.Text.ToString()); re.Remark = this.TbRemark.Text.Trim(); re.State = "null"; if (string.IsNullOrEmpty(this.TbReason.Text) || string.IsNullOrEmpty(this.TbTime.Text)) { JsMessage.jsAlert("辞职信息不能为空!"); return; } DataTable r = new HrBll().H_SelResignations(i); //U_User us = new U_User(); //us.UID= //int uid = r.UID.UID; if (r.Rows.Count == 1) { JsMessage.jsAlert("你已经发送过辞职信息了,不能反复发送!"); return; } if (new UserBll().U_AddResigntion(re) > 0) { JsMessage.jsAlert("编辑成功!"); use = (U_User)Session["U_USER"]; M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "编辑辞职信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); return; } //清空所有信息 this.TbReason.Text = ""; this.TbRemark.Text = ""; this.TbTime.Text = ""; }
/// <summary> /// 查询用户所有信息 /// </summary> /// <returns></returns> public List <U_User> U_SelAllUserInfo() { List <U_User> user = new List <U_User>(); try { SqlParameter[] sql = new SqlParameter[] { }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "U_SelAllUserInfos", sql); while (reader.Read()) { U_User us = new U_User(); us.UID = int.Parse(reader["UID"].ToString()); us.LoginName = reader["LoginName"].ToString(); us.LoginPassword = reader["LoginPassword"].ToString(); us.UserName = reader["UserName"].ToString(); U_Post p = new U_Post(); p.PID = int.Parse(reader["PID"].ToString()); p.PName = reader["PName"].ToString(); us.PID = p; U_UserType UT = new U_UserType(); UT.UTID = int.Parse(reader["UTID"].ToString()); UT.TypeName = reader["TName"].ToString(); us.UTID = UT; U_Department dp = new U_Department(); dp.DID = int.Parse(reader["DID"].ToString()); dp.DName = reader["DName"].ToString(); us.DID = dp; U_EducationInfo et = new U_EducationInfo(); et.EID = int.Parse(reader["EID"].ToString()); et.Education = reader["Education"].ToString(); us.EID = et; us.Phone = reader["Phone"].ToString(); us.IDCard = reader["IDCard"].ToString(); us.Details = reader["Details"].ToString(); us.Address = reader["Address"].ToString(); us.Email = reader["Email"].ToString(); us.Sex = reader["Sex"].ToString(); us.Remark = reader["Remark"].ToString(); us.State = reader["State"].ToString(); us.Academy = reader["Academy"].ToString(); user.Add(us); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(user); }
/// <summary> /// 查询用户类型 /// </summary> /// <returns></returns> public DataTable GetManageType() { DataTable dt = new DataTable(); try { string sql = "select * from [dbo].[U_UserType]"; dt = SqlHelper.ExecuteDataset(CommandType.Text, sql, null).Tables[0]; } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(dt); }
/// <summary> /// 通过部门进行查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSelByD_Click(object sender, EventArgs e) { int did = int.Parse(this.DdlD.SelectedValue.ToString()); if (string.IsNullOrEmpty(this.TbName.Value)) { JsMessage.jsAlert("用户名字信息不能为空!"); return; } List <U_Leave> le = new HrBll().H_selLeaveByDID(did); CollectionPager1.DataSource = le; CollectionPager1.BindToControl = RLeave; this.RLeave.DataSource = CollectionPager1.DataSourcePaged; this.RLeave.DataBind(); }
/// <summary> /// 通过员工名字进行模糊查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSelByName_Click(object sender, EventArgs e) { string name = this.TbName.Value.Trim(); if (string.IsNullOrEmpty(this.TbName.Value)) { JsMessage.jsAlert("用户名信息不能为空!"); return; } List <U_User> user = new UserBll().U_SelAllUserInfoByNames(name); CollectionPager1.DataSource = user; CollectionPager1.BindToControl = GvUserInfo; this.GvUserInfo.DataSource = CollectionPager1.DataSourcePaged; this.GvUserInfo.DataBind(); this.TbName.Value = ""; }
/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GvUserInfo_RowDeleting(object sender, GridViewDeleteEventArgs e) { int UID = Convert.ToInt32((this.GvUserInfo.Rows[e.RowIndex].FindControl("IDs") as HiddenField).Value); if (new HrBll().H_DelUserInfoByUID(UID) > 0) { JsMessage.jsAlert("删除成功"); //数据刷新 use = (U_User)Session["U_USER"]; M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "删除用户信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); this.bind(); } }
/// <summary> /// 根据名字进行查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSelByName_Click(object sender, EventArgs e) { string name = this.TbName.Value.Trim(); if (string.IsNullOrEmpty(this.TbName.Value)) { JsMessage.jsAlert("员工名字信息不能为空!"); return; } List <U_Resignation> ti = new HrBll().H_SelReasontionByName(name); CollectionPager1.DataSource = ti; CollectionPager1.BindToControl = GvResignation; this.GvResignation.DataSource = CollectionPager1.DataSourcePaged; this.GvResignation.DataBind(); this.TbName.Value = ""; }
/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GvJournal_RowDeleting(object sender, GridViewDeleteEventArgs e) { int JID = Convert.ToInt32((this.GvJournal.Rows[e.RowIndex].FindControl("LbNumber") as Label).Text); if (new ManageBll().DelJournal(JID) > 0) { JsMessage.jsAlert("删除成功"); use = (U_User)Session["U_USER"]; Model.M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "删除了日志信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); //数据刷新 this.bind(); } }
///// <summary> ///// 根据时间查询 ///// </summary> ///// <param name="sender"></param> ///// <param name="e"></param> //protected void BtnTime_Click(object sender, EventArgs e) //{ // string time = this.TbTime.Value.Trim(); // List<Model.M_JournalInfo> mj = new ManageBll().selJournalInfoByTimes(time); // CollectionPager1.DataSource = mj; // CollectionPager1.BindToControl = GvJournal; // this.GvJournal.DataSource = CollectionPager1.DataSourcePaged; // this.GvJournal.DataBind(); //} /// <summary> /// 批量删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnDel_Click(object sender, EventArgs e) { List <HtmlInputCheckBox> hicb = Utils.ReadAllControls <HtmlInputCheckBox>(this.GvJournal); foreach (HtmlInputCheckBox item in hicb) { if (item.ID == "ctlName" && item.Checked) { new ManageBll().M_DelJournals(Convert.ToInt32(item.Value)); } } JsMessage.jsAlert("删除成功"); use = (U_User)Session["U_USER"]; Model.M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "删除了日志信息!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); bind(); }
/// <summary> /// 通过员工名字进行模糊查询 /// </summary> /// <param name="name"></param> /// <returns></returns> public List <U_Leave> H_selLeaveByName(string name) { List <U_Leave> le = new List <U_Leave>(); try { SqlParameter[] mySql = new SqlParameter[] { new SqlParameter("@UserName", name) }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "H_selLeaveByName", mySql); while (reader.Read()) { U_Leave l = new U_Leave(); l.LID = int.Parse(reader["LID"].ToString()); U_User user = new U_User(); user.UID = int.Parse(reader["UID"].ToString()); user.UserName = reader["UserName"].ToString(); l.UID = user; U_Department d = new U_Department(); d.DID = int.Parse(reader["DID"].ToString()); d.DName = reader["DName"].ToString(); l.DID = d; l.LReason = reader["LReason"].ToString(); l.BeginTime = reader["BeginTime"].ToString(); l.EndTime = reader["EndTime"].ToString(); l.Month = reader["Month"].ToString(); l.Remark = reader["Remark"].ToString(); l.State = reader["State"].ToString(); le.Add(l); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(le); }
/// <summary> /// 根据名字模糊查询辞职信息 /// </summary> /// <param name="name"></param> /// <returns></returns> public List <U_Resignation> H_SelReasontionByName(string name) { List <U_Resignation> re = new List <U_Resignation>(); try { SqlParameter[] mySql = new SqlParameter[] { new SqlParameter("@UserName", name) }; SqlDataReader reader = SqlHelper.ExecuteReader(CommandType.StoredProcedure, "H_SelResignationByName", mySql); while (reader.Read()) { U_Resignation r = new U_Resignation(); r.RID = int.Parse(reader["RID"].ToString()); U_User user = new U_User(); user.UID = int.Parse(reader["UID"].ToString()); user.UserName = reader["UserName"].ToString(); user.State = reader["st"].ToString(); //user.DID = int.Parse(reader["DID"].ToString()); r.UID = user; U_Department d = new U_Department(); d.DID = int.Parse(reader["DID"].ToString()); d.DName = reader["DName"].ToString(); r.DID = d; r.Reason = reader["Reason"].ToString(); r.Time = DateTime.Parse(reader["Time"].ToString()); r.Remark = reader["Remark"].ToString(); r.State = reader["Remark"].ToString(); re.Add(r); } } catch (Exception ex) { JsMessage.jsAlert(ex.Message); } return(re); }
/// <summary> /// 根据员工id进行模糊查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSelByID_Click(object sender, EventArgs e) { int uid = int.Parse(this.TbNumber.Value.Trim()); if (string.IsNullOrEmpty(this.TbNumber.Value)) { JsMessage.jsAlert("员工编号不能为空!"); return; } Regex idcard = new Regex("^[0-9]*$"); if (!idcard.IsMatch(this.TbNumber.Value)) { JsMessage.jsAlert("编号只能为数字!"); return; } List <U_Leave> le = new HrBll().H_selLeaveByUid(uid); CollectionPager1.DataSource = le; CollectionPager1.BindToControl = RLeave; this.RLeave.DataSource = CollectionPager1.DataSourcePaged; this.RLeave.DataBind(); }
/// <summary> /// 恢复 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnHf_Click(object sender, EventArgs e) { int I = int.Parse(Request.QueryString["UID"]); string states = this.lbstate.Text; string state = "0"; if (states == "正常") { JsMessage.jsAlert("已经恢复该用户!"); return; } if (new HrBll().H_TYUser(I, state) > 0) { JsMessage.jsAlert("恢复成功!"); use = (U_User)Session["U_USER"]; Model.M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "恢复用户!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); } bind(); }
/// <summary> /// 停用用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void GvResignation_RowDeleting(object sender, GridViewDeleteEventArgs e) { int uid = Convert.ToInt32((this.GvResignation.Rows[e.RowIndex].FindControl("LbUid") as Label).Text); string states = (this.GvResignation.Rows[e.RowIndex].FindControl("LbState") as Label).Text; string state = "1"; if (states == "停用") { JsMessage.jsAlert("已经停用该用户!"); use = (U_User)Session["U_USER"]; M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "停用用户!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); return; } if (new HrBll().H_TYUser(uid, state) > 0) { JsMessage.jsAlert("停用成功!"); } bind(); }
/// <summary> /// 根据id进行模糊查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSelByID_Click(object sender, EventArgs e) { int id = int.Parse(this.TbUid.Value.Trim()); if (string.IsNullOrEmpty(this.TbUid.Value)) { JsMessage.jsAlert("员工编号不能为空!"); return; } Regex idcard = new Regex("^[0-9]*$"); if (!idcard.IsMatch(this.TbUid.Value)) { JsMessage.jsAlert("编号只能为数字!"); return; } List <U_Resignation> ti = new HrBll().H_SelReasontionByUID(id); CollectionPager1.DataSource = ti; CollectionPager1.BindToControl = GvResignation; this.GvResignation.DataSource = CollectionPager1.DataSourcePaged; this.GvResignation.DataBind(); this.TbUid.Value = ""; }
/// <summary> /// 根据工号进行模糊查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSel_Click(object sender, EventArgs e) { int id = int.Parse(this.TbID.Value.Trim()); if (string.IsNullOrEmpty(this.TbID.Value)) { JsMessage.jsAlert("员工编号不能为空!"); return; } Regex idcard = new Regex("^[0-9]*$"); if (!idcard.IsMatch(this.TbID.Value)) { JsMessage.jsAlert("编号只能为数字!"); return; } List <U_User> user = new UserBll().U_SelAllUserInfoByIDs(id); CollectionPager1.DataSource = user; CollectionPager1.BindToControl = GvUserInfo; this.GvUserInfo.DataSource = CollectionPager1.DataSourcePaged; this.GvUserInfo.DataBind(); this.TbID.Value = ""; }
/// <summary> /// 确认添加按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnAdd_Click(object sender, EventArgs e) { U_User user = new U_User(); user.UserName = this.TbUserName.Value.Trim(); user.LoginName = this.TbLoginName.Value.Trim(); user.LoginPassword = "******"; U_UserType ut = new U_UserType(); ut.UTID = int.Parse(this.DdlType.SelectedValue.ToString()); user.UTID = ut; U_Department d = new U_Department(); d.DID = int.Parse(this.DdlDeparment.SelectedValue.ToString()); user.DID = d; U_Post p = new U_Post(); p.PID = int.Parse(this.DdlPost.SelectedValue.ToString()); user.PID = p; U_EducationInfo ed = new U_EducationInfo(); ed.EID = int.Parse(this.DdlEducation.SelectedValue.ToString()); user.EID = ed; user.IDCard = this.TbIdCard.Value.Trim(); user.Phone = this.TbPhone.Value.Trim(); user.Address = this.TbAddress.Value.Trim(); user.Email = this.TbEmail.Value.Trim(); user.Academy = this.TbAcademy.Value.Trim(); user.Sex = this.DdlSex.Text.Trim(); user.Details = this.TbDetail.Text.Trim(); user.Remark = this.TbRemark.Value.Trim(); user.State = "0"; if (string.IsNullOrEmpty(TbUserName.Value) || string.IsNullOrEmpty(TbLoginName.Value) || string.IsNullOrEmpty(TbIdCard.Value) || string.IsNullOrEmpty(TbPhone.Value) || string.IsNullOrEmpty(TbAddress.Value) || string.IsNullOrEmpty(TbEmail.Value) || string.IsNullOrEmpty(TbDetail.Text) || string.IsNullOrEmpty(TbRemark.Value) || string.IsNullOrEmpty(this.TbAcademy.Value)) { JsMessage.jsAlert("用户信息不能为空"); return; } Regex email = new Regex("^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+\\.[a-zA-Z0-9_-]+$"); if (!email.IsMatch(this.TbEmail.Value)) { JsMessage.jsAlert("邮箱格式不正确!"); return; } Regex mobileReg = new Regex("[0-9]{11,11}"); if (!mobileReg.IsMatch(this.TbPhone.Value)) { JsMessage.jsAlert("电话号码格式输入错误!"); return; } Regex idcard = new Regex("d{14}[[0-9],0-9xX]"); if (!idcard.IsMatch(this.TbIdCard.Value)) { JsMessage.jsAlert("身份证格式输入有误!"); return; } if (new HrBll().AddUsers(user) > 0) { JsMessage.jsAlert("添加成功"); use = (U_User)Session["U_USER"]; M_JournalInfo ji = new Model.M_JournalInfo(); ji.Content = use.UserName + "添加用户!"; ji.ReleaseTime = DateTime.Now.ToLocalTime(); ji.LoginName = use.LoginName; new UserBll().AddJournalInfo(ji); } }
/// <summary> /// js向unity发送消息 /// </summary> /// <param name="pstr">消息内容:json</param> public void VehicleControl(string pstr) { if (!AppStart.IsGameStart) { return; } Debug.Log(pstr); JsMessage jm = JsonMapper.ToObject <JsMessage>(pstr); if (jm == null) { return; } if (!string.IsNullOrEmpty(jm.FLDoorStatus))//左前门 { if (jm.FLDoorStatus == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorFrontLeft_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorFrontLeft_off); } } if (!string.IsNullOrEmpty(jm.FRDoorStatus))//右前门 { if (jm.FRDoorStatus == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorFrontRight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorFrontRight_off); } } if (!string.IsNullOrEmpty(jm.RLDoorStatus))//左后门 { if (jm.RLDoorStatus == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorBackLeft_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorBackLeft_off); } } if (!string.IsNullOrEmpty(jm.RRDoorStatus))//右后门 { if (jm.RRDoorStatus == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorBackRight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorBackRight_off); } } if (!string.IsNullOrEmpty(jm.doorTrunk))//右后门 { if (jm.doorTrunk == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorTrunk_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.doorTrunk_off); } } if (!string.IsNullOrEmpty(jm.skylight))//右后门 { if (jm.skylight == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.skylight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.skylight_off); } } if (!string.IsNullOrEmpty(jm.windowFrontLeft))//左前门-窗 { if (jm.windowFrontLeft == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowFrontLeft_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowFrontLeft_off); } } if (!string.IsNullOrEmpty(jm.windowFrontRight))//右前门-窗 { if (jm.windowFrontRight == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowFrontRight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowFrontRight_off); } } if (!string.IsNullOrEmpty(jm.windowBackLeft))//左后门-窗 { if (jm.windowBackLeft == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowBackLeft_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowBackLeft_off); } } if (!string.IsNullOrEmpty(jm.windowBackRight))//右后门-窗 { if (jm.windowBackRight == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowBackRight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.windowBackRight_off); } } if (!string.IsNullOrEmpty(jm.LMirror))//左边后视镜 { if (jm.LMirror == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.mirrorLeft_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.mirrorLeft_off); } } if (!string.IsNullOrEmpty(jm.RMirror))//左边后视镜 { if (jm.RMirror == "1") { AppDelegate.Instance.OnCarAnimation(CarAniEnum.mirrorRight_on); } else { AppDelegate.Instance.OnCarAnimation(CarAniEnum.mirrorRight_off); } } if (!string.IsNullOrEmpty(jm.runSpeed))//车速 { CarController.carSpeed_finall = float.Parse(jm.runSpeed); } if (!string.IsNullOrEmpty(jm.wheel))// 轮毂 20/21 { AppDelegate.Instance.OnChangeWheels(jm.wheel); } if (!string.IsNullOrEmpty(jm.cameraVector))// 相机位置 0,1,2 { AppDelegate.Instance.OnchangeCameraVecotr(jm.cameraVector); } if (!string.IsNullOrEmpty(jm.carPaint))// 车漆 0,1,2 { AppDelegate.Instance.OnChangeColor(jm.carPaint); } if (!string.IsNullOrEmpty(jm.background))// 环境 0,1,2 { AppDelegate.Instance.OnChangeBackground(jm.background); } if (!string.IsNullOrEmpty(jm.carLight))// 车灯 { AppDelegate.Instance.OnChangeCarLigth(jm.carLight); } if (!string.IsNullOrEmpty(jm.warning))// 警告 { AppDelegate.Instance.OnWarning(jm.warning); } if (!string.IsNullOrEmpty(jm.charge))// 充电显示 { AppDelegate.Instance.OnCharging(jm.charge); } if (!string.IsNullOrEmpty(jm.restart))// 重启程序 { AppDelegate.Instance.OnRestart(jm.restart); } if (!string.IsNullOrEmpty(jm.releaseMemory))// 释放内存 { AppDelegate.Instance.OnReleaseMemory(jm.releaseMemory); } if (!string.IsNullOrEmpty(jm.cameraPathAnimation))// 相机路径 { AppDelegate.Instance.OnCameraPathAni(jm.cameraPathAnimation); } if (!string.IsNullOrEmpty(jm.driveMode))// 驾驶模式 { AppDelegate.Instance.OnDriveModeChangeEvent(jm.driveMode); } if (!string.IsNullOrEmpty(jm.driveModeCustomSpeedSetting))// 速度设置 { DriveModeControl.speed = float.Parse(jm.driveModeCustomSpeedSetting); CarController.carSpeed_finall = float.Parse(jm.driveModeCustomSpeedSetting) * 100; } if (!string.IsNullOrEmpty(jm.driveModeCustomEnergyRecovery))// 能量回收 { DriveModeControl.speed = float.Parse(jm.driveModeCustomEnergyRecovery) * -1; CarController.carSpeed_finall = (1 - float.Parse(jm.driveModeCustomEnergyRecovery)) * 100; } if (!string.IsNullOrEmpty(jm.atmosphereLightMode))// 氛围灯 模式 { AtmosphereLamp.isTwinkle = jm.atmosphereLightMode != "1"; } if (!string.IsNullOrEmpty(jm.atmosphereLightColor))// 氛围灯 颜色 { AppDelegate.Instance.OnAtmosphereColor(jm.atmosphereLightColor); } if (!string.IsNullOrEmpty(jm.atmosphereLightBrightness))// 氛围灯 亮度 { AtmosphereLamp.lightBrightness = float.Parse(jm.atmosphereLightBrightness); } if (!string.IsNullOrEmpty(jm.atmosphereLightSpeed))// 氛围灯 速度 { AtmosphereLamp.twinkleSpeed = float.Parse(jm.atmosphereLightSpeed); } if (!string.IsNullOrEmpty(jm.atmosphereLightColorType))// 氛围灯 类型; 单色、变色、全色 { AtmosphereLamp.colorType = int.Parse(jm.atmosphereLightColorType); } if (!string.IsNullOrEmpty(jm.leftReadLight))// 左侧阅读灯 { if (jm.leftReadLight == "0") { AppDelegate.Instance.OnReadingLight("left0"); } else { AppDelegate.Instance.OnReadingLight("left1"); } } if (!string.IsNullOrEmpty(jm.rightReadLight))// 右侧阅读灯 { if (jm.rightReadLight == "0") { AppDelegate.Instance.OnReadingLight("right0"); } else { AppDelegate.Instance.OnReadingLight("right1"); } } }