private void Page_Load(object sender, System.EventArgs e) { //判断用户权限以正确出现相应界面 string userName; int classID; //树节点ID classID = Convert.ToInt32(Request.QueryString["classID"].ToString()); ClassID = classID.ToString(); userName = Request.Cookies["UserName"].Value; UDS.Components.Staff st = new UDS.Components.Staff(); //检查用户是否有部门管理的权限 if (st.CheckRight(classID, userName, 8, true)) { position_set.Visible = true; } else { position_set.Visible = true; } //检查用户是否有角色管理的权限 if (st.CheckRight(classID, userName, 9, true)) { role_set.Visible = true; } else { role_set.Visible = true; } }
public void populateData() { #region 协同人员列表初始化 string Username = (string)Session["Username"]; UDS.Components.Staff staff = new UDS.Components.Staff(); try { listStaff.DataTextField = "RealName"; listStaff.DataValueField = "Staff_Name"; listStaff.DataSource = staff.GetStaffFromPosition(ActualUsername); listStaff.DataBind(); foreach (ListItem li in listStaff.Items) { if (li.Value.ToLower() == Username.ToLower()) { li.Selected = true; } } // listStaff.SelectedItem .Value = Username; // listStaff.SelectedItem .Text = UDS.Components .Staff.GetRealNameByUsername(Username); } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion }
private void Page_Load(object sender, System.EventArgs e) { string Action = (Request.QueryString["Action"]!=null)?Request.QueryString["Action"].ToString():"1"; // clear everything UDS.Components.Staff staff = new UDS.Components.Staff(); staff.Logout(Request.Cookies["Username"].Value.ToString()); staff = null; FormsAuthentication.SignOut(); //Request.Cookies.Clear(); //HttpCookie UserCookie = new HttpCookie("UserID", string.Empty); //HttpCookie UserNameCookie = new HttpCookie("Username", string.Empty); //Response.Cookies.Add(UserCookie); //Response.Cookies.Add(UserNameCookie); Session.Clear(); //Server.Transfer("Index.aspx"); if(Action=="1") { Response.Write("<script language=javascript>window.close();</script>"); } if(Action=="2") { Server.Transfer("Index.aspx"); } }
private void Page_Load(object sender, System.EventArgs e) { string Action = (Request.QueryString["Action"] != null)?Request.QueryString["Action"].ToString():"1"; // clear everything UDS.Components.Staff staff = new UDS.Components.Staff(); staff.Logout(Request.Cookies["Username"].Value.ToString()); staff = null; FormsAuthentication.SignOut(); //Request.Cookies.Clear(); //HttpCookie UserCookie = new HttpCookie("UserID", string.Empty); //HttpCookie UserNameCookie = new HttpCookie("Username", string.Empty); //Response.Cookies.Add(UserCookie); //Response.Cookies.Add(UserNameCookie); Session.Clear(); //Server.Transfer("Index.aspx"); if (Action == "1") { Response.Write("<script language=javascript>window.close();</script>"); } if (Action == "2") { Server.Transfer("Index.aspx"); } }
private void sms_all(int i) { SqlDataReader dr_this; //被选择人员 UDS.Components.Staff sta = new UDS.Components.Staff(); dr_this = sta.GetStaffInfo(selectedID); SMS sm = new SMS(); //处理短信提醒 while (dr_this.Read()) { string Position_name = dr_this["Position_name"].ToString(); SqlDataReader dr_isok; //所有在职人员 dr_isok = sta.GetAllStaffs(); while (dr_isok.Read()) { string Staff_name = dr_isok["Staff_name"].ToString(); if (i == 0) { sm.SendMsg(Username, Staff_name, Position_name + " 处员工:" + dr_this["RealName"].ToString() + ",已经离职,特此通知.", 1, DateTime.Now, "", 0, 0); } else { sm.SendMsg(Username, dr_isok["Staff_name"].ToString(), dr_this["Position_name"].ToString() + " 处员工:" + dr_this["RealName"].ToString() + ",已经恢复原职,特此通知.", 1, DateTime.Now, "", 0, 0); } } dr_isok.Close(); dr_isok = null; } sm = null; dr_this.Close(); dr_this = null; }
//调职通知 private void sms_all() { SqlDataReader dr_this; //被选择人员 UDS.Components.Staff sta = new UDS.Components.Staff(); dr_this = sta.GetStaffInfo(selectedID); SMS sm = new SMS(); //处理短信提醒 while (dr_this.Read()) { string Position_name = dr_this["Position_name"].ToString(); SqlDataReader dr_isok; //所有在职人员 dr_isok = sta.GetAllStaffs(); while (dr_isok.Read()) { string Staff_name = dr_isok["Staff_name"].ToString(); sm.SendMsg(Username, Staff_name, Position_name + "处员工:" + dr_this["RealName"].ToString() + ",已经调职到" + cboPosition.Items[cboPosition.SelectedIndex].Text + "处,特此通知.", 1, DateTime.Now, "", 0, 0); } dr_isok.Close(); dr_isok = null; } sm = null; dr_this.Close(); dr_this = null; }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { string staffids = ""; boardid = (Request.QueryString["BoardID"] == null)?0:Convert.ToInt32(Request.QueryString["BoardID"]); classid = (Request.QueryString["classID"] == null)?0:Int32.Parse(Request.QueryString["classID"]); ViewState["boardid"] = boardid; ViewState["classid"] = classid; UDS.Components.Staff staff = new UDS.Components.Staff(); BBSClass bbs = new BBSClass(); SqlDataReader dr = null; SqlDataReader dr1 = null; DataTable dt = new DataTable(); try { dr = bbs.GetBoardMember(); dt = Tools.ConvertDataReaderToDataTable(dr); dt.DefaultView.RowFilter = "board_id=" + boardid; lbBoardMemberList.DataSource = dt.DefaultView; lbBoardMemberList.DataValueField = "staff_id"; lbBoardMemberList.DataTextField = "realname"; lbBoardMemberList.DataBind(); for (int i = 0; i < lbBoardMemberList.Items.Count; i++) { staffids += lbBoardMemberList.Items[i].Value + ","; } if (staffids.Length != 0) { staffids = staffids.Substring(0, staffids.Length - 1); } dr1 = staff.GetRemainStaff(staffids); lbRemainStaffsList.DataSource = dr1; lbRemainStaffsList.DataValueField = "staff_id"; lbRemainStaffsList.DataTextField = "realname"; lbRemainStaffsList.DataBind(); dr1.Close(); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } } else { classid = Int32.Parse(ViewState["classid"].ToString()); boardid = Int32.Parse(ViewState["boardid"].ToString()); } HyperLink1.DataBind(); }
protected void btnSearch_Click(object sender, EventArgs e) { Staff staff = new Staff(); DataTable datatable = UDS.Components.Tools.ConvertDataReaderToDataTable(staff.FindStaffByName(this.txtSearchName.Text)); listAccount.DataSource = datatable; listAccount.DataTextField = "RealName"; listAccount.DataValueField = "Staff_Name"; listAccount.DataBind(); this.txtSearchName.Text = ""; staff = null; }
private void cmdRestoreDocument_ServerClick(object sender, System.EventArgs e) { UDS.Components.Staff st = new UDS.Components.Staff(); if (st.ReturnPosition(GetSelectedItemID("cb_StaffID")) == false) { Server.Transfer("../Error.aspx"); } else { Response.Redirect("Rehab.aspx"); } }
private void btn_LookTel_Click(object sender, System.EventArgs e) { ltl_addmantel.Visible = true; UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetStaffInfo(Int32.Parse(ddl_AddMan.SelectedItem.Value)); while (dr_staff.Read()) { ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } dr_staff.Close(); }
public void DeptListChange(object sender, System.EventArgs e) { Staff staff = new Staff(); if(listDept.SelectedItem .Value=="0") listAccount.DataSource = staff.GetStaffInTeam(Int32.Parse(ClassID)); else listAccount.DataSource = staff.GetStaffByPosition(Int32.Parse(listDept.SelectedItem.Value)); listAccount.DataTextField = "RealName"; listAccount.DataValueField = "Staff_Name"; listAccount.DataBind (); staff = null; }
private void cmdNotUse_key_Click(object sender, System.EventArgs e) { string selectedID = GetSelectedItemID("Staff_ID"); if(selectedID!="") { UDS.Components.Staff person = new UDS.Components.Staff(); if(person.SetIsNeedKey(selectedID,false)==true) { BindGrid(); } person = null; } else Response.Write("<script language=javascript>alert('��û��ѡ���κ���Ա��');</script>"); }
private void GetStaffInfo(long StaffID) { SqlDataReader dr; UDS.Components.Staff person = new UDS.Components.Staff(); dr = person.GetStaffInfo(StaffID); txtPassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; txtRePassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; if (dr.Read()) { txtStaffName.Text = dr["Staff_Name"].ToString(); txtStaffName.ReadOnly = true; txtRealName.Text = dr["RealName"].ToString(); if (dr["Sex"].ToString() == "True") { rb_male.Checked = true; sex = 1; } else { rb_female.Checked = true; sex = 0; } //修改于2003-10-8日 目的:改正生日103岁问题 // if( txtBirthday.Text =="") // txtBirthday.Text = DateTime.Now.ToShortDateString(); // txtBirthday.Text = dr["Birthday"].ToString().IndexOf(" ")>0?dr["Birthday"].ToString().Substring(0,dr["Birthday"].ToString().IndexOf(" ")):dr["Birthday"].ToString() ; txtBirthday.Text = ((dr["Birthday"] == DBNull.Value) || (DateTime.Parse(dr["Birthday"].ToString()).Date == DateTime.Parse("1900-1-1").Date))?"-":DateTime.Parse(dr["Birthday"].ToString()).ToLongDateString(); txtPassword.Text = dr["Password"].ToString(); txtRePassword.Text = dr["Password"].ToString(); txtEmail.Text = dr["Email"].ToString(); txtPhone.Text = dr["Phone"].ToString(); txtMobile.Text = dr["Mobile"].ToString(); txtCaste.Text = dr["Caste"].ToString(); PositionID = dr["Position_ID"].ToString(); SelectPosition(Int32.Parse(dr["Position_ID"].ToString())); } person = null; dr.Close(); dr = null; }
//绑定添加人下拉菜单 private void BindAddManList() { UDS.Components.Staff staff = new UDS.Components.Staff(); ddl_AddMan.DataSource = staff.GetStaffFromPosition(Request.Cookies["Username"].Value, 2, 3); ddl_AddMan.DataTextField = "realname"; ddl_AddMan.DataValueField = "staff_id"; ddl_AddMan.DataBind(); SqlDataReader dr_staff = staff.GetStaffInfo(long.Parse(Request.Cookies["UserID"].Value)); string myrealname = ""; while (dr_staff.Read()) { myrealname = dr_staff["realname"].ToString(); } dr_staff.Close(); ddl_AddMan.Items.Add(new ListItem(myrealname, Request.Cookies["UserID"].Value)); }
private void cmdNotUse_key_Click(object sender, System.EventArgs e) { string selectedID = GetSelectedItemID("Staff_ID"); if (selectedID != "") { UDS.Components.Staff person = new UDS.Components.Staff(); if (person.SetIsNeedKey(selectedID, false) == true) { BindGrid(); } person = null; } else { Response.Write("<script language=javascript>alert('您没有选择任何人员!');</script>"); } }
private void BindData() { string staffids = ""; UDS.Components.Staff staff = new UDS.Components.Staff(); //绑定该客户的联系人 UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr_ClientLinkman = null; SqlParameter[] prams = { db.MakeInParam("@clientid", SqlDbType.Int, 4, clientid) }; db.RunProc("sp_CM_GetAllLinkmanFromClient", prams, out dr_ClientLinkman); lbx_ClientLinkman.DataSource = dr_ClientLinkman; lbx_ClientLinkman.DataTextField = "Name"; lbx_ClientLinkman.DataValueField = "id"; lbx_ClientLinkman.DataBind(); dr_ClientLinkman.Close(); //绑定协同人员候选列表 SqlDataReader dr_staff = null; for (int i = 0; i < lbx_Cooperater.Items.Count; i++) { staffids += lbx_Cooperater.Items[i].Value + ","; } if (staffids.Length != 0) { staffids = staffids.Substring(0, staffids.Length - 1); } dr_staff = staff.GetRemainStaff(staffids); lbx_Staff.DataSource = dr_staff; lbx_Staff.DataTextField = "realname"; lbx_Staff.DataValueField = "staff_id"; lbx_Staff.DataBind(); dr_staff.Close(); ControlClientContactHistory1.MyClientID = clientid; ControlClientContactHistory1.BindData(); }
private void cmdOffDepartment_Click(object sender, System.EventArgs e) { string selectedID = GetSelectedItemID("Staff_ID"); if (selectedID != "") { UDS.Components.Staff person = new UDS.Components.Staff(); if (person.Dimission(selectedID) == true) { //Response.Write("<script language=javascript>alert('离职成功!');</script>"); BindGrid(); } person = null; } else { Response.Write("<script language=javascript>alert('请选择要离职的人员!');</script>"); } }
private void Page_Load(object sender, System.EventArgs e) { //�ж��û�Ȩ������ȷ������Ӧ���� string userName; int classID;//���ڵ�ID classID = Convert.ToInt32(Request.QueryString["classID"].ToString()); ClassID = classID.ToString(); userName = Server.UrlDecode(Request.Cookies["UserName"].Value); UDS.Components.Staff st = new UDS.Components.Staff(); //����û��Ƿ��в��Ź����Ȩ�� if (st.CheckRight(classID,userName,8,true)) position_set.Visible = true; else position_set.Visible = true; //����û��Ƿ��н�ɫ�����Ȩ�� if (st.CheckRight(classID,userName,9,true)) role_set.Visible = true; else role_set.Visible = true; }
private void cmdRehab_Click(object sender, System.EventArgs e) { string strStaffID = this.GetSelectedItemID("chkStaff_ID"); if (strStaffID != "") { UDS.Components.Staff person = new UDS.Components.Staff(); if (person.Rehab(strStaffID) == true) { if (this.cbRemind.Checked == true) { sms_all(1); } //Response.Write("<script language=javascript>alert('复职成功!');</script>"); BindGrid(); } person = null; } else { Response.Write("<script language=javascript>alert('请选择要复职的人员!');</script>"); } }
/// <summary> /// 对下拉列表进行初始化 /// </summary> private void PopulateListView() { #region 协同人员列表初始化 UDS.Components.Staff staff = new UDS.Components.Staff(); try { listStaff.DataTextField = "RealName"; listStaff.DataValueField = "Staff_Name"; listStaff.DataSource = staff.GetStaffFromPosition(Username); listStaff.DataBind(); listStaff.Items.Insert(0, new ListItem("本人的日程记录", "0")); listStaff.SelectedIndex = 0; } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion }
private void cmdRestoreDocument_ServerClick(object sender, System.EventArgs e) { UDS.Components.Staff st = new UDS.Components.Staff(); if (st.ReturnPosition(GetSelectedItemID("cb_StaffID")) == false) Server.Transfer("../Error.aspx"); else Response.Redirect("Rehab.aspx"); }
private void btn_LookTel_Click(object sender, System.EventArgs e) { ltl_addmantel.Visible = true; UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetStaffInfo(Int32.Parse(ddl_AddMan.SelectedItem.Value)); while(dr_staff.Read()) { ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } dr_staff.Close(); }
/// <summary> /// �������б���г�ʼ�� /// </summary> private void PopulateListView() { #region ��ʼʱ�������ʱ���ʼ�� Task task = new Task(); SqlDataReader dataReader = null; dataReader = task.GetPeriodInfo(); ArrayList a = new ArrayList(); while (dataReader.Read()) { string[] b = dataReader[1].ToString().Split('-'); listBeginTime.Items.Add(new ListItem(b[0], dataReader[0].ToString())); listEndTime.Items.Add(new ListItem(b[0], dataReader[0].ToString())); } dataReader.Close(); a = null; listBeginTime.SelectedIndex = Int32.Parse(CurrTime) - startTimeNo; listEndTime.SelectedIndex = listBeginTime.SelectedIndex + 1; // listBeginTime.DataTextField = "period"; // listBeginTime.DataValueField = "id"; // listBeginTime.DataSource = dataReader; // listBeginTime.DataBind(); // for(int j=startTimeNo;j<19;j++) // { // ListItem li = new ListItem(j.ToString()+":00",j.ToString()); // listBeginTime.Items.Insert(j-8,li); // listEndTime.Items.Insert(j-8,li); // } txtBeginDate.Text = DateTime.Parse(CurrDate).ToString("yyyy-MM-dd"); // listBeginTime.SelectedIndex = Int32.Parse(CurrTime)-startTimeNo; txtEndDate.Text = DateTime.Parse(CurrDate).ToString("yyyy-MM-dd"); #endregion #region �������Գ�ʼ�� rbAttribute.Items.Add(new ListItem("��ռ����", "1")); rbAttribute.Items.Add(new ListItem("��ʱ����", "0")); rbAttribute.Items[0].Selected = true; #endregion #region �������ͳ�ʼ�� rbType.Items.Add(new ListItem("����", "1")); rbType.Items.Add(new ListItem("�İ�", "2")); rbType.Items.Add(new ListItem("����", "3")); rbType.Items.Add(new ListItem("�绰", "4")); rbType.Items.Add(new ListItem("�߷�", "5")); rbType.Items.Add(new ListItem("���", "6")); rbType.Items.Add(new ListItem("����", "7")); rbType.Items.Add(new ListItem("����", "8")); rbType.Items.Add(new ListItem("ϵͳ", "9")); rbType.Items.Add(new ListItem("��ѵ", "10")); rbType.Items[0].Selected = true; #endregion #region Эͬ��Ա�б��ʼ�� UDS.Components.Staff staff = new UDS.Components.Staff(); try { listCooperator.DataTextField = "RealName"; listCooperator.DataValueField = "Staff_Name"; listCooperator.DataSource = staff.GetAllStaffs(); listCooperator.DataBind(); } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion lblArrangedBy.Text = UDS.Components.Staff.GetRealNameByUsername(Username); }
private void btnSubmit_Click(object sender, System.EventArgs e) { if (Page.IsValid == true) { string UserID =""; UDS.Components.Staff staff = new UDS.Components.Staff(); //if(this.txtUsername.Text!="newtime_liu") //{ string CheckString = staff.Login(txtUsername.Text, txtPassword.Text); if (CheckString != null) { string LoginChecked; if(CheckString.IndexOf("-")>=0) { UserID = CheckString.Substring(0,CheckString.IndexOf("-")); LoginChecked = CheckString.Substring(CheckString.IndexOf("-")+1); if(LoginChecked=="True") { //string ClientDigest=Request.Form["Digest"]==null?"":Request.Form["Digest"].ToString(); //string ErrMsg = Request.Form["ErrMsg"]==null?"":Request.Form["ErrMsg"].ToString(); //if( LoginIn(RandData,ClientDigest)==0) //{ // if(ErrMsg!="") // lblErrorMessage.Text = ErrMsg; // else // lblErrorMessage.Text = "EPassУ��δͨ����"; // lblErrorMessage.Visible = true; // return ; //} } } } else { lblErrorMessage.Visible = true; return ; } //} //else //{ // UserID="1"; // this.txtUsername.Text = "admin"; //} // �������������� SMS sm = new SMS(); sm.UpdateOnlineInfo(txtUsername.Text,Request.UserHostAddress,Request.Cookies["ASP.NET_SessionId"].Value.ToString()); sm = null; // ���½��� Response.Cookies["UserID"].Value = UserID; Response.Cookies["ActiveNodeID"].Value = "0"; Response.Cookies["Username"].Value = txtUsername.Text; Response.Cookies["UserID"].Expires = DateTime.Now.AddDays(10); Response.Cookies["Username"].Expires = DateTime.Now.AddDays(10); if (FormsAuthentication.GetRedirectUrl(UserID, false).ToLower().EndsWith("default.aspx")) { FormsAuthentication.SetAuthCookie(UserID, false); //�������� //Server.Transfer("VerifySignIn.aspx"); //�ǵ������� Response.Redirect("../../SubModule/Index.aspx"); } else { FormsAuthentication.SetAuthCookie(UserID, false); FormsAuthentication.RedirectFromLoginPage(UserID, false); } } }
/// <summary> /// 对下拉列表进行初始化 /// </summary> private void PopulateListView() { #region 开始时间与结束时间初始化 Task task = new Task(); SqlDataReader dataReader = null; dataReader = task.GetPeriodInfo(); ArrayList a = new ArrayList(); while (dataReader.Read()) { string [] b = dataReader[1].ToString().Split('-'); listBeginTime.Items.Add(new ListItem(b[0], dataReader[0].ToString())); listEndTime.Items.Add(new ListItem(b[0], dataReader[0].ToString())); } dataReader.Close(); a = null; listBeginTime.SelectedIndex = Int32.Parse(CurrTime) - startTimeNo; listEndTime.SelectedIndex = listBeginTime.SelectedIndex + 1; // listBeginTime.DataTextField = "period"; // listBeginTime.DataValueField = "id"; // listBeginTime.DataSource = dataReader; // listBeginTime.DataBind(); // for(int j=startTimeNo;j<19;j++) // { // ListItem li = new ListItem(j.ToString()+":00",j.ToString()); // listBeginTime.Items.Insert(j-8,li); // listEndTime.Items.Insert(j-8,li); // } txtBeginDate.Text = DateTime.Parse(CurrDate).ToString("yyyy-MM-dd"); // listBeginTime.SelectedIndex = Int32.Parse(CurrTime)-startTimeNo; txtEndDate.Text = DateTime.Parse(CurrDate).ToString("yyyy-MM-dd"); #endregion #region 任务属性初始化 rbAttribute.Items.Add(new ListItem("独占任务", "1")); rbAttribute.Items.Add(new ListItem("限时任务", "0")); rbAttribute.Items[0].Selected = true; #endregion #region 任务类型初始化 rbType.Items.Add(new ListItem("会议", "1")); rbType.Items.Add(new ListItem("文案", "2")); rbType.Items.Add(new ListItem("来访", "3")); rbType.Items.Add(new ListItem("电话", "4")); rbType.Items.Add(new ListItem("走访", "5")); rbType.Items.Add(new ListItem("外出", "6")); rbType.Items.Add(new ListItem("假期", "7")); rbType.Items.Add(new ListItem("出差", "8")); rbType.Items[0].Selected = true; #endregion #region 协同人员列表初始化 UDS.Components.Staff staff = new UDS.Components.Staff(); try { listCooperator.DataTextField = "RealName"; listCooperator.DataValueField = "Staff_Name"; listCooperator.DataSource = staff.GetAllStaffs(); listCooperator.DataBind(); } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion lblArrangedBy.Text = UDS.Components.Staff.GetRealNameByUsername(Username); }
private void sms_all(int ii) { string sql = "";//����ѡ��ij�ԱID���� bool sqlFlag = true; foreach(DataGridItem dgi in this.dgMemberList.Items) { CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]); if (cb.Checked==true) { int i = dgi.ItemIndex; string id = dgMemberList.DataKeys[i].ToString(); if (sqlFlag) { sql+=""+id; sqlFlag=false; } else { sql+=" ,"; sql+=id; } } } SqlDataReader dr_this;//��ѡ����Ա UDS.Components.Staff sta=new UDS.Components.Staff(); dr_this=sta.GetStaffInfo(sql); SqlDataReader dr_allTeam;//������Ա Team steam=new Team(); dr_allTeam=steam.GetStaffInTeam(Convert.ToInt32(ClassID)); SqlDataReader dr_allTeamMaster;//�����鳤 ProjectClass prj=new ProjectClass(); dr_allTeamMaster=prj.GetLeader(Convert.ToInt32(ClassID)); SqlDataReader dataReader;//��Ŀ��Ϣ dataReader = prj.GetClassInfo(Convert.ToInt32(ClassID)); string Team_name="";//��Ŀ���� try { if (dataReader.Read()) { Team_name = dataReader[0].ToString() + ","; } dataReader.Close(); dataReader = null; string Staff_name = "";//��ѡ����Ա���� while (dr_this.Read()) { Staff_name += dr_this["RealName"].ToString() + ","; } dr_this.Close(); dr_this = null; string name_teamMaster = "";//�����鳤������ while (dr_allTeamMaster.Read()) { name_teamMaster += dr_allTeamMaster["RealName"].ToString() + ","; } dr_allTeamMaster.Close(); dr_allTeamMaster = null; SMS sm = new SMS(); //����������� while (dr_allTeam.Read())//iΪ0��ʾ������,iΪ1��ʾ������,iΪ2��ʾ��Ϊ�鳤 { if (ii == 0) sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), Team_name + " ��Ŀ��Ա��:" + Staff_name + "�Ѿ����뱾��Ŀ,�ش�֪ͨ.", 1, DateTime.Now, "", 0, 0); else if (ii == 1) sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), "Ա��:" + Staff_name + "�Ѿ�������Ŀ:" + Team_name + ",�ش�֪ͨ.", 1, DateTime.Now, "", 0, 0); else if (ii == 2) sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), Team_name + " ��Ŀ��Ա��:" + Staff_name + "�Ѿ����" + name_teamMaster + ",��Ϊ��Ŀ�鳤,�ش�֪ͨ.", 1, DateTime.Now, "", 0, 0); } sm = null; dr_allTeam.Close(); dr_allTeam = null; } finally { dr_allTeam.Close(); dr_allTeamMaster.Close(); dr_this.Close(); dataReader.Close(); } }
private void BindData() { string staffids = ""; UDS.Components.Staff staff = new UDS.Components.Staff(); //�ÿͻ�����ϵ�� UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr_ClientLinkman = null; SqlParameter[] prams = { db.MakeInParam("@clientid",SqlDbType.Int,4,clientid) }; db.RunProc("sp_CM_GetAllLinkmanFromClient",prams,out dr_ClientLinkman); lbx_ClientLinkman.DataSource = dr_ClientLinkman; lbx_ClientLinkman.DataTextField = "Name"; lbx_ClientLinkman.DataValueField = "id"; lbx_ClientLinkman.DataBind(); dr_ClientLinkman.Close(); //��Эͬ��Ա��ѡ�б� SqlDataReader dr_staff = null; for(int i=0;i<lbx_Cooperater.Items.Count;i++) { staffids += lbx_Cooperater.Items[i].Value + ","; } if(staffids.Length!=0) staffids = staffids.Substring(0,staffids.Length-1); dr_staff = staff.GetRemainStaff(staffids); lbx_Staff.DataSource = dr_staff; lbx_Staff.DataTextField = "realname"; lbx_Staff.DataValueField = "staff_id"; lbx_Staff.DataBind(); dr_staff.Close(); ControlClientContactHistory1.MyClientID = clientid; ControlClientContactHistory1.BindData(); }
private void sms_all(int ii) { string sql = ""; //所被选择的成员ID集合 bool sqlFlag = true; foreach (DataGridItem dgi in this.dgMemberList.Items) { CheckBox cb = (CheckBox)(dgi.Cells[0].Controls[1]); if (cb.Checked == true) { int i = dgi.ItemIndex; string id = dgMemberList.DataKeys[i].ToString(); if (sqlFlag) { sql += "" + id; sqlFlag = false; } else { sql += " ,"; sql += id; } } } SqlDataReader dr_this; //被选择人员 UDS.Components.Staff sta = new UDS.Components.Staff(); dr_this = sta.GetStaffInfo(sql); SqlDataReader dr_allTeam; //所有组员 Team steam = new Team(); dr_allTeam = steam.GetStaffInTeam(Convert.ToInt32(ClassID)); SqlDataReader dr_allTeamMaster; //所有组长 ProjectClass prj = new ProjectClass(); dr_allTeamMaster = prj.GetLeader(Convert.ToInt32(ClassID)); SqlDataReader dataReader; //项目信息 dataReader = prj.GetClassInfo(Convert.ToInt32(ClassID)); string Team_name = ""; //项目名字 if (dataReader.Read()) { Team_name = dataReader[0].ToString() + ","; } dataReader.Close(); dataReader = null; string Staff_name = ""; //被选择人员名字 while (dr_this.Read()) { Staff_name += dr_this["RealName"].ToString() + ","; } dr_this.Close(); dr_this = null; string name_teamMaster = ""; //所有组长的名字 while (dr_allTeamMaster.Read()) { name_teamMaster += dr_allTeamMaster["RealName"].ToString() + ","; } dr_allTeamMaster.Close(); dr_allTeamMaster = null; SMS sm = new SMS(); //处理短信提醒 while (dr_allTeam.Read()) //i为0表示脱离组,i为1表示加入组,i为2表示成为组长 { if (ii == 0) { sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), Team_name + " 项目处员工:" + Staff_name + "已经脱离本项目,特此通知.", 1, DateTime.Now, "", 0, 0); } else if (ii == 1) { sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), "员工:" + Staff_name + "已经加入项目:" + Team_name + ",特此通知.", 1, DateTime.Now, "", 0, 0); } else if (ii == 2) { sm.SendMsg(Username, dr_allTeam["Staff_name"].ToString(), Team_name + " 项目处员工:" + Staff_name + "已经替代" + name_teamMaster + ",成为项目组长,特此通知.", 1, DateTime.Now, "", 0, 0); } } sm = null; dr_allTeam.Close(); dr_allTeam = null; }
private void btnSubmit_Click(object sender, System.EventArgs e) { if (Page.IsValid == true) { string UserID = ""; UDS.Components.Staff staff = new UDS.Components.Staff(); //if(this.txtUsername.Text!="newtime_liu") //{ string CheckString = staff.Login(txtUsername.Text, txtPassword.Text); if (CheckString != null) { string LoginChecked; if (CheckString.IndexOf("-") >= 0) { UserID = CheckString.Substring(0, CheckString.IndexOf("-")); LoginChecked = CheckString.Substring(CheckString.IndexOf("-") + 1); if (LoginChecked == "True") { //string ClientDigest=Request.Form["Digest"]==null?"":Request.Form["Digest"].ToString(); //string ErrMsg = Request.Form["ErrMsg"]==null?"":Request.Form["ErrMsg"].ToString(); //if( LoginIn(RandData,ClientDigest)==0) //{ // if(ErrMsg!="") // lblErrorMessage.Text = ErrMsg; // else // lblErrorMessage.Text = "EPass校验未通过!"; // lblErrorMessage.Visible = true; // return ; //} } } } else { lblErrorMessage.Visible = true; return; } //} //else //{ // UserID="1"; // this.txtUsername.Text = "admin"; //} // 更新在线人数表 SMS sm = new SMS(); sm.UpdateOnlineInfo(txtUsername.Text, Request.UserHostAddress, Request.Cookies["ASP.NET_SessionId"].Value.ToString()); sm = null; // 更新结束 Response.Cookies["UserID"].Value = UserID; Response.Cookies["ActiveNodeID"].Value = "0"; Response.Cookies["Username"].Value = txtUsername.Text; Response.Cookies["UserID"].Expires = DateTime.Now.AddDays(10); Response.Cookies["Username"].Expires = DateTime.Now.AddDays(10); if (FormsAuthentication.GetRedirectUrl(UserID, false).ToLower().EndsWith("default.aspx")) { FormsAuthentication.SetAuthCookie(UserID, false); //弹出窗口 //Server.Transfer("VerifySignIn.aspx"); //非弹出窗口 Response.Redirect("../../SubModule/Index.aspx"); } else { FormsAuthentication.SetAuthCookie(UserID, false); FormsAuthentication.RedirectFromLoginPage(UserID, false); } } }
private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr = null; if (!Page.IsPostBack) { tbx_contacttime.Text = DateTime.Now.ToShortDateString(); tbx_nextcontacttime.Text = DateTime.Now.AddDays(1).ToShortDateString(); clientid = Int32.Parse((Request.QueryString["ClientID"] == null) || (Request.QueryString["ClientID"] == "")?"-1":Request.QueryString["ClientID"].ToString()); pnl_clientselect.Visible = true; //绑定客户列表 dr = cm.GetMyClients(Int32.Parse(Request.Cookies["UserID"].Value)); ddl_ClientName.DataSource = dr; ddl_ClientName.DataValueField = "id"; ddl_ClientName.DataTextField = "name"; ddl_ClientName.DataBind(); dr.Close(); if (clientid != -1) { if (ddl_ClientName.Items.Count != 0) { foreach (ListItem li in ddl_ClientName.Items) { if (li.Value == clientid.ToString()) { li.Selected = true; } else { li.Selected = false; } } ViewState["ClientID"] = clientid; } //显示销售人员 UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetStaffInfo(client.AddManID); while (dr_staff.Read()) { ltl_AddMan.Text = dr_staff["realname"].ToString(); } dr_staff.Close(); } else { if (ddl_ClientName.Items.Count != 0) { clientid = Int32.Parse(ddl_ClientName.Items[0].Value); ViewState["ClientID"] = clientid; } else { ViewState["ClientID"] = clientid; } } DisplayClientInfo(); BindData(); ViewState["ContactID"] = contactid.ToString(); } else { clientid = Int32.Parse(ViewState["ClientID"].ToString()); contactid = Int32.Parse(ViewState["ContactID"].ToString()); } //tbx_contacttime.Attributes["onfocus"] = "setday(this)"; //tbx_nextcontacttime.Attributes["onfocus"] = "setday(this)"; }
private void cmdOffDepartment_Click(object sender, System.EventArgs e) { string selectedID = GetSelectedItemID("Staff_ID"); if(selectedID!="") { UDS.Components.Staff person = new UDS.Components.Staff(); if(person.Dimission(selectedID)==true) { //Response.Write("<script language=javascript>alert('��ְ�ɹ���');</script>"); BindGrid(); } person = null; } else Response.Write("<script language=javascript>alert('��ѡ��Ҫ��ְ����Ա��');</script>"); }
//protected System.Web.UI.WebControls.DropDownList listAccount; //protected System.Web.UI.WebControls.Label lblReceiver; //protected System.Web.UI.WebControls.Label lblMReceiver; //protected System.Web.UI.WebControls.DropDownList listDept; private void Page_Load(object sender, System.EventArgs e) { string resulttyep = Request.Params["result"]; string depid = Request.Params["dep"]; if (!Page.IsPostBack) { if (string.IsNullOrEmpty(resulttyep)) { } else { UDS.Components.Staff staff = new UDS.Components.Staff(); switch (resulttyep) { case "staff": ICollection retValue; if (string.IsNullOrEmpty(depid) || "0" == depid) { retValue = staff.GetAllStaffs().ToDataTable(true).DefaultView; } else { retValue = staff.GetStaffByPosition(Int32.Parse(depid)); } IList retList = new ArrayList(); var em = retValue as DataView; foreach (DataRow dr in em.Table.Rows) { ListAccount la = new ListAccount(); la.RealName = dr["RealName"].ToString(); la.StaffName = dr["Staff_Name"].ToString(); retList.Add(la); } var jsonSer = new Newtonsoft.Json.JsonSerializer(); StringWriter sw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(sw)) { jw.Formatting = Formatting.Indented; jsonSer.Serialize(jw, retList); } Response.ContentType = "text/json"; Response.Write(sw.ToString()); sw.Close(); Response.End(); break; case "position": DataTable ds = staff.GetPositionList(1).ToDataTable(true); List <MaiSystem.Position> retPoss = new List <MaiSystem.Position>(); foreach (DataRow dr in ds.Rows) { MaiSystem.Position p = new MaiSystem.Position(); p.PositionID = dr["Position_ID"].ToString(); p.PositionName = dr["Position_Name"].ToString(); retPoss.Add(p); } MaiSystem.Position fp = new MaiSystem.Position(); fp.PositionName = "公司所有部门"; fp.PositionID = "0"; retPoss.Insert(0, fp); var posSer = new Newtonsoft.Json.JsonSerializer(); StringWriter possw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(possw)) { jw.Formatting = Formatting.Indented; posSer.Serialize(jw, retPoss); } Response.ContentType = "text/json"; Response.Write(possw.ToString()); possw.Close(); Response.End(); break; } } } }
private void cmdSubmit_Click(object sender, System.EventArgs e) { if(rb_male.Checked==true) sex =1; else sex =0; if(EditStatus ==0) { UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr=null; try { if (myposition.Visible == true) PositionID = cboPosition.Items[cboPosition.SelectedIndex].Value.ToString(); SqlParameter[] prams = { db.MakeInParam("@StaffName",SqlDbType.VarChar,300,txtStaffName.Text), db.MakeInParam("@Password",SqlDbType.VarChar,300,txtPassword.Text ), db.MakeInParam("@RealName",SqlDbType.VarChar,300,txtRealName.Text), db.MakeInParam("@Sex",SqlDbType.Int,4,sex), db.MakeInParam("@Status",SqlDbType.Int,4,0), db.MakeInParam("@Email",SqlDbType.VarChar,300,txtEmail.Text), db.MakeInParam("@RegistedDate",SqlDbType.DateTime,8,DateTime.Now.ToString()), db.MakeInParam("@PositionID",SqlDbType.Int,4,Int32.Parse(PositionID)), db.MakeInParam("@Phone",SqlDbType.VarChar,50,txtPhone.Text), db.MakeInParam("@Mobile",SqlDbType.VarChar,50,txtMobile.Text), db.MakeInParam("@Birthday",SqlDbType.DateTime,8,(Request.Form["txtBirthday"].ToString()=="")?"1900-1-1":Request.Form["txtBirthday"].ToString()), db.MakeInParam("@Caste",SqlDbType.Int,4,Int32.Parse(txtCaste.Text)), db.MakeInParam("@ContractDate",SqlDbType.DateTime,8,(Request.Form["txtContractDate"].ToString()=="")?"1900-1-1":Request.Form["txtContractDate"].ToString()), db.MakeInParam("@InsuranceStatus",SqlDbType.VarChar,300,txtInsuranceStatus.Text), db.MakeInParam("@AccumulationStatus",SqlDbType.VarChar,300,txtAccumulationStatus.Text), db.MakeInParam("@IDNumber",SqlDbType.VarChar,300,txtIDNumber.Text), db.MakeInParam("@Marriage",SqlDbType.VarChar,300,txtMarriage.Text), db.MakeInParam("@Address",SqlDbType.VarChar,300,txtAddress.Text), db.MakeInParam("@BirthPlace",SqlDbType.VarChar,300,txtBirthPlace.Text), db.MakeInParam("@Education ",SqlDbType.VarChar,300,txtEducation .Text), db.MakeInParam("@Features",SqlDbType.VarChar,300,txtFeatures.Text), db.MakeInParam("@Remark",SqlDbType.VarChar,300,txtRemark.Text), db.MakeInParam("@InsuranceBase",SqlDbType.Money,21, decimal.Parse( txtInsuranceBase.Text == "" ? "0" : txtInsuranceBase.Text)), db.MakeInParam("@EndowmentCompany",SqlDbType.Money,21, decimal.Parse(txtEndowmentCompany.Text==""?"0":txtEndowmentCompany.Text)), db.MakeInParam("@EndowmentPersonal ",SqlDbType.Money,21, decimal.Parse(txtEndowmentPersonal.Text==""?"0":txtEndowmentPersonal.Text)), db.MakeInParam("@UnemploymentCompany ",SqlDbType.Money,21, decimal.Parse(txtUnemploymentCompany.Text==""?"0":txtUnemploymentCompany.Text)), db.MakeInParam("@UnemploymentPersonal",SqlDbType.Money,21, decimal.Parse(txtUnemploymentPersonal.Text==""?"0":txtUnemploymentPersonal.Text)), db.MakeInParam("@Injury",SqlDbType.Money,21, decimal.Parse(txtInjury.Text==""?"0":txtInjury.Text)), db.MakeInParam("@Maternity ",SqlDbType.Money,21, decimal.Parse(txtMaternity.Text==""?"0":txtMaternity.Text)), db.MakeInParam("@MedicalCompany ",SqlDbType.Money,21, decimal.Parse(txtMedicalCompany.Text==""?"0":txtMedicalCompany.Text)), db.MakeInParam("@MedicalPersonal",SqlDbType.Money,21, decimal.Parse(txtMedicalPersonal.Text==""?"0":txtMedicalPersonal.Text)), db.MakeInParam("@InsuranceCompanyTotal ",SqlDbType.Money,21, decimal.Parse( txtInsuranceCompanyTotal.Text==""?"0":txtInsuranceCompanyTotal.Text)), db.MakeInParam("@InsurancePersonalTotal",SqlDbType.Money,21, decimal.Parse(txtInsurancePersonalTotal.Text==""?"0":txtInsurancePersonalTotal.Text)), db.MakeInParam("@AccumulationBase",SqlDbType.Money,21, decimal.Parse(txtAccumulationBase.Text==""?"0":txtAccumulationBase.Text)), db.MakeInParam("@AccumulationCompany ",SqlDbType.Money,21, decimal.Parse(txtAccumulationCompany.Text==""?"0":txtAccumulationCompany.Text)), db.MakeInParam("@AccumulationPersonal",SqlDbType.Money,21, decimal.Parse(txtAccumulationPersonal.Text == "" ? "0" : txtAccumulationPersonal.Text)), db.MakeInParam("@staff_dept",SqlDbType.VarChar,200,dplDept.Items[dplDept.SelectedIndex].Value.ToString()) }; db.RunProc("sp_AddStaff", prams, out dr); if (dr.Read()) { SqlDataReader dr_isok;//������ְ��Ա UDS.Components.Staff sta = new UDS.Components.Staff(); dr_isok = sta.GetAllStaffs(); //����������� if (this.cbRemind.Checked == true) { try { while (dr_isok.Read()) { SMS sm = new SMS(); sm.SendMsg(Username, dr_isok["Staff_name"].ToString(), cboPosition.SelectedItem.Text + "���µ�Ա�� " + txtRealName.Text + ",�ش�֪ͨ.", 1, DateTime.Now, "", 0, 0); //sm.SendMsg(Username,mailbody.MailReceiverStr+mailbody.MailCcToAddr+mailbody.MailBccToAddr,"����"+Username+"���յ���һ���µ��ʼ�",1,DateTime.Now,"",0,0); sm = null; } } finally { dr_isok.Close(); dr_isok = null; } } if (ReturnPage == 0) Response.Redirect("ListView.aspx?Position_ID=" + PositionID); else Response.Redirect("../Staff/ManageStaff.aspx"); dr = null; } else message.Text = "<font color=red>���û��Ѿ����ڣ�</font>"; } finally { if (db != null) { db.Close(); } if (dr != null) { dr.Close(); } } } else { UDS.Components.Staff person = new UDS.Components.Staff(); txtContractDate.Text=(Request.Form["txtContractDate"].ToString()=="-")?"1900-1-1":Request.Form["txtContractDate"].ToString(); txtBirthday.Text = (Request.Form["txtBirthday"].ToString() == "-") ? "1900-1-1" : Request.Form["txtBirthday"].ToString(); switch (person.UpdateInfo(StaffID, txtRealName.Text, sex, txtBirthday.Text, txtPassword.Text, txtEmail.Text, txtPhone.Text, txtMobile.Text, Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value), Int32.Parse(txtCaste.Text), txtContractDate.Text , txtInsuranceStatus.Text , txtAccumulationStatus.Text , txtIDNumber.Text , txtMarriage.Text , txtAddress.Text , txtBirthPlace.Text , txtEducation.Text , txtFeatures.Text , txtRemark.Text , txtInsuranceBase.Text == "" ? "0" : txtInsuranceBase.Text , txtEndowmentCompany.Text==""?"0":txtEndowmentCompany.Text , txtEndowmentPersonal.Text==""?"0":txtEndowmentPersonal.Text , txtUnemploymentCompany.Text==""?"0":txtUnemploymentCompany.Text , txtUnemploymentPersonal.Text==""?"0":txtUnemploymentPersonal.Text , txtInjury.Text==""?"0":txtInjury.Text , txtMaternity.Text==""?"0":txtMaternity.Text , txtMedicalCompany.Text==""?"0":txtMedicalCompany.Text , txtMedicalPersonal.Text==""?"0":txtMedicalPersonal.Text , txtInsuranceCompanyTotal.Text==""?"0":txtInsuranceCompanyTotal.Text , txtInsurancePersonalTotal.Text==""?"0":txtInsurancePersonalTotal.Text , txtAccumulationBase.Text==""?"0":txtAccumulationBase.Text , txtAccumulationCompany.Text==""?"0":txtAccumulationCompany.Text , txtAccumulationPersonal.Text == "" ? "0" : txtAccumulationPersonal.Text , dplDept.Items[dplDept.SelectedIndex].Value.ToString() )) { case 0: PositionID = Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value ).ToString(); if(ReturnPage==0) Response.Redirect("ListView.aspx?Position_ID="+PositionID); else Response.Redirect("../Staff/ManageStaff.aspx"); message.Text = "�ijɹ���"; break; case -1: message.Text = "��֤���벻�ԣ�"; break; default: break; } } }
private void Page_Load(object sender, System.EventArgs e) { UDS.Components.CM cm = new UDS.Components.CM(); if(!Page.IsPostBack) { tbx_UpdateTime.Text = DateTime.Now.ToShortDateString(); //�õ�����˵���Ϣ UDS.Components.Staff staff = new UDS.Components.Staff(); #region ��ʾ�ͻ�ԭ����Ϣ UDS.Components.ClientInfo client = cm.GetClientAllInfo((Request.QueryString["ClientID"]==null)?0:Int32.Parse(Request.QueryString["ClientID"].ToString())); ViewState["ClientID"] = client.ID; clientid = client.ID; /* Ȩ���ж� * ������ϼ�����������˵�����������ָ���ͻ����� * �������������˵� */ if(Session["cm_permission"].ToString()=="leader") { //�������б� pnl_Leader.Visible = true; ltl_AddManName.Visible = ltl_addmantel.Visible = false; //�������İ�ť pnl_MyCustom.Visible = false; pnl_Leader1.Visible = true; BindAddManList(); //�����Ĭ��ѡ�� ddl_AddMan.Items.FindByValue(client.AddManID.ToString()).Selected = true; } else { pnl_Leader.Visible = false; ltl_AddManName.Visible = ltl_addmantel.Visible = true; SqlDataReader dr_staff = null; try { if (client.ID != 0) { dr_staff = staff.GetStaffInfo(client.AddManID); while (dr_staff.Read()) { ltl_AddManName.Text = dr_staff["realname"].ToString(); ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } } else { dr_staff = staff.GetStaffInfo(Int32.Parse(Request.Cookies["UserID"].Value)); while (dr_staff.Read()) { ltl_AddManName.Text = dr_staff["realname"].ToString(); ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } } } finally { dr_staff.Close(); dr_staff.Dispose(); } } ltl_ID.Text = (client.ID.ToString()=="0")?"":client.ID.ToString(); tbx_ShortName.Text = client.ClientShortName; tbx_Name.Text = client.ClientName; if(clientid!=0) tbx_Birthday.Text = client.Birthday.ToShortDateString(); else tbx_Birthday.Text = DateTime.Now.ToShortDateString(); if(client.ClientType.IndexOf(ClientType.terminal.ToString())>=0) cbx_zhongduan.Checked = true; if(client.ClientType.IndexOf(ClientType.channal.ToString())>=0) cbx_qudao.Checked = true; if(client.ClientType.IndexOf(ClientType.social.ToString())>=0) cbx_shehui.Checked = true; if(client.ClientType.IndexOf(ClientType.media.ToString())>=0) cbx_meiti.Checked = true; //�õ���Ҫ��ϵ�˵���Ϣ SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString()); try { while (dr_chief.Read()) { if (Session["cm_permission"].ToString() == "administrator") { hlk_Chiefman.Text = dr_chief["name"].ToString(); hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString(); hlk_Chiefman.Target = "_blank"; } else { hlk_Chiefman.Text = dr_chief["name"].ToString(); } lbl_position.Text = dr_chief["position"].ToString(); lbl_chieftel.Text = dr_chief["telephone"].ToString(); } } finally { dr_chief.Close(); dr_chief.Dispose(); } tbx_affiliatedarea.Text = client.Affiliatedarea; tbx_URL.Text = client.URL; tbx_zip.Text = client.ZIP; tbx_address.Text = client.Address; if(client.CompanyProperty.IndexOf(EnterpriseType.government.ToString())>=0) cbx_government.Checked = true; if(client.CompanyProperty.IndexOf(EnterpriseType.contry.ToString())>=0) cbx_stateowned.Checked = true; if(client.CompanyProperty.IndexOf(EnterpriseType.privateowned.ToString())>=0) cbx_private.Checked = true; if(client.CompanyProperty.IndexOf(EnterpriseType.oversea.ToString())>=0) cbx_foreign.Checked = true; if(client.CompanyProperty.IndexOf(EnterpriseType.stock.ToString())>=0) cbx_market.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.realty.ToString())>=0) cbx_realestate.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.IT.ToString())>=0) cbx_IT.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.business.ToString())>=0) cbx_business.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.telecom.ToString())>=0) cbx_telecom.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.post.ToString())>=0) cbx_post.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.refer.ToString())>=0) cbx_consultation.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.travel.ToString())>=0) cbx_travel.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.bus.ToString())>=0) cbx_bus.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.stock.ToString())>=0) cbx_stock.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.insurance.ToString())>=0) cbx_insurance.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.tax.ToString())>=0) cbx_tax.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.make.ToString())>=0) cbx_make.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.he.ToString())>=0) cbx_electric.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.clothe.ToString())>=0) cbx_clothe.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.food.ToString())>=0) cbx_food.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.medicine.ToString())>=0) cbx_medicine.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.mechanism.ToString())>=0) cbx_mechanism.Checked = true; if(client.ClientTrade.IndexOf(ClientTrade.auto.ToString())>=0) cbx_auto.Checked = true; tbx_staffnumber.Text = client.CompanySize; tbx_money.Text = client.Money; tbx_operation.Text = client.Operation; tbx_introduce.Text = client.Introduce; tbx_IT.Text = client.ITGrade; tbx_pcnumber.Text = client.PCNumber.ToString(); if(client.Net.IndexOf(ClientNet.LAN.ToString())>=0) cbx_LAN.Checked = true; if(client.Net.IndexOf(ClientNet.WAN.ToString())>=0) cbx_WAN.Checked = true; if(client.Net.IndexOf(ClientNet.INTERNET.ToString())>=0) cbx_internet.Checked = true; tbx_ITStaffs.Text = client.ITStaffs.ToString(); tbx_ITdepartment.Text = client.ITDepartment; tbx_principal.Text = client.Principal; tbx_system.Text = client.System; if(client.ClientSource.IndexOf(ClientSource.sellman.ToString())>=0) cbx_sellman.Checked = true; if(client.ClientSource.IndexOf(ClientSource.familiar.ToString())>=0) cbx_just.Checked = true; if(client.ClientSource.IndexOf(ClientSource.introduce.ToString())>=0) cbx_introduce.Checked = true; if(client.ClientSource.IndexOf(ClientSource.client.ToString())>=0) cbx_customer.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.media.ToString())>=0) cbx_media.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.searchweb.ToString())>=0) cbx_Web.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.proseminar.ToString())>=0) cbx_proseminar.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.exhibition.ToString())>=0) cbx_exhibition.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.post.ToString())>=0) cbx_EMS.Checked = true; if(client.ClientInitiative.IndexOf(ClientInitiative.email.ToString())>=0) cbx_Email.Checked = true; #endregion if(clientid==0) { btn_OK.Text = "���"; CustomValidator1.Enabled = true; } else { btn_OK.Text = "��"; CustomValidator1.Enabled = false; } penal.Visible = cbx_customer.Checked; } else { clientid = Int32.Parse(ViewState["ClientID"].ToString()); //��ʾ��ϵ�� string tmplinkmanid1 = (Session["tmplinkmanid"]==null)?"":Session["tmplinkmanid"].ToString(); foreach(string linkmanid in tmplinkmanid1.Split(',')) { if(linkmanid.Trim()!="") { UDS.Components.Linkman linkman = new UDS.Components.Linkman(); UDS.Components.CM cm1 = new UDS.Components.CM(); linkman = cm1.GetLinkmanStructByID(linkmanid); if(Session["cm_permission"].ToString()=="administrator") { hlk_Chiefman.Text = linkman.Name; hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + linkman.ID; hlk_Chiefman.Target = "_blank"; } else { hlk_Chiefman.Text = linkman.Name;; } lbl_position.Text = linkman.Position; lbl_chieftel.Text = linkman.Telephone; } } } if(clientid!=0) { rpt_Attachment.DataSource = cm.GetAttachmentByClientID(clientid); rpt_Attachment.DataBind(); } if(clientid==0) btn_AddContact.Visible = false; else btn_AddContact.Visible = true; }
private void Page_Load(object sender, System.EventArgs e) { UDS.Components.CM cm = new UDS.Components.CM(); if (!Page.IsPostBack) { tbx_UpdateTime.Text = DateTime.Now.ToShortDateString(); //得到添加人的信息 UDS.Components.Staff staff = new UDS.Components.Staff(); #region 显示客户原有信息 UDS.Components.ClientInfo client = cm.GetClientAllInfo((Request.QueryString["ClientID"] == null)?0:Int32.Parse(Request.QueryString["ClientID"].ToString())); ViewState["ClientID"] = client.ID; clientid = client.ID; /* 权限判断 * 如果是上级则出现下拉菜单,并可重新指定客户经理 * 其它则无下拉菜单 */ if (Session["cm_permission"].ToString() == "leader") { //绑定下拉列表 pnl_Leader.Visible = true; ltl_AddManName.Visible = ltl_addmantel.Visible = false; //不出现修改按钮 pnl_MyCustom.Visible = false; pnl_Leader1.Visible = true; BindAddManList(); //添加人默认选中 ddl_AddMan.Items.FindByValue(client.AddManID.ToString()).Selected = true; } else { pnl_Leader.Visible = false; ltl_AddManName.Visible = ltl_addmantel.Visible = true; SqlDataReader dr_staff = null; if (client.ID != 0) { dr_staff = staff.GetStaffInfo(client.AddManID); while (dr_staff.Read()) { ltl_AddManName.Text = dr_staff["realname"].ToString(); ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } } else { dr_staff = staff.GetStaffInfo(Int32.Parse(Request.Cookies["UserID"].Value)); while (dr_staff.Read()) { ltl_AddManName.Text = dr_staff["realname"].ToString(); ltl_addmantel.Text = dr_staff["Mobile"].ToString(); } } dr_staff.Close(); } ltl_ID.Text = (client.ID.ToString() == "0")?"":client.ID.ToString(); tbx_ShortName.Text = client.ClientShortName; tbx_Name.Text = client.ClientName; if (clientid != 0) { tbx_Birthday.Text = client.Birthday.ToShortDateString(); } else { tbx_Birthday.Text = DateTime.Now.ToShortDateString(); } if (client.ClientType.IndexOf(ClientType.terminal.ToString()) >= 0) { cbx_zhongduan.Checked = true; } if (client.ClientType.IndexOf(ClientType.channal.ToString()) >= 0) { cbx_qudao.Checked = true; } if (client.ClientType.IndexOf(ClientType.social.ToString()) >= 0) { cbx_shehui.Checked = true; } if (client.ClientType.IndexOf(ClientType.media.ToString()) >= 0) { cbx_meiti.Checked = true; } //得到主要联系人的信息 SqlDataReader dr_chief = cm.GetLinkmanByID(client.ChiefLinkmanID.ToString()); while (dr_chief.Read()) { if (Session["cm_permission"].ToString() == "administrator") { hlk_Chiefman.Text = dr_chief["name"].ToString(); hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + dr_chief["id"].ToString(); hlk_Chiefman.Target = "_blank"; } else { hlk_Chiefman.Text = dr_chief["name"].ToString(); } lbl_position.Text = dr_chief["position"].ToString(); lbl_chieftel.Text = dr_chief["telephone"].ToString(); } dr_chief.Close(); tbx_affiliatedarea.Text = client.Affiliatedarea; tbx_URL.Text = client.URL; tbx_zip.Text = client.ZIP; tbx_address.Text = client.Address; if (client.CompanyProperty.IndexOf(EnterpriseType.government.ToString()) >= 0) { cbx_government.Checked = true; } if (client.CompanyProperty.IndexOf(EnterpriseType.contry.ToString()) >= 0) { cbx_stateowned.Checked = true; } if (client.CompanyProperty.IndexOf(EnterpriseType.privateowned.ToString()) >= 0) { cbx_private.Checked = true; } if (client.CompanyProperty.IndexOf(EnterpriseType.oversea.ToString()) >= 0) { cbx_foreign.Checked = true; } if (client.CompanyProperty.IndexOf(EnterpriseType.stock.ToString()) >= 0) { cbx_market.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.realty.ToString()) >= 0) { cbx_realestate.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.IT.ToString()) >= 0) { cbx_IT.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.business.ToString()) >= 0) { cbx_business.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.telecom.ToString()) >= 0) { cbx_telecom.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.post.ToString()) >= 0) { cbx_post.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.refer.ToString()) >= 0) { cbx_consultation.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.travel.ToString()) >= 0) { cbx_travel.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.bus.ToString()) >= 0) { cbx_bus.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.stock.ToString()) >= 0) { cbx_stock.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.insurance.ToString()) >= 0) { cbx_insurance.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.tax.ToString()) >= 0) { cbx_tax.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.make.ToString()) >= 0) { cbx_make.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.he.ToString()) >= 0) { cbx_electric.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.clothe.ToString()) >= 0) { cbx_clothe.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.food.ToString()) >= 0) { cbx_food.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.medicine.ToString()) >= 0) { cbx_medicine.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.mechanism.ToString()) >= 0) { cbx_mechanism.Checked = true; } if (client.ClientTrade.IndexOf(ClientTrade.auto.ToString()) >= 0) { cbx_auto.Checked = true; } tbx_staffnumber.Text = client.CompanySize; tbx_money.Text = client.Money; tbx_operation.Text = client.Operation; tbx_introduce.Text = client.Introduce; tbx_IT.Text = client.ITGrade; tbx_pcnumber.Text = client.PCNumber.ToString(); if (client.Net.IndexOf(ClientNet.LAN.ToString()) >= 0) { cbx_LAN.Checked = true; } if (client.Net.IndexOf(ClientNet.WAN.ToString()) >= 0) { cbx_WAN.Checked = true; } if (client.Net.IndexOf(ClientNet.INTERNET.ToString()) >= 0) { cbx_internet.Checked = true; } tbx_ITStaffs.Text = client.ITStaffs.ToString(); tbx_ITdepartment.Text = client.ITDepartment; tbx_principal.Text = client.Principal; tbx_system.Text = client.System; if (client.ClientSource.IndexOf(ClientSource.sellman.ToString()) >= 0) { cbx_sellman.Checked = true; } if (client.ClientSource.IndexOf(ClientSource.familiar.ToString()) >= 0) { cbx_just.Checked = true; } if (client.ClientSource.IndexOf(ClientSource.introduce.ToString()) >= 0) { cbx_introduce.Checked = true; } if (client.ClientSource.IndexOf(ClientSource.client.ToString()) >= 0) { cbx_customer.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.media.ToString()) >= 0) { cbx_media.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.searchweb.ToString()) >= 0) { cbx_Web.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.proseminar.ToString()) >= 0) { cbx_proseminar.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.exhibition.ToString()) >= 0) { cbx_exhibition.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.post.ToString()) >= 0) { cbx_EMS.Checked = true; } if (client.ClientInitiative.IndexOf(ClientInitiative.email.ToString()) >= 0) { cbx_Email.Checked = true; } #endregion if (clientid == 0) { btn_OK.Text = "添加"; CustomValidator1.Enabled = true; } else { btn_OK.Text = "修改"; CustomValidator1.Enabled = false; } penal.Visible = cbx_customer.Checked; } else { clientid = Int32.Parse(ViewState["ClientID"].ToString()); //显示联系人 string tmplinkmanid1 = (Session["tmplinkmanid"] == null)?"":Session["tmplinkmanid"].ToString(); foreach (string linkmanid in tmplinkmanid1.Split(',')) { if (linkmanid.Trim() != "") { UDS.Components.Linkman linkman = new UDS.Components.Linkman(); UDS.Components.CM cm1 = new UDS.Components.CM(); linkman = cm1.GetLinkmanStructByID(linkmanid); if (Session["cm_permission"].ToString() == "administrator") { hlk_Chiefman.Text = linkman.Name; hlk_Chiefman.NavigateUrl = "Linkman.aspx?LinkmanID=" + linkman.ID; hlk_Chiefman.Target = "_blank"; } else { hlk_Chiefman.Text = linkman.Name;; } lbl_position.Text = linkman.Position; lbl_chieftel.Text = linkman.Telephone; } } } if (clientid != 0) { rpt_Attachment.DataSource = cm.GetAttachmentByClientID(clientid); rpt_Attachment.DataBind(); } if (clientid == 0) { btn_AddContact.Visible = false; } else { btn_AddContact.Visible = true; } }
private void BindDDL() { //8 droplist //location AssetCurrentLocation at = new AssetCurrentLocation(); AssetCurrentLocation[] atArrary = AssetCurrentLocation.FindAll(); DataTable dt = Converter.ConvertToDataTable(atArrary); dt.Columns[0].ColumnName = "ID"; dt.Columns[1].ColumnName = "Name"; this.ddlLocation.DataTextField = "Name"; this.ddlLocation.DataValueField = "ID"; this.ddlLocation.DataSource = dt; this.ddlLocation.DataBind(); //state AssetUseState[] auArrary = AssetUseState.FindAll(); DataTable dt1 = Converter.ConvertToDataTable(auArrary); dt1.Columns[0].ColumnName = "ID"; dt1.Columns[1].ColumnName = "Name"; ddlUseState.DataTextField = "Name"; this.ddlUseState.DataValueField = "ID"; this.ddlUseState.DataSource = dt1; this.ddlUseState.DataBind(); //type AssetType[] attArrary = AssetType.FindAll(); DataTable dt2 = Converter.ConvertToDataTable(attArrary); dt2.Columns[0].ColumnName = "ID"; dt2.Columns[1].ColumnName = "Name"; ddlType.DataTextField = "Name"; this.ddlType.DataValueField = "ID"; this.ddlType.DataSource = dt2; this.ddlType.DataBind(); #region 协同人员列表初始化 UDS.Components.Staff staff = new UDS.Components.Staff(); try { ddlBuyUser.DataTextField = "Staff_Name"; ddlBuyUser.DataValueField = "Staff_ID"; ddlBuyUser.DataSource = staff.GetAllStaffs(); ddlBuyUser.DataBind(); ddlCurrentUser.DataTextField = "Staff_Name"; ddlCurrentUser.DataValueField = "Staff_ID"; ddlCurrentUser.DataSource = staff.GetAllStaffs(); ddlCurrentUser.DataBind(); ddlOriginalUser.DataTextField = "Staff_Name"; ddlOriginalUser.DataValueField = "Staff_ID"; ddlOriginalUser.DataSource = staff.GetAllStaffs(); ddlOriginalUser.DataBind(); } catch (Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion }
private void GetStaffInfo(long StaffID) { SqlDataReader dr; UDS.Components.Staff person = new UDS.Components.Staff(); dr = person.GetStaffInfo(StaffID); txtPassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; txtRePassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; if(dr.Read ()) { txtStaffName.Text = dr["Staff_Name"].ToString(); txtStaffName.ReadOnly =true; txtRealName.Text = dr["RealName"].ToString(); if(dr["Sex"].ToString() =="True") { rb_male.Checked =true; sex =1; } else { rb_female.Checked =true; sex = 0; } //����2003-10-8�� Ŀ�ģ���������103������ // if( txtBirthday.Text =="") // txtBirthday.Text = DateTime.Now.ToShortDateString(); // txtBirthday.Text = dr["Birthday"].ToString().IndexOf(" ")>0?dr["Birthday"].ToString().Substring(0,dr["Birthday"].ToString().IndexOf(" ")):dr["Birthday"].ToString() ; txtBirthday .Text = ((dr["Birthday"]==DBNull.Value) || (DateTime.Parse(dr["Birthday"].ToString()).Date==DateTime.Parse("1900-1-1").Date))?"-":DateTime.Parse(dr["Birthday"].ToString()).ToLongDateString(); txtPassword .Text = dr["Password"].ToString(); txtRePassword .Text = dr["Password"].ToString(); txtEmail .Text = dr["Email"].ToString(); txtPhone .Text = dr["Phone"].ToString(); txtMobile .Text = dr["Mobile"].ToString(); txtCaste .Text = dr["Caste"].ToString(); PositionID = dr["Position_ID"].ToString(); SelectPosition(Int32.Parse(dr["Position_ID"].ToString())); } person = null; dr.Close(); dr =null; }
private void cmdRehab_Click(object sender, System.EventArgs e) { string strStaffID=this.GetSelectedItemID("chkStaff_ID"); if(strStaffID!="") { UDS.Components.Staff person = new UDS.Components.Staff(); if(person.Rehab(strStaffID)==true) { if(this.cbRemind.Checked==true) sms_all(1); //Response.Write("<script language=javascript>alert('��ְ�ɹ���');</script>"); BindGrid(); } person = null; } else Response.Write("<script language=javascript>alert('��ѡ��Ҫ��ְ����Ա��');</script>"); }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� if(!Page.IsPostBack) { string staffids = ""; boardid = (Request.QueryString["BoardID"]==null)?0:Convert.ToInt32(Request.QueryString["BoardID"]); classid = (Request.QueryString["classID"]==null)?0:Int32.Parse(Request.QueryString["classID"]); ViewState["boardid"] = boardid; ViewState["classid"] = classid; UDS.Components.Staff staff = new UDS.Components.Staff(); BBSClass bbs = new BBSClass(); SqlDataReader dr = null; SqlDataReader dr1 = null; DataTable dt = new DataTable(); try { dr = bbs.GetBoardMember(); dt = Tools.ConvertDataReaderToDataTable(dr); dt.DefaultView.RowFilter = "board_id=" + boardid; lbBoardMemberList.DataSource = dt.DefaultView; lbBoardMemberList.DataValueField = "staff_id"; lbBoardMemberList.DataTextField = "realname"; lbBoardMemberList.DataBind(); for (int i = 0; i < lbBoardMemberList.Items.Count; i++) { staffids += lbBoardMemberList.Items[i].Value + ","; } if (staffids.Length != 0) staffids = staffids.Substring(0, staffids.Length - 1); dr1 = staff.GetRemainStaff(staffids); lbRemainStaffsList.DataSource = dr1; lbRemainStaffsList.DataValueField = "staff_id"; lbRemainStaffsList.DataTextField = "realname"; lbRemainStaffsList.DataBind(); dr1.Close(); } catch (Exception ex) { UDS.Components.Error.Log(ex.ToString()); Server.Transfer("../../Error.aspx"); } finally { if (dr1 != null) { dr1.Close(); } if (dr != null) { dr.Close(); } } } else { classid = Int32.Parse(ViewState["classid"].ToString()); boardid = Int32.Parse(ViewState["boardid"].ToString()); } HyperLink1.DataBind(); }
private void cmdSubmit_Click(object sender, System.EventArgs e) { if (rb_male.Checked == true) { sex = 1; } else { sex = 0; } if (EditStatus == 0) { UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr; if (myposition.Visible == true) { PositionID = cboPosition.Items[cboPosition.SelectedIndex].Value.ToString(); } SqlParameter[] prams = { db.MakeInParam("@StaffName", SqlDbType.VarChar, 300, txtStaffName.Text), db.MakeInParam("@Password", SqlDbType.VarChar, 300, txtPassword.Text), db.MakeInParam("@RealName", SqlDbType.VarChar, 300, txtRealName.Text), db.MakeInParam("@Sex", SqlDbType.Int, 4, sex), db.MakeInParam("@Status", SqlDbType.Int, 4, 0), db.MakeInParam("@Email", SqlDbType.VarChar, 300, txtEmail.Text), db.MakeInParam("@RegistedDate", SqlDbType.DateTime, 8, DateTime.Now.ToString()), db.MakeInParam("@PositionID", SqlDbType.Int, 4, Int32.Parse(PositionID)), db.MakeInParam("@Phone", SqlDbType.VarChar, 50, txtPhone.Text), db.MakeInParam("@Mobile", SqlDbType.VarChar, 50, txtMobile.Text), db.MakeInParam("@Birthday", SqlDbType.DateTime, 8, (txtBirthday.Text.Trim() == "")?"1900-1-1":txtBirthday.Text), db.MakeInParam("@Caste", SqlDbType.Int, 4, Int32.Parse(txtCaste.Text)) }; db.RunProc("sp_AddStaff", prams, out dr); if (dr.Read()) { SqlDataReader dr_isok; //所有在职人员 UDS.Components.Staff sta = new UDS.Components.Staff(); dr_isok = sta.GetAllStaffs(); //处理短信提醒 if (this.cbRemind.Checked == true) { while (dr_isok.Read()) { SMS sm = new SMS(); sm.SendMsg(Username, dr_isok["Staff_name"].ToString(), cboPosition.SelectedItem.Text + "处新到员工 " + txtRealName.Text + ",特此通知.", 1, DateTime.Now, "", 0, 0); //sm.SendMsg(Username,mailbody.MailReceiverStr+mailbody.MailCcToAddr+mailbody.MailBccToAddr,"您从"+Username+"处收到了一封新的邮件",1,DateTime.Now,"",0,0); sm = null; } dr_isok = null; } if (ReturnPage == 0) { Response.Redirect("ListView.aspx?Position_ID=" + PositionID); } else { Response.Redirect("../Staff/ManageStaff.aspx"); } dr = null; } else { message.Text = "<font color=red>该用户已经存在!</font>"; } } else { UDS.Components.Staff person = new UDS.Components.Staff(); switch (person.UpdateInfo(StaffID, txtRealName.Text, sex, txtBirthday.Text == "-"?"1900-01-01":txtBirthday.Text, txtPassword.Text, txtEmail.Text, txtPhone.Text, txtMobile.Text, Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value), Int32.Parse(txtCaste.Text))) { case 0: PositionID = Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value).ToString(); if (ReturnPage == 0) { Response.Redirect("ListView.aspx?Position_ID=" + PositionID); } else { Response.Redirect("../Staff/ManageStaff.aspx"); } message.Text = "修改成功!"; break; case -1: message.Text = "验证密码不对!"; break; default: break; } } }
private void Page_Load(object sender, System.EventArgs e) { // �ڴ˴������û������Գ�ʼ��ҳ�� UDS.Components.CM cm = new UDS.Components.CM(); SqlDataReader dr = null; if(!Page.IsPostBack) { tbx_contacttime.Text = DateTime.Now.ToShortDateString(); tbx_nextcontacttime.Text = DateTime.Now.AddDays(1).ToShortDateString(); clientid = Int32.Parse((Request.QueryString["ClientID"]==null)||(Request.QueryString["ClientID"]=="")?"-1":Request.QueryString["ClientID"].ToString()); pnl_clientselect.Visible = true; //�ͻ��б� dr = cm.GetMyClients(Int32.Parse(Request.Cookies["UserID"].Value)); ddl_ClientName.DataSource = dr; ddl_ClientName.DataValueField = "id"; ddl_ClientName.DataTextField = "name"; ddl_ClientName.DataBind(); dr.Close(); if(clientid!=-1) { if(ddl_ClientName.Items.Count!=0) { foreach(ListItem li in ddl_ClientName.Items) { if(li.Value==clientid.ToString()) { li.Selected = true; } else { li.Selected = false; } } ViewState["ClientID"] = clientid; } //��ʾ������Ա UDS.Components.ClientInfo client = cm.GetClientAllInfo(clientid); UDS.Components.Staff staff = new UDS.Components.Staff(); SqlDataReader dr_staff = staff.GetStaffInfo(client.AddManID); while(dr_staff.Read()) { ltl_AddMan.Text = dr_staff["realname"].ToString(); } dr_staff.Close(); } else { if(ddl_ClientName.Items.Count!=0) { clientid = Int32.Parse(ddl_ClientName.Items[0].Value); ViewState["ClientID"] = clientid; } else { ViewState["ClientID"] = clientid; } } DisplayClientInfo(); BindData(); ViewState["ContactID"] = contactid.ToString(); } else { clientid = Int32.Parse(ViewState["ClientID"].ToString()); contactid = Int32.Parse(ViewState["ContactID"].ToString()); } //tbx_contacttime.Attributes["onfocus"] = "setday(this)"; //tbx_nextcontacttime.Attributes["onfocus"] = "setday(this)"; }
/// <summary> /// �����ݽ��г�ʼ�� /// </summary> private void PopulateData() { Staff staff = new Staff(); listAccount.Items.Clear(); if(DispType=="1") listAccount.DataSource = staff.GetStaffInTeam(Int32.Parse(ClassID)); else listAccount.DataSource = staff.GetAllStaffs(); listAccount.DataTextField = "RealName"; listAccount.DataValueField = "Staff_Name"; listAccount.DataBind (); listDept.DataSource = staff.GetPositionList(1); listDept.DataTextField = "Position_Name"; listDept.DataValueField = "Position_ID"; listDept.DataBind(); listDept.Items.Insert(0,new ListItem("��˾���в���","0")); listDept.SelectedIndex = 0; listDept.Attributes["onclick"]="SaveValue()"; staff=null; }
private void GetStaffInfo(long StaffID) { SqlDataReader dr; UDS.Components.Staff person = new UDS.Components.Staff(); dr = person.GetStaffInfo(StaffID); txtPassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; txtRePassword.TextMode = System.Web.UI.WebControls.TextBoxMode.SingleLine; try { if (dr.Read()) { txtStaffName.Text = dr["Staff_Name"].ToString(); txtStaffName.ReadOnly = true; txtRealName.Text = dr["RealName"].ToString(); if (dr["Sex"].ToString() == "True") { rb_male.Checked = true; sex = 1; } else { rb_female.Checked = true; sex = 0; } //����2003-10-8�� Ŀ�ģ���������103������ // if( txtBirthday.Text =="") // txtBirthday.Text = DateTime.Now.ToShortDateString(); // txtBirthday.Text = dr["Birthday"].ToString().IndexOf(" ")>0?dr["Birthday"].ToString().Substring(0,dr["Birthday"].ToString().IndexOf(" ")):dr["Birthday"].ToString() ; txtBirthday.Text = ((dr["Birthday"] == DBNull.Value) || (DateTime.Parse(dr["Birthday"].ToString()).Date == DateTime.Parse("1900-1-1").Date)) ? "-" : DateTime.Parse(dr["Birthday"].ToString()).ToLongDateString(); txtPassword.Text = dr["Password"].ToString(); txtRePassword.Text = dr["Password"].ToString(); txtEmail.Text = dr["Email"].ToString(); txtPhone.Text = dr["Phone"].ToString(); txtMobile.Text = dr["Mobile"].ToString(); txtCaste.Text = dr["Caste"].ToString(); PositionID = dr["Position_ID"].ToString(); SelectPosition(Int32.Parse(dr["Position_ID"].ToString())); txtContractDate.Text = ((dr["ContractDate"] == DBNull.Value) || (DateTime.Parse(dr["ContractDate"].ToString()).Date == DateTime.Parse("1900-1-1").Date)) ? "-" : DateTime.Parse(dr["ContractDate"].ToString()).ToLongDateString(); //dr["ContractDate"].ToString(); txtInsuranceStatus.Text = dr["InsuranceStatus"].ToString(); txtAccumulationStatus.Text = dr["AccumulationStatus"].ToString(); txtIDNumber.Text = dr["IDNumber"].ToString(); txtMarriage.Text = dr["Marriage"].ToString(); txtAddress.Text = dr["Address"].ToString(); txtBirthPlace.Text = dr["BirthPlace"].ToString(); txtEducation.Text = dr["Education"].ToString(); txtFeatures.Text = dr["Features"].ToString(); txtRemark.Text = dr["Remark"].ToString(); txtInsuranceBase.Text = dr["InsuranceBase"].ToString(); txtEndowmentCompany.Text = dr["EndowmentCompany"].ToString(); txtEndowmentPersonal.Text = dr["EndowmentPersonal"].ToString(); txtUnemploymentCompany.Text = dr["UnemploymentCompany"].ToString(); txtUnemploymentPersonal.Text = dr["UnemploymentPersonal"].ToString(); txtInjury.Text = dr["Injury"].ToString(); txtMaternity.Text = dr["Maternity"].ToString(); txtMedicalCompany.Text = dr["MedicalCompany"].ToString(); txtMedicalPersonal.Text = dr["MedicalPersonal"].ToString(); txtInsuranceCompanyTotal.Text = dr["InsuranceCompanyTotal"].ToString(); txtInsurancePersonalTotal.Text = dr["InsurancePersonalTotal"].ToString(); txtAccumulationBase.Text = dr["AccumulationBase"].ToString(); txtAccumulationCompany.Text = dr["AccumulationCompany"].ToString(); txtAccumulationPersonal.Text = dr["AccumulationPersonal"].ToString(); dplDept.SelectedValue = dr["staff_dept"].ToString(); } person = null; } finally { if (dr != null) { dr.Close(); } dr = null; } }
private void cmdSubmit_Click(object sender, System.EventArgs e) { if(rb_male.Checked==true) sex =1; else sex =0; if(EditStatus ==0) { UDS.Components.Database db = new UDS.Components.Database(); SqlDataReader dr; if(myposition.Visible==true) PositionID = cboPosition.Items[cboPosition.SelectedIndex].Value.ToString(); SqlParameter[] prams = { db.MakeInParam("@StaffName",SqlDbType.VarChar,300,txtStaffName.Text), db.MakeInParam("@Password",SqlDbType.VarChar,300,txtPassword.Text ), db.MakeInParam("@RealName",SqlDbType.VarChar,300,txtRealName.Text), db.MakeInParam("@Sex",SqlDbType.Int,4,sex), db.MakeInParam("@Status",SqlDbType.Int,4,0), db.MakeInParam("@Email",SqlDbType.VarChar,300,txtEmail.Text), db.MakeInParam("@RegistedDate",SqlDbType.DateTime,8,DateTime.Now.ToString()), db.MakeInParam("@PositionID",SqlDbType.Int,4,Int32.Parse(PositionID)), db.MakeInParam("@Phone",SqlDbType.VarChar,50,txtPhone.Text), db.MakeInParam("@Mobile",SqlDbType.VarChar,50,txtMobile.Text), db.MakeInParam("@Birthday",SqlDbType.DateTime,8,(txtBirthday.Text.Trim()=="")?"1900-1-1":txtBirthday.Text), db.MakeInParam("@Caste",SqlDbType.Int,4,Int32.Parse(txtCaste.Text)) }; db.RunProc("sp_AddStaff",prams,out dr); if(dr.Read()) { SqlDataReader dr_isok;//������ְ��Ա UDS.Components.Staff sta=new UDS.Components.Staff(); dr_isok=sta.GetAllStaffs(); //����������� if(this.cbRemind.Checked ==true) { while(dr_isok.Read()) { SMS sm = new SMS(); sm.SendMsg(Username,dr_isok["Staff_name"].ToString(),cboPosition.SelectedItem.Text+"���µ�Ա�� "+txtRealName.Text+",�ش�֪ͨ.",1,DateTime.Now,"",0,0); //sm.SendMsg(Username,mailbody.MailReceiverStr+mailbody.MailCcToAddr+mailbody.MailBccToAddr,"����"+Username+"���յ���һ���µ��ʼ�",1,DateTime.Now,"",0,0); sm = null; } dr_isok=null; } if(ReturnPage==0) Response.Redirect("ListView.aspx?Position_ID="+PositionID); else Response.Redirect("../Staff/ManageStaff.aspx"); dr=null; } else message.Text = "<font color=red>���û��Ѿ����ڣ�</font>"; } else { UDS.Components.Staff person = new UDS.Components.Staff(); switch(person.UpdateInfo(StaffID,txtRealName.Text,sex,txtBirthday.Text=="-"?"1900-01-01":txtBirthday.Text,txtPassword.Text,txtEmail.Text,txtPhone.Text,txtMobile.Text,Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value ),Int32.Parse(txtCaste.Text))) { case 0: PositionID = Int32.Parse(cboPosition.Items[cboPosition.SelectedIndex].Value ).ToString(); if(ReturnPage==0) Response.Redirect("ListView.aspx?Position_ID="+PositionID); else Response.Redirect("../Staff/ManageStaff.aspx"); message.Text = "�ijɹ���"; break; case -1: message.Text = "��֤���벻�ԣ�"; break; default: break; } } }
public void populateData() { #region Эͬ��Ա�б��ʼ�� string Username = (string)Session["Username"]; UDS.Components .Staff staff = new UDS.Components .Staff(); try { listStaff.DataTextField = "RealName"; listStaff.DataValueField = "Staff_Name"; listStaff.DataSource = staff.GetStaffFromPosition(ActualUsername); listStaff.DataBind(); foreach(ListItem li in listStaff.Items) { if(li.Value.ToLower() ==Username.ToLower()) { li.Selected =true; } } // listStaff.SelectedItem .Value = Username; // listStaff.SelectedItem .Text = UDS.Components .Staff.GetRealNameByUsername(Username); } catch(Exception e) { UDS.Components.Error.Log(e.ToString()); Server.Transfer("../Error.aspx"); } finally { staff = null; } #endregion }
//������������˵� private void BindAddManList() { UDS.Components.Staff staff = new UDS.Components.Staff(); ddl_AddMan.DataSource = staff.GetStaffFromPosition(Server.UrlDecode(Request.Cookies["UserName"].Value), 2, 3); ddl_AddMan.DataTextField = "realname"; ddl_AddMan.DataValueField = "staff_id"; ddl_AddMan.DataBind(); SqlDataReader dr_staff = staff.GetStaffInfo(long.Parse(Request.Cookies["UserID"].Value)); string myrealname = ""; try { while (dr_staff.Read()) { myrealname = dr_staff["realname"].ToString(); } } finally { dr_staff.Close(); dr_staff.Dispose(); } ddl_AddMan.Items.Add(new ListItem(myrealname,Request.Cookies["UserID"].Value)); }
private void sms_all(int i) { SqlDataReader dr_this;//��ѡ����Ա UDS.Components.Staff sta=new UDS.Components.Staff(); dr_this=sta.GetStaffInfo(selectedID); SMS sm = new SMS(); //����������� while(dr_this.Read()) { string Position_name=dr_this["Position_name"].ToString(); SqlDataReader dr_isok;//������ְ��Ա dr_isok=sta.GetAllStaffs(); while(dr_isok.Read()) { string Staff_name=dr_isok["Staff_name"].ToString(); if(i==0) sm.SendMsg(Username,Staff_name,Position_name+" ��Ա��:"+dr_this["RealName"].ToString()+",�Ѿ���ְ,�ش�֪ͨ.",1,DateTime.Now,"",0,0); else sm.SendMsg(Username,dr_isok["Staff_name"].ToString(),dr_this["Position_name"].ToString()+" ��Ա��:"+dr_this["RealName"].ToString()+",�Ѿ��ָ�ԭְ,�ش�֪ͨ.",1,DateTime.Now,"",0,0); } dr_isok.Close(); dr_isok=null; } sm = null; dr_this.Close(); dr_this=null; }
//protected System.Web.UI.WebControls.DropDownList listAccount; //protected System.Web.UI.WebControls.Label lblReceiver; //protected System.Web.UI.WebControls.Label lblMReceiver; //protected System.Web.UI.WebControls.DropDownList listDept; private void Page_Load(object sender, System.EventArgs e) { string resulttyep = Request.Params["result"]; string depid = Request.Params["dep"]; if (!Page.IsPostBack) { if (string.IsNullOrEmpty(resulttyep)) { } else { UDS.Components.Staff staff = new UDS.Components.Staff(); switch (resulttyep) { case "staff": ICollection retValue; if (string.IsNullOrEmpty(depid) || "0" == depid) { retValue = staff.GetAllStaffs().ToDataTable(true).DefaultView; } else { retValue = staff.GetStaffByPosition(Int32.Parse(depid)); } IList retList = new ArrayList(); var em = retValue as DataView; foreach (DataRow dr in em.Table.Rows) { ListAccount la = new ListAccount(); la.RealName = dr["RealName"].ToString(); la.StaffName = dr["Staff_Name"].ToString(); retList.Add(la); } var jsonSer = new Newtonsoft.Json.JsonSerializer(); StringWriter sw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(sw)) { jw.Formatting = Formatting.Indented; jsonSer.Serialize(jw, retList); } Response.ContentType = "text/json"; Response.Write(sw.ToString()); sw.Close(); Response.End(); break; case "position": DataTable ds = staff.GetPositionList(1).ToDataTable(true); List<MaiSystem.Position> retPoss = new List<MaiSystem.Position>(); foreach (DataRow dr in ds.Rows) { MaiSystem.Position p = new MaiSystem.Position(); p.PositionID = dr["Position_ID"].ToString(); p.PositionName = dr["Position_Name"].ToString(); retPoss.Add(p); } MaiSystem.Position fp = new MaiSystem.Position(); fp.PositionName = "��˾���в���"; fp.PositionID = "0"; retPoss.Insert(0, fp); var posSer = new Newtonsoft.Json.JsonSerializer(); StringWriter possw = new StringWriter(); using (JsonWriter jw = new JsonTextWriter(possw)) { jw.Formatting = Formatting.Indented; posSer.Serialize(jw, retPoss); } Response.ContentType = "text/json"; Response.Write(possw.ToString()); possw.Close(); Response.End(); break; } } } }