Exemplo n.º 1
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");
        }
Exemplo n.º 2
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>");

            }
        }
Exemplo n.º 3
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>");
            }
        }
Exemplo n.º 4
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;
 }
Exemplo n.º 5
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;
                }
            }
        }
Exemplo n.º 6
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;
        }
Exemplo n.º 7
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;
                }
            }
        }
Exemplo n.º 8
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();
            }
        }