Beispiel #1
0
        /// <summary>
        /// ���û��������¼��ʾ��datagrid��
        /// </summary>
        protected void BindGrid(string Sender,string Receiver)
        {
            try
            {
                SMS sm = new SMS();
                SqlDataReader dr = sm.GetHistory(Sender,Receiver);
                try
                {
                    while (dr.Read())
                    {
                        Response.Write("<font color=red size=2>(" + dr["sendtime"].ToString() + ")" + dr["sender"].ToString() + "</font><br><font color=blue size=2>" + dr["content"].ToString() + "</font><br>");
                    }
                }
                finally
                {

                    if (dr != null)
                    {

                        dr.Close();
                    }
                }
            //	DataTable datatable	  = UDS.Components.Tools.ConvertDataReaderToDataTable(dr);
            //	Response.Write(datatable.Rows.Count );
            //	DataView source       = datatable.DefaultView;
            //	DataGrid1.DataSource = dr;
            //	DataGrid1.DataBind();
            }
            catch
            {
                Server.Transfer("../Error.aspx");
            }
        }
Beispiel #2
0
        private void btnSend_Click(object sender, System.EventArgs e)
        {
            SMS sm = new SMS();
            string ErrorMsg = "";
            string Username			  = Server.UrlDecode(Request.Cookies["UserName"].Value);
            this.SendTo				  = Request.Form["hdnTxtSendTo"].ToString();
            this.MobileSendTo		  = Request.Form["hdnTxtMobileSendTo"].ToString();
            this.SendToRealName       = Request.Form["txtSendTo"].ToString();
            this.MobileSendToRN		  = Request.Form["txtMobileSendTo"].ToString();
            this.AdditionalNo		  = Request.Form["txtAdditionalNo"].ToString();
            if(SendTo!="") //���Ͷ�����վ���û�
            {
                int Code = sm.SendMsg(Username,SendTo,this.txtContent.Text,1,DateTime.Now,"",0,0);
                if(Code==1)
                {
                    Response.Write("<script language=javascript>alert('վ�ڶ��ŷ��ͳɹ�');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
                else
                {
                    Response.Write("<script language=javascript>alert('վ�ڶ��ŷ���ʧ��');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
            }

            if(MobileSendTo!="")//������վ���ֻ��û�
            {
                int Code = sm.SendMsg(Username,MobileSendTo,this.txtContent.Text,2,DateTime.Now,AdditionalNo,0,0);
                if(Code==1)
                {
                    Response.Write("<script language=javascript>alert('վ���ֻ���Ѷ�Ѿ��ɹ��洢����Ϣ����');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
                else
                {
                    //ErrorMsg = GetErrorMsg(Code);
                    Response.Write("<script language=javascript>alert('�ֻ���Ѷ�洢ʧ��,������');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
            }

            if(AdditionalNo!="")//������վ���ֻ��û�
            {
                int Code = sm.SendMsg(Username,MobileSendTo,this.txtContent.Text,3,DateTime.Now,AdditionalNo,0,0);
                if(Code==1)
                {
                    Response.Write("<script language=javascript>alert('վ���ֻ���Ѷ�Ѿ��ɹ��洢����Ϣ����');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
                else
                {
                    ErrorMsg = GetErrorMsg(Code);
                    Response.Write("<script language=javascript>alert('�ֻ���Ѷ�洢ʧ��,������');</script>");
                    //Response.Redirect("MsgSend.aspx");
                }
            }

            Response.Redirect("Index.aspx?DispType=2");
        }
Beispiel #3
0
        private void CheckUpdate()
        {
            #region 1.����activetime 2.�ж�sessionid 3.ɾ��ʮ������δ��� 4.�õ�������������
            SMS sm = new SMS();
            try
            {
                // ReturnID -1 ��ָ�Ƿ���½ -2ָ���µĶ���Ϣ
                string Username = Request.Cookies["Username"].Value.ToString();
                string SessionID = Request.Cookies["ASP.NET_SessionId"].Value.ToString();
                string NodeID = (Request.Cookies["ActiveNodeID"]!=null)?Request.Cookies["ActiveNodeID"].Value.ToString():"0";
                //UDS.Components .Error.Log(Username+"11"+SessionID+"||"+NodeID);
                string ReturnStr = sm.CheckUpdate(Username,SessionID,Int32.Parse(NodeID));
                string ReturnID = ReturnStr.Substring(0,ReturnStr.IndexOf("|"));
                string NewMsgFlag = ReturnStr.Substring(ReturnStr.IndexOf("|")+1);
                if(ReturnID!="-1")
                {
                    if(NewMsgFlag=="1") //incoming a new msg
                    {
                        if(Request.Cookies["UDS_RemindType"]!=null)
                        {
                            if(Request.Cookies["UDS_RemindType"].Value.ToString()=="1")
                                lit.Text="<script language=javascript> mytop=screen.availHeight-310;myleft=0;var newmsgwin=window.open('../SM/MsgManage.aspx','auto_call_show','height=230,width=400,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top='+mytop+',left='+myleft+',resizable=yes');newmsgwin.focus();</script>";
                            else
                                lit.Text = "<a href='#' onclick='show_sm()'><img src='../../Images/smsremind.gif' border=0></a>";
                        }
                        else
                        {
                            lit.Text="<script language=javascript> mytop=screen.availHeight-310;myleft=0;var newmsgwin=window.open('../SM/MsgManage.aspx','auto_call_show','height=230,width=400,status=0,toolbar=no,menubar=no,location=no,scrollbars=yes,top='+mytop+',left='+myleft+',resizable=yes');newmsgwin.focus();</script>";
                        }
                    }

                    this.lblOnlineCount.Text = ReturnID.ToString();
                }
                else
                {
                    // clear everything
                    //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();

                    Response.Write("<script language=javascript>alert('����ͬ�û���½��ͬһ�������û���½,���ڽ��Զ��ر�!');top.close();</script>");
                }

            }
            catch(Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../Error.aspx");
            }
            #endregion
        }
Beispiel #4
0
        /// <summary>
        /// ���û��Ķ�Ѷ��¼��ʾ��datagrid��
        /// </summary>
        protected void BindGrid(string Username,string DispType)
        {
            SMS sm = new SMS();
            SqlDataReader dr = null;
            if(DispType=="1") //�ҵ����Ľ���
            {
                try
                {
                    dr = sm.GetMyReceive(Username);
                    dgMsgList.DataSource = UDS.Components.Tools.ConvertDataReaderToDataTable(dr).DefaultView;
                    dgMsgList.DataBind();
                }
                catch
                {
                    Server.Transfer("../Error.aspx");
                }
            }

            if(DispType=="2") //��������
            {
                try
                {
                    dr = sm.GetMySent(Username);
                    dgMsgList.DataSource = UDS.Components.Tools.ConvertDataReaderToDataTable(dr).DefaultView;
                    dgMsgList.DataBind();
                }
                catch
                {
                    Server.Transfer("../Error.aspx");
                }

            }

            switch (DispType)
            {
                case "1":
                    dgMsgList.Columns[2].Visible = false; //�������ռ���
                    break;
                case "2":
                    dgMsgList.Columns[1].Visible = false; //�������ռ���
                    this.btnRead .Visible = false;         //�������İ�ť
                    this.btnDelete .Visible = false;       //����ɾ����ť
                    break;
                default:
                    break;
            }

            sm = null;
            dr = null;
        }
Beispiel #5
0
 private void btnNext_Click(object sender, System.EventArgs e)
 {
     SMS sm = new SMS();
     string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
     try
     {
         sm.ReadMsg(this.txtMsgID.Text.ToString(),Username);
         Response.Redirect("MsgManage.aspx");
     }
     catch
     {
         Server.Transfer("../Error.aspx");
     }
 }
Beispiel #6
0
        private void btnRead_Click(object sender, System.EventArgs e)
        {
            SMS sm = new SMS();
            string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
            try
            {

                sm.ReadMsg(this.txtMsgID.Text.ToString(),Username);
                Response.Write("<script language=javascript>window.opener.location.reload();window.close();</script>");

            }
            catch(Exception ex)
            {
                UDS.Components.Error.Log(ex.ToString());
                Server.Transfer("../Error.aspx");
            }
        }
Beispiel #7
0
        private void btnReply_Click(object sender, System.EventArgs e)
        {
            string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
            this.lblInstruction.Text = "�ظ���Ϣ";
            SMS sm = new SMS();

            #region ���¼�¼���Ѷ�״̬

            try
            {
                sm.ReadMsg(this.txtMsgID.Text.ToString(),Username);
            }
            catch
            {
                Server.Transfer("../Error.aspx");
            }
            #endregion

            if(this.btnReply.CommandArgument=="view") //�鿴��Ϣ״̬
            {
                btnReply.Text = "����";
                btnReply.CommandArgument = "reply";
                btnRead.Visible = false;
                btnNext.Visible = false;
                lblSender.Text = "������";
                txtSender.Enabled = true;
                txtContent.Enabled = true;
                txtContent.Text = "";
                this.lblShortCut.Text = "��Ctrl+�س��� ������Ϣ ";
            }
            else //������Ϣ״̬
            { //sender�ı����Ϊreceiver
                int Code = sm.SendMsg(Username,this.txtSender.Text,this.txtContent.Text,1,DateTime.Now,"",0,0);
                if(Code==1)
                    Response.Write("<script language=javascript>alert('�ظ��ɹ�');window.opener.location.reload();window.close();</script>");
                else
                    Response.Write("<script language=javascript>alert('�ظ�ʧ��');window.opener.location.reload();window.close();</script>");

            }
        }
Beispiel #8
0
 private void CheckNextMsg(string Username)
 {
     SMS sm = new SMS();
     int count = 0;
     try
     {
         count = sm.GetNewMsgCount(Username);
         if(count>=2)
         {
             this.btnNext.Enabled = true;
         }
         else
         {
             this.btnNext.Enabled = false;
         }
     }
     catch
     {
         Server.Transfer("../Error.aspx");
     }
 }
Beispiel #9
0
 private void ReadMsg(string Username)
 {
     this.txtSender.Enabled = false;
         this.txtRealName.Enabled = false;
         this.txtContent.Enabled = false;
         this.btnReply.Enabled = true;
         this.btnHistory .Enabled = true;
         SMS sm = new SMS();
         SqlDataReader dataReader = null;
         try
         {
             dataReader = sm.GetNewLocalMsg(Username);
             if (dataReader.Read())
             {
                 this.txtSender.Text = dataReader["Sender"].ToString();
                 this.txtRealName.Text = UDS.Components.Staff.GetRealNameByUsername(this.txtSender.Text);
                 this.txtContent.Text = dataReader["Content"].ToString();
                 this.txtMsgID.Text = dataReader["ID"].ToString();
             }
         }
         catch
         {
             Server.Transfer("../Error.aspx");
         }
         finally {
             dataReader.Close();
         }
 }
Beispiel #10
0
        private void btnSubmit_Click(object sender, System.EventArgs e)
        {
            string info = "<link href=\"../../Css/BasicLayout.css\" rel=\"stylesheet\" type=\"text/css\">";
            info += "<body leftmargin=\"0\" topmargin=\"0\">";
            HttpCookie UserCookie = Request.Cookies["Username"];
            //string Username = UserCookie.Value.ToString();
            string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
            if (ValidateForm())
            {
                if (this.rbAttribute.SelectedItem.Value.ToString() == "1")
                {
                    ArrayList ExistList = CheckExist();
                    if (ExistList.Count > 0)
                    {
                        info += "<table width=100% height=30 border=0 cellpadding=0 cellspacing=0 class=GbText>";
                        info += "<tr>";
                        info += "<td background=\"../../Images/treetopbg.jpg\">&nbsp;&nbsp;����ʱ�γ�ͻ�����</td>";
                        info += "</tr>";
                        info += "</table>";

                        info += "<table width=100% border=1 cellpadding=0 cellspacing=0 style=BORDER-COLLAPSE: collapse borderColor=93BEE2 class=GbText>";
                        info += " <tr align=center bgcolor=#e8f4ff> ";
                        info += "<td width=30% height=24>�����Ա</td>";
                        info += "<td width=30% height=24>����</td>";
                        info += "<td height=24>ʱ��</td>";
                        info += "</tr>";
                        foreach (TaskConflictRecord conrec in ExistList)
                        {
                            int b = Int32.Parse(conrec.Period);
                            DateTime dt = new DateTime(1999, 1, 1, 8, 0, 0, 0);
                            TimeSpan ts = new TimeSpan(0, 0, (b - 1) * 30, 0, 0);
                            DateTime bt = dt.Add(ts);
                            DateTime et = bt.Add(new TimeSpan(0, 0, 30, 0, 0));

                            info += "<tr align=center><td height=20>" + conrec.Username + "</td>";
                            info += "<td>" + conrec.Date + "</td>";
                            info += "<td>" + bt.ToShortTimeString() + "---" + et.ToShortTimeString() + "</td>";
                            info += "</tr>";

                        }
                        info += "</table>";
                        info += "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">";
                        info += "<tr><td height=\"36\" align=\"center\"><font color=\"#FF0000\">����ʱ���г�ͻ</font></td></tr></table>";
                        Response.Write("<script language=javascript>var checkwin=window.open('','check','toolbar=no,scrollbars=yes,width=280,height=200,resizable=yes');");
                        Response.Write("checkwin.document.write('" + info + "');checkwin.moveTo(0,0);checkwin.focus();</script>");
                        return;

                    }
                }

                String TaskID = "";
                ArrayList cooperatorList = new ArrayList();
                Task task = new Task();
                TaskID = task.AddTask(ProcessFormPost());

                //�����������
                if (this.cbRemind.Checked == true)
                {
                    SMS sm = new SMS();
                    sm.SendMsg(Username, UnameStr, "���� " + UDS.Components.Staff.GetRealNameByUsername(Username) + " �����յ���һ���µ�����", 1, DateTime.Now, "", 0, 0);
                    sm = null;
                }

                if (this.rbAttribute.SelectedItem.Value.ToString() == "1")
                {

                    if (this.cbNeedCo.Checked)
                    {
                        string[] UnameArr = System.Text.RegularExpressions.Regex.Split(UnameStr, ",");
                        for (int uc = 0; uc < UnameArr.Length; uc++)
                            cooperatorList.Add(UnameArr[uc].ToString());
                    }
                    else
                    {
                        cooperatorList.Add(Username);
                    }

                    foreach (string s in cooperatorList)
                    {
                        // һ������
                        #region ����ǵ��������
                        if (this.txtBeginDate.Text.ToString() == this.txtEndDate.Text.ToString())
                        {
                            // ȫ������
                            if (this.cbIsAllDay.Checked)
                            {
                                SqlDataReader dataReader = task.GetPeriodInfo();
                                while (dataReader.Read())
                                {
                                    task.AddTaskToSchedule(Int32.Parse(TaskID), Int32.Parse(dataReader[0].ToString()), s, this.txtBeginDate.Text.ToString(), s.ToLower() == Username.ToLower() ? true : false);

                                }
                                dataReader = null;
                            }
                            else
                            {
                                for (int t = Int32.Parse(this.listBeginTime.SelectedItem.Value); t < Int32.Parse(this.listEndTime.SelectedItem.Value); t++)
                                    task.AddTaskToSchedule(Int32.Parse(TaskID), t, s, this.txtBeginDate.Text.ToString(), s.ToLower() == Username.ToLower() ? true : false);

                            }

                        }
                        #endregion

                        // ����Ƕ��������
                        #region ����Ƕ��������
                        if (DateTime.Parse(this.txtBeginDate.Text.ToString()) < DateTime.Parse(this.txtEndDate.Text.ToString()))
                        {
                            TimeSpan ts = new TimeSpan();
                            ts = DateTime.Parse(this.txtEndDate.Text.ToString()) - DateTime.Parse(this.txtBeginDate.Text.ToString());
                            for (int t = 0; t < Int32.Parse(ts.Days.ToString()) + 1; t++) //��������ѭ�����
                            {
                                string tmpDate = DateTime.Parse(this.txtBeginDate.Text.ToString()).AddDays(t).ToString("yyyy-MM-dd");

                                #region �����ȫ������
                                if (this.cbIsAllDay.Checked) //�����ȫ������
                                {
                                    SqlDataReader dataReader = task.GetPeriodInfo();
                                    while (dataReader.Read())
                                    {
                                        task.AddTaskToSchedule(Int32.Parse(TaskID), Int32.Parse(dataReader[0].ToString()), s, tmpDate, s.ToLower() == Username.ToLower() ? true : false);

                                    }
                                    dataReader = null;
                                }
                                #endregion

                                #region  �����ʱ������
                                else //�����ʱ������
                                {
                                    if (this.cbIsRepeat.Checked) // �����ʱ���ظ�
                                    {
                                        for (int j = Int32.Parse(this.listBeginTime.SelectedItem.Value.ToString()); j < Int32.Parse(this.listEndTime.SelectedItem.Value.ToString()); j++)
                                            task.AddTaskToSchedule(Int32.Parse(TaskID), j, s, tmpDate, s.ToLower() == Username.ToLower() ? true : false);
                                    }
                                    else   // �����ȫ��ʱ��
                                    {
                                        if (tmpDate == this.txtBeginDate.Text.ToString())// ����ǿ�ʼ��
                                        {

                                            for (int k = Int32.Parse(this.listBeginTime.SelectedItem.Value.ToString()); k <= 20; k++)
                                                task.AddTaskToSchedule(Int32.Parse(TaskID), k, s, tmpDate, s.ToLower() == Username.ToLower() ? true : false);
                                        }
                                        else if (tmpDate == this.txtEndDate.Text.ToString())
                                        {

                                            for (int k = 1; k < Int32.Parse(this.listEndTime.SelectedItem.Value.ToString()); k++)
                                                task.AddTaskToSchedule(Int32.Parse(TaskID), k, s, tmpDate, s.ToLower() == Username.ToLower() ? true : false);
                                        }
                                        else
                                        {
                                            SqlDataReader dataReader = task.GetPeriodInfo();
                                            while (dataReader.Read())
                                            {
                                                task.AddTaskToSchedule(Int32.Parse(TaskID), Int32.Parse(dataReader[0].ToString()), s, tmpDate, s.ToLower() == Username.ToLower() ? true : false);

                                            }
                                            dataReader = null;

                                        }
                                    }
                                }
                                #endregion
                            }

                        }
                        #endregion
                    }

                }

                else if (this.rbAttribute.SelectedItem.Value.ToString() == "0")
                {
                    if (this.cbNeedCo.Checked)
                    {
                        string[] UnameArr = System.Text.RegularExpressions.Regex.Split(UnameStr, ",");
                        for (int uc = 0; uc < UnameArr.Length; uc++)
                            cooperatorList.Add(UnameArr[uc].ToString());
                    }
                    else
                    {
                        cooperatorList.Add(Username);
                    }
                    foreach (string s in cooperatorList)
                    {
                        task.AddTaskToSchedule(Int32.Parse(TaskID), 0, s, this.txtEndDate.Text, s.ToLower() == Username.ToLower() ? true : false);
                    }

                }

                Response.Write("<script language=javascript>alert('��ӳɹ�!');window.opener.location='TaskList.aspx?displayType=1';window.close();</script>");
            }
        }
Beispiel #11
0
        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);
                }

            }
        }
Beispiel #12
0
        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();
            }
        }
Beispiel #13
0
 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;
 }
Beispiel #14
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            string Username		 = (Request.QueryString["Username"]!=null)?Request.QueryString["Username"].ToString():Request.Cookies["Username"].Value.ToString();
            string DispType		 = (Request.QueryString["DispType"]!=null)?Request.QueryString["DispType"].ToString():"1";

            string result = Request.Params["result"];

            if(!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(result))
                {
                    BindGrid(Username, DispType);
                    Session["MsgDispType"] = DispType;
                    this.btnDelete.Attributes["onclick"] = "javascript:return confirm('��ȷ��Ҫɾ����?');";
                }
                else
                {
                    SMS sm = new SMS();
                    SqlDataReader dreader = null;
                    try
                    {
                        dreader = sm.GetMyReceive(Username);

                        DataTable dt = dreader.ToDataTable(true);

                        List<UDSSMS> retList = new List<UDSSMS>();

                        foreach (DataRow dr in dt.Rows)
                        {
                            if (dr.IsNull("isread") || !bool.Parse(dr["isread"].ToString()))
                            {
                                UDSSMS sms = new UDSSMS()
                                {
                                    Id = dr["ID"].ToString(),
                                    Content = dr["content"].ToString(),
                                    IsRead = dr.IsNull("isread") ? false : bool.Parse(dr["isread"].ToString()),
                                    ReceiverRealName = dr["ReceiverRealName"].ToString(),
                                    Sender = dr["sender"].ToString(),
                                    SenderRealName = dr["senderrealname"].ToString(),
                                    SendTime = DateTime.Parse(dr["sendtime"].ToString()).ToString(),
                                    Type = dr["type"].ToString()
                                };

                                retList.Add(sms);
                            }
                        }

                        var jsonSer = new Newtonsoft.Json.JsonSerializer();
                        StringWriter sw = new StringWriter();
                        using (JsonWriter jw = new JsonTextWriter(sw))
                        {
                            jw.Formatting = Formatting.Indented;

                            jsonSer.Serialize(jw, retList);
                        }

                        string content = sw.ToString();
                        Response.Clear();
                        Response.ContentType = "application/json";
                        sw.Close();
                        Response.Write(content);
                        //HttpContext.Current.ApplicationInstance.CompleteRequest();
                    }
                    catch (Exception eX)
                    {
                        if (null != dreader)
                        {
                            if (!dreader.IsClosed)
                            {
                                dreader.Close();
                            }
                        }

                        Response.StatusCode = 400;
                        Response.ContentType = "text/html";
                        Response.Write(eX.Message);
                        //HttpContext.Current.ApplicationInstance.CompleteRequest();

                    }
                    finally
                    {
                        Response.End();
                    }
                }
            }
        }
Beispiel #15
0
 private void btnRead_Click(object sender, System.EventArgs e)
 {
     SMS sm		= new SMS();
     string Username		 = (Request.QueryString["Username"]!=null)?Request.QueryString["Username"].ToString():Request.Cookies["Username"].Value.ToString();
     string ids			  = "";
     foreach(DataGridItem dgi in dgMsgList.Items)
     {
         CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
         if (cb.Checked==true)
         {
             int i		= dgi.ItemIndex;
             string id	= dgMsgList.DataKeys[i].ToString();
             ids+= id+",";
         }
     }
     if(ids.EndsWith(",")) ids = ids.Substring(0,ids.Length-1);
     //ѡ��Ϊ��
     if( ids==String.Empty)
     {
         Response.Write("<script language=javascript>alert('��ѡ����Ϣ!');window.location='Index.aspx?DispType="+Session["MsgDispType"].ToString()+"';</script>");
     }
     else
     {
         if(sm.ReadMsg(ids,Username))
         {
             Response.Write("<script language=javascript>alert('��Ѷ����!');window.location='Index.aspx?DispType="+Session["MsgDispType"].ToString()+"';</script>");
         }
     }
 }
Beispiel #16
0
        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;
                }
            }
        }
Beispiel #17
0
        /// <summary>
        /// ���Ͳ������������ʼ�����
        /// </summary>
        private MailMainBody ProcessFormPost()
        {
            if(this.cblistAttribute.SelectedIndex.ToString()=="-1")
            {
                Response.Write("<script language=javascript>alert('��ѡ���ʼ�����!');history.go(-1);</script>");
                Response.End();
            }

            if(cblistAttribute.Items[1].Selected)
            {
                if(Request.Form["hdnProjectID"].ToString()=="0")
                {
                    Response.Write("<script language=javascript>alert('��ѡ��鵵��Ŀ!');history.go(-1);</script>");
                    Response.End();
                }

            }
            if(cblistAttribute.Items[0].Selected)
            {

                //���ǿ���֤
                if(Request.Form["hdnTxtSendTo"].ToString()=="")
                {
                    Response.Write("<script language=javascript>alert('��ѡ���ռ���!');history.go(-1);</script>");
                    Response.End();
                }

            }

            // ���������ݲ���
            MailMainBody mailbody		= new MailMainBody();
            //	string cID = "0";

            mailbody.MailFolderType		= 1; //�����ռ���
            mailbody.MailReceiverStr	= Request.Form["hdnTxtSendTo"].ToString();
            mailbody.MailSendDate		= DateTime.Now.ToString();
            mailbody.MailSendLevel		= 1;//default 1 Ԥ��
            mailbody.MailSender			= Username;
            mailbody.MailReceiver		= "";
            mailbody.MailSubject		= (txtSubject.Text=="")?"������":txtSubject.Text;
            mailbody.MailBody			= txtBody.Text.Replace("\r\n","<br/>");
            mailbody.MailCcToAddr		= Request.Form["hdnTxtCcTo"].ToString();
            mailbody.MailBccToAddr		= Request.Form["hdnTxtBccTo"].ToString();
            mailbody.MailReadFlag		= 0;
            mailbody.MailTypeFlag		= 1;
            mailbody.MailClassID        = Request.Form["hdnProjectID"].ToString()!=""?Int32.Parse(Request.Form["hdnProjectID"].ToString()):0;
            mailbody.MailImportance		= Int32.Parse(listImportance.SelectedItem.Value);

            //�����������
            if(this.cbRemind.Checked ==true)
            {
                SMS sm = new SMS();
                sm.SendMsg(Username,mailbody.MailReceiverStr+mailbody.MailCcToAddr+mailbody.MailBccToAddr,"����"+Username+"���յ���һ���µ��ʼ�",1,DateTime.Now,"",0,0);
                sm = null;
            }

            return mailbody;
        }
Beispiel #18
0
        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;
                }
            }
        }