示例#1
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            HttpCookie UserCookie = Request.Cookies["Username"];

            if (null != UserCookie)
            {
                Username = UserCookie.Value.ToString();
            }

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

            if (!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(result))
                {
                    //考勤操作
                    DutyOperation();
                    Bangding();
                    bindtaskgrid();
                }
                else
                {
                    switch (result)
                    {
                    case "task":
                        UDS.Components.Task task     = new UDS.Components.Task();
                        DataTable           mydb     = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1));
                        List <UDSTask>      retTasks = new List <UDSTask>();
                        foreach (DataRow dr in mydb.Rows)
                        {
                            UDSTask t = new UDSTask();
                            t.ID            = int.Parse(dr["ID"].ToString());
                            t.Subject       = dr["Subject"].ToString();
                            t.BeginPeriodID = int.Parse(dr["beginPeriodID"].ToString());
                            t.EndPeriodID   = int.Parse(dr["endPeriodID"].ToString());
                            t.EndTime       = dr.IsNull("EndTime") ? "" : DateTime.Parse(dr["EndTime"].ToString()).ToShortDateString();
                            retTasks.Add(t);
                        }
                        var          jsonSer = new Newtonsoft.Json.JsonSerializer();
                        StringWriter sw      = new StringWriter();
                        using (JsonWriter jw = new JsonTextWriter(sw))
                        {
                            jw.Formatting = Formatting.Indented;

                            jsonSer.Serialize(jw, retTasks);
                        }

                        Response.Clear();
                        Response.ContentType = "application/json";

                        Response.Write(sw.ToString());
                        sw.Close();
                        //HttpContext.Current.ApplicationInstance.CompleteRequest();
                        Response.End();
                        break;
                    }
                }
            }
        }
示例#2
0
 public void DataGrid_PageChanged(object sender,DataGridPageChangedEventArgs e)
 {
     this.dgList .CurrentPageIndex = e.NewPageIndex;
     UDS.Components.Task task = new UDS.Components.Task();
     DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));
     this.dgList .DataSource = mydb.DefaultView;
     this.dgList.DataBind();
     setgrid();
 }
示例#3
0
        public void DataGrid_PageChanged(object sender, DataGridPageChangedEventArgs e)
        {
            this.dgList.CurrentPageIndex = e.NewPageIndex;
            UDS.Components.Task task = new UDS.Components.Task();
            DataTable           mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1));

            this.dgList.DataSource = mydb.DefaultView;
            this.dgList.DataBind();
            setgrid();
        }
示例#4
0
 public void DataGrid_PageChanged(object sender,DataGridPageChangedEventArgs e)
 {
     Username = (string)Session["Username"];
     this.dgList .CurrentPageIndex = e.NewPageIndex;
     Task task = new Task();
     DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
     this.dgList .DataSource = mydb.DefaultView;
     this.dgList.DataBind();
     setgrid();
 }
示例#5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if(!Page.IsPostBack)
            {

                HttpCookie UserCookie = Request.Cookies["Username"];
                string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
                string TaskID		  = (Request.QueryString["TaskID"]!=null)?Request.QueryString["TaskID"].ToString():"0";
                string Action		  = (Request.QueryString["Action"]!=null)?Request.QueryString["Action"].ToString():"0";
                string CID			  = (Request.QueryString["CID"]!=null)?Request.QueryString["CID"].ToString():"0";
                bool delflag = false;
                Task tsk = new Task();
                if(Action=="1")
                {
                    try
                    {
                        tsk.DeleteTaskComment(Int32.Parse(CID));
                        Response.Redirect("TaskComment.aspx?TaskID="+TaskID);

                    }
                    catch(Exception ex)
                    {
                        UDS.Components.Error .Log(ex.ToString());
                        Server.Transfer("../Error.aspx");
                    }

                }

                TaskClass tc = tsk.GetTaskDetail(Int32.Parse(TaskID));
                if(tc.ArrangedBy == Username) delflag=true;
                SqlDataReader dataReader = null;
                dataReader = tsk.GetTaskComment(Int32.Parse(TaskID));
                this.lt.Text = "<table class=gbtext style='BORDER-COLLAPSE: collapse'>";
                try
                {
                    while (dataReader.Read())
                    {
                        this.lt.Text += "<tr><td>" + dataReader["Comment"].ToString() + "<br>------------<br><font color=red>" + UDS.Components.Staff.GetRealNameByUsername(dataReader["Username"].ToString()) + "  ";
                        this.lt.Text += (delflag) ? "<a href='TaskComment.aspx?Action=1&TaskID=" + TaskID + "&CID=" + dataReader["ID"].ToString() + "'>ɾ��</a>" : "";
                        this.lt.Text += "  </font><br><bR>";
                        this.lt.Text += "</td></tr>";
                    }
                    this.lt.Text += "</table>";
                }
                finally
                {
                    dataReader.Close();
                }

            }
        }
示例#6
0
 private void btnAccept_Click(object sender, System.EventArgs e)
 {
     Task task	  = new Task();
     try
     {
         task.DealTask(TaskID,1,Username,Date);
         task = null;
         Response.Write("<script language=javascript>alert('������ܲ����ɹ�!');window.dialogArguments.location='TaskList.aspx?displayType="+UDS.SubModule .Schedule.TaskList.displayType.ToString()+"';window.close();</script>");
     }
     catch(Exception ex)
     {
         UDS.Components.Error .Log(ex.ToString());
         Server.Transfer("../Error.aspx");
     }
 }
示例#7
0
 private void btnAddCom_Click(object sender, System.EventArgs e)
 {
     HttpCookie UserCookie = Request.Cookies["Username"];
     string Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
     Task task	  = new Task();
     try
     {
         task.AddTaskComment(Username,this.txtComment .Text,Int32.Parse(TaskID));
         task = null;
         Response.Write("<script language=javascript>alert('������ӳɹ�!');</script>");
         TaskCommentFrm.Attributes["src"] = "TaskComment.aspx?TaskID="+TaskID;
     }
     catch(Exception ex)
     {
         UDS.Components.Error .Log(ex.ToString());
         Server.Transfer("../Error.aspx");
     }
 }
示例#8
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if(!Page.IsPostBack)
     {
         HttpCookie UserCookie = Request.Cookies["Username"];
         SqlDataReader dataReader = null;
         Username	  = UserCookie.Value.ToString();
         TaskID		  = (Request.QueryString["TaskID"]!=null)?Request.QueryString["TaskID"].ToString():"0";
         Date		  = (Request.QueryString["Date"]!=null)?Request.QueryString["Date"].ToString():DateTime.Today.ToShortDateString();
         Task task	  = new Task();
         TaskClass tsk = task.GetTaskDetail(Int32.Parse(TaskID));
         dataReader	  = task.GetTaskStatus(Int32.Parse(TaskID));
         this.dgList.DataSource = dataReader;
         this.dgList.DataBind();
         dataReader.Close();
         PopulateData(tsk);
         tsk = null;
         task = null;
         TaskCommentFrm.Attributes["src"] = "TaskComment.aspx?TaskID="+TaskID;
     }
 }
示例#9
0
        public void bindtaskgrid()
        {
            UDS.Components.Task task = new UDS.Components.Task();
            DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));

            //TODO:���ﲻ֪��Ϊʲô����5����Ҫ����հ׼�¼��5�����������������д��󣬵�һ�в�һ�����ַ���
            //if(mydb.Rows.Count<5)
            //{
            //    int tmp = 5-mydb.Rows.Count;
            //    for(int i=0;i<tmp;i++)
            //    {
            //        DataRow myDataRow = mydb.NewRow();
            //        myDataRow[0] = "-";
            //        mydb.Rows.Add(myDataRow);

            //    }
            //}
            this.dgList .DataSource = mydb.DefaultView;
            this.dgList.DataBind();
            // setgrid();
            mydb.Dispose();
        }
示例#10
0
        public void bindtaskgrid()
        {
            UDS.Components.Task task = new UDS.Components.Task();
            DataTable           mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1));

            //TODO:这里不知道为什么不满5条,要补充空白记录到5条,但是这里明显有错误,第一列不一定是字符串
            //if(mydb.Rows.Count<5)
            //{
            //    int tmp = 5-mydb.Rows.Count;
            //    for(int i=0;i<tmp;i++)
            //    {
            //        DataRow myDataRow = mydb.NewRow();
            //        myDataRow[0] = "-";
            //        mydb.Rows.Add(myDataRow);

            //    }
            //}
            this.dgList.DataSource = mydb.DefaultView;
            this.dgList.DataBind();
            // setgrid();
            mydb.Dispose();
        }
示例#11
0
        public void bindtaskgrid()
        {
            UDS.Components.Task task = new UDS.Components.Task();
            DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));

            if(mydb.Rows.Count<5)
            {
                int tmp = 5-mydb.Rows.Count;
                for(int i=0;i<tmp;i++)
                {
                    DataRow myDataRow = mydb.NewRow();
                    myDataRow[0] = "-";
                    myDataRow[0] = "-";
                    mydb.Rows.Add(myDataRow);

                }
            }
            this.dgList .DataSource = mydb.DefaultView;
            this.dgList.DataBind();
            // setgrid();
            mydb.Dispose();
        }
示例#12
0
        /// <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);
        }
示例#13
0
        private ArrayList CheckExist()
        {
            ArrayList cooperatorList = new ArrayList();
            ArrayList ExistList = new ArrayList();
            Task task = new Task();

            if (this.cbNeedCo.Checked)
            {
                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);
                }
            }
            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())
                        {
                            if (task.CheckExist(Int32.Parse(dataReader[0].ToString()), s, this.txtBeginDate.Text.ToString()))
                            {
                                TaskConflictRecord conrec = new TaskConflictRecord();
                                conrec.Username = s;
                                conrec.Date = this.txtBeginDate.Text.ToString();
                                conrec.Period = dataReader[0].ToString();
                                ExistList.Add(conrec);
                                conrec = null;
                            }
                        }
                        dataReader.Close();
                    }
                    else
                    {
                        for (int t = Int32.Parse(this.listBeginTime.SelectedItem.Value.ToString()); t < Int32.Parse(this.listEndTime.SelectedItem.Value.ToString()); t++)
                            if (task.CheckExist(t, s, this.txtBeginDate.Text.ToString()))
                            {
                                TaskConflictRecord conrec = new TaskConflictRecord();
                                conrec.Username = s;
                                conrec.Date = this.txtBeginDate.Text.ToString();
                                conrec.Period = t.ToString();
                                ExistList.Add(conrec);
                                conrec = null;
                            }

                    }

                }
                #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())
                            {
                                if (task.CheckExist(Int32.Parse(dataReader[0].ToString()), s, tmpDate))
                                {
                                    TaskConflictRecord conrec = new TaskConflictRecord();
                                    conrec.Username = s;
                                    conrec.Date = tmpDate;
                                    conrec.Period = dataReader[0].ToString();
                                    ExistList.Add(conrec);
                                    conrec = null;
                                }
                            }
                            dataReader.Close();
                        }
                        #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++)
                                    if (task.CheckExist(j, s, tmpDate))
                                    {
                                        TaskConflictRecord conrec = new TaskConflictRecord();
                                        conrec.Username = s;
                                        conrec.Date = tmpDate;
                                        conrec.Period = j.ToString();
                                        ExistList.Add(conrec);
                                        conrec = null;
                                    }
                            }
                            else   // �����ȫ��ʱ��
                            {
                                if (tmpDate == this.txtBeginDate.Text.ToString())// ����ǿ�ʼ��
                                {

                                    for (int k = Int32.Parse(this.listBeginTime.SelectedItem.Value.ToString()); k < 20; k++)
                                        if (task.CheckExist(k, s, tmpDate))
                                        {
                                            TaskConflictRecord conrec = new TaskConflictRecord();
                                            conrec.Username = s;
                                            conrec.Date = tmpDate;
                                            conrec.Period = (k).ToString();
                                            ExistList.Add(conrec);
                                            conrec = null;
                                        }
                                }
                                else if (tmpDate == this.txtEndDate.Text.ToString())
                                {
                                    for (int k = 1; k < Int32.Parse(this.listEndTime.SelectedItem.Value.ToString()); k++)
                                        if (task.CheckExist(k, s, tmpDate))
                                        {
                                            TaskConflictRecord conrec = new TaskConflictRecord();
                                            conrec.Username = s;
                                            conrec.Date = tmpDate;
                                            conrec.Period = k.ToString();
                                            ExistList.Add(conrec);
                                            conrec = null;
                                        }
                                }
                                else
                                {
                                    SqlDataReader dataReader = task.GetPeriodInfo();
                                    while (dataReader.Read())
                                    {
                                        if (task.CheckExist(Int32.Parse(dataReader[0].ToString()), s, tmpDate))
                                        {
                                            TaskConflictRecord conrec = new TaskConflictRecord();
                                            conrec.Username = s;
                                            conrec.Date = tmpDate;
                                            conrec.Period = dataReader[0].ToString();
                                            ExistList.Add(conrec);
                                            conrec = null;
                                        }

                                    }
                                    dataReader.Close();

                                }
                            }
                        }
                        #endregion
                    }

                }
                #endregion
            }

            return ExistList;
        }
示例#14
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>");
            }
        }
示例#15
0
 private void lnkbtnToday_Click(object sender, System.EventArgs e)
 {
     string Username = (string)Session["Username"];
     this.btnCancelSubscription.Visible = false;
     this.btnCancel.Visible = true;
     displayType = 1;
     this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton2.gif");
     this.tblContainer.Rows[0].Cells[1].Attributes.Add("background","../../images/maillistbutton1.gif");
     this.tblContainer.Rows[0].Cells[2].Attributes.Add("background","../../images/maillistbutton1.gif");
     this.tblContainer.Rows[0].Cells[3].Attributes.Add("background","../../images/maillistbutton1.gif");
     this.tblContainer.Rows[0].Cells[4].Attributes.Add("background","../../images/maillistbutton1.gif");
     Task task = new Task();
     DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
     this.dgList .DataSource = mydb.DefaultView;
     this.dgList.DataBind();
     setgrid();
     mydb.Dispose();
 }
示例#16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Task task	  = new Task();
            if(!Page.IsPostBack)
            {
                HttpCookie UserCookie = Request.Cookies["Username"];
                Username = Server.UrlDecode(Request.Cookies["UserName"].Value);
                TaskID		  = (Request.QueryString["TaskID"]!=null)?Request.QueryString["TaskID"].ToString():"0";
                Date		  = (Request.QueryString["Date"]!=null)?Request.QueryString["Date"].ToString():DateTime.Today.ToShortDateString();

                TaskClass tsk = task.GetTaskDetail(Int32.Parse(TaskID));
                if(tsk.ArrangedBy==Username)
                {
                    this.btnDelete .Visible = true;
                    this.btnFinish .Visible = true;
                    this.btnCancel.Visible = false;
                    this.btnAccept.Visible = false;
                }

                PopulateData(tsk);
                tsk = null;

                TaskCommentFrm.Attributes["src"] = "TaskComment.aspx?TaskID="+TaskID;
                this.btnFinish .Attributes["onclick"] = "javascript:return confirm('��ȷ����?')";
                this.btnDelete.Attributes["onclick"] = "javascript:return confirm('��ȷ��Ҫɾ����������?')";
            }

            SetStatus();
            int status = task.GetTaskStatusBySomeone(Int32.Parse(TaskID),Username);
            if(status==2)
            {
                this.btnAccept.Enabled = false;
                this.btnCancel .Enabled = false;
                this.btnFinish .Enabled = false;
            }
        }
示例#17
0
 private void btnList_Click(object sender, System.EventArgs e)
 {
     string Username = (string)Session["Username"];
     Task task = new Task();
     this.dgList.Visible = true;
     this.btnCancel .Visible = true;
     this.btnAccept .Visible = true;
     DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetTodayTaskBySomeone(DateTime.Today.ToShortDateString(),Username,1));
     this.dgList .DataSource = mydb.DefaultView;
     this.dgList.DataBind();
     setgrid();
     mydb.Dispose();
 }
示例#18
0
        public void PopulateDateToTable(DateTime sDate,int dayCount,string Username)
        {
            string[] UnameStr = System.Text.RegularExpressions.Regex.Split(Username,",");

            Task task = new Task();

            #region ��ʼ���ճ�����
            int[][] TaskData = new int[1][];

            // ��ʼ����������ArrayList
            //			ArrayList demoDayData = new ArrayList();
            //			demoDayData.Add(9);
            //			demoDayData.Add(10);
            //			demoDayData.Add(11);
            //			demoDayData.Add(12);

            //			int[][] TaskData = new int[5][];  //ÿ�յ���������
            //			TaskData[0] = new int[]{0,0,0,0,0,13,14,15,16,17,18};
            //			TaskData[1] = new int[]{8,9,10,11,0,0,0,0,0,0,0};
            //			TaskData[2] = new int[]{0,9,10,11,12,13,0,0,0,0,0};
            //			TaskData[3] = new int[]{8,9,10,11,12,13,14,15,0,0,0};
            //			TaskData[4] = new int[]{0,0,0,0,0,0,0,0,0,17,18};
            //			demoData[5] = new int[]{0,0,0,0,0,0,0,0};
            //			demoData[6] = new int[]{0,0,0,0,0,0,0,0};
            //			demoData[7] = new int[]{0,0,0,0,0,0,0,0};
            // �����к͵�Ԫ��
            ArrayList DaySch = new ArrayList(dayCount+1);//����ѡ��������������� ��1����Ϊ������һ��Ϣ��
            ArrayList DayTask = new ArrayList(dayCount+1); //��¼ÿ���ǰ��������ID
            DaySch.Add(new int[5][]);  //����һ������
            DayTask.Add(new String[5]);
            for(int p=0;p<UnameStr.Length;p++)
            {
                TaskData = new int[5][];
                string tmpDate = sDate.ToShortDateString();
                String[] a = new String[5];
                a = task.GetTop5DayTaskList(tmpDate,UnameStr[p].ToString());

                //	TaskData[0] = new int[]{0,0,0,0,0,13,14,15,16,17,18};
                //				TaskData[1] = new int[]{8,9,10,11,0,0,0,0,0,0,0};
                //				TaskData[2] = new int[]{0,9,10,11,12,13,0,0,0,0,0};
                //				TaskData[3] = new int[]{8,9,10,11,12,13,14,15,0,0,0};
                //				TaskData[4] = new int[]{0,0,0,0,0,0,0,0,0,17,18};
                for(int k=0;k<a.Length;k++)
                {
                    TaskData[k] = task.GetTaskPeriod(tmpDate,UnameStr[p],Int32.Parse(a[k].ToString()));
                }
                DaySch.Add(TaskData);
                DayTask.Add(a);
            }

            #endregion

            int numcells = UnameStr.Length;
            //	int startTimeNo = 8;
            SqlDataReader dataReader = null;
            dataReader =  task.GetPeriodInfo();
            ArrayList period = new ArrayList();
            while(dataReader.Read())
                period.Add(dataReader[1].ToString());
            int numrows = period.Count;

            #region ��ɫ����
            ArrayList colorlist = new ArrayList(5);
            Random ro=new Random();
            string[] colorArray = task.GetTop5ConfirmedTaskList(sDate.ToShortDateString(),Username);
            for(int p=0;p<colorArray.Length;p++)
            {
                int ca = ro.Next(0,255);
                int cb = ro.Next(0,255);
                int cc = ro.Next(0,255);
                colorlist.Add(System.Drawing.Color.FromArgb(ca,cb,cc).ToArgb().ToString("X").Substring(2));
                //							if(colorArray[p].ToString()=="0")
                //								colorlist.Add(Color.FromName("#A692F5"));
                //							else
                //								colorlist.Add(Color.BlanchedAlmond);

            }
                        #endregion

            //  ��ʼ����ͷ
            #region ��ʼ����ͷ
            TableRow r = new TableRow();
            // ����һ����һ�У���ͷΪʱ��
            TableCell c = null;
            c = new TableCell();
            c.CssClass = "top";
            c.Controls.Add(new LiteralControl("<font size=3>"+sDate.ToString("yyyy/MM/dd")+"</font>&nbsp;&nbsp;&nbsp;    "));
            r.Cells.Add(c);

            if(Username!="")
            {

                for (int i=0; i<numcells; i++)
                {
                    string tmp = "";
                    if(UnameStr.Length>1)
                    {
                        for(int cu=0;cu<UnameStr.Length;cu++)
                        {

                            if(cu!=i)
                            {
                                tmp+=UnameStr[cu].ToString()+",";
                            }
                        }
                    }

                    if(tmp.Length!=0)
                        tmp = tmp.Substring(0,tmp.Length-1);

                    string s = "<a href='ViewDayTask.aspx?UnameStr="+tmp+"'>"+UDS.Components .Staff.GetRealNameByUsername(UnameStr[i].ToString())+"</a>";

                    c = new TableCell();
                    c.CssClass = "top";
                    c.Controls.Add(new LiteralControl("&nbsp;"+s+"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"));
                    //c.Controls.Add(new LiteralControl((i==0)?"&nbsp;&nbsp; "+sDate.ToShortDateString()+"&nbsp;&nbsp;&nbsp;    ":s+"&nbsp;&nbsp;&nbsp;"+UDS.Components.Tools.ConvertDayOfWeekToZh(sDate.AddDays(i-1).DayOfWeek)));
                    r.Cells.Add(c);
                }

            #endregion
                //			Table1.CellPadding = 0;
                //			Table1.CellSpacing = 0;
                Table1.Rows.Add(r);
                // ��ʼ����ͷ����

                // ����ʱ��ι�����8��
                for (int j=0; j<numrows; j++)
                {

                    r = new TableRow();

                    // ÿ�и���ѡ�������������
                    for (int i=0; i<UnameStr.Length+1; i++)
                    {

                        c = new TableCell();

                        Table newtable = new Table();

                        if (i==0)
                            if(j%2==0)
                            {
                                string []a = period[j].ToString().Split('-');
                                //c.Controls.Add(new LiteralControl("<div style='position:absolute; width:86px; height:76px; z-index:1'><font size=3>aa"+a[0].ToString()+"</font></div>"));
                                c.Controls.Add(new LiteralControl("<font size=3>"+a[0].ToString()+"</font>"));
                            }
                            else
                                c.Controls.Add(new LiteralControl(""));
                        else
                        { //������ǵ�һ��

                            //					newtable.BorderWidth = 0;
                            //newtable.GridLines = System.Web.UI.WebControls .GridLines.Vertical;
                            // ��ij������table���ÿ�ʼ
                            newtable = new Table();
                            TableRow nr = new TableRow();

                            for(int q=0;q<TaskData.Length;q++)
                            {

                                int[][] tmp =  (int[][])DaySch[i];
                                String[] a = (String[])DayTask[i];
                                TableCell nc = new TableCell();

                                bool flag=false;
                                string col = "";
                                //�������������ʱ�����飬����û�б�ռ
                                for(int co=0;co<TaskData.Length;co++)
                                {
                                    if(Int32.Parse(tmp[co][j].ToString())!=0)
                                    {
                                        flag = true;
                                        col  = colorlist[co].ToString();
                                    }
                                }
                                //	Response.Write(flag.ToString());
                                if(flag)
                                {

                                    nc.Controls.Add(new LiteralControl("<font color="+col+">*"+"</font>"));
                                    nc.BackColor=Color.FromName(col);
                                    nc.Height = 20;
                                    //								nc.BackColor=(System.Drawing.Color)colorlist[q];
                                    //								nc.Attributes.Add("onclick","return dialwinprocess('"+sDate.AddDays(i-1).ToShortDateString()+"','"+(startTimeNo+j).ToString()+"','2','"+a[q]+"')");
                                    //								nc.Style.Add("cursor","hand");

                                }
                                else
                                {

                                    nc.Controls.Add(new LiteralControl("<font color=#FFFFFF>0</font>"));
                                    nc.Height=20;
                                    //		nc.BackColor=Color.FromName("#FFF8F7");
                                    //								nc.Attributes.Add("onclick","return dialwinprocess('"+sDate.AddDays(i-1).ToShortDateString()+"','"+(startTimeNo+j).ToString()+"','1','0')");
                                    //								nc.Attributes.Add("OnMouseOver","return high( this );");
                                    //								nc.Attributes.Add("OnMouseOut","return low( this );");
                                    //nc.Attributes.Add("onclick","return dialwinprocess('"+q.ToString()+j.ToString()+tmp[q][j].ToString()+"')");
                                    //		nc.Style.Add("cursor","hand");
                                    //							System.Drawing.ColorConverter cc=new System.Drawing.ColorConverter();
                                    //							newtable.BackColor=(System.Drawing.Color)cc.ConvertFromString("#FF9900");
                                    //

                                }
                                nr.Cells.Add(nc);

                            }

                            newtable.CellPadding = 0;
                            newtable.CellSpacing = 0;
                            newtable.GridLines = System.Web.UI.WebControls .GridLines.Both;
                            newtable.BorderWidth = 0;
                            newtable.Rows.Add(nr);
                            // ��table���ý���

                            c.Controls.Add(newtable);
                        }

                        r.Cells.Add(c);
                    }
                    Table1.CellPadding = 0;
                    Table1.CellSpacing = 0;
                    Table1.GridLines = System.Web.UI.WebControls .GridLines.Horizontal;
                    Table1.BorderWidth = 1;
                    Table1.Rows.Add(r);

                }

            }
        }
示例#19
0
        public void PopulateDateToTable(DateTime sDate,int dayCount)
        {
            string Username = (string)Session["Username"];
            string[] UnameStr = System.Text.RegularExpressions.Regex.Split(Username,",");
            Task task = new Task();

            #region ��ʼ���ճ�����
            int[][] TaskData = new int[1][];
            Hashtable htcolorlist = new Hashtable();
            // ��ʼ����������ArrayList
            //			ArrayList demoDayData = new ArrayList();
            //			demoDayData.Add(9);
            //			demoDayData.Add(10);
            //			demoDayData.Add(11);
            //			demoDayData.Add(12);

            //			int[][] TaskData = new int[5][];  //ÿ�յ���������
            //			TaskData[0] = new int[]{0,0,0,0,0,13,14,15,16,17,18};
            //			TaskData[1] = new int[]{8,9,10,11,0,0,0,0,0,0,0};
            //			TaskData[2] = new int[]{0,9,10,11,12,13,0,0,0,0,0};
            //			TaskData[3] = new int[]{8,9,10,11,12,13,14,15,0,0,0};
            //			TaskData[4] = new int[]{0,0,0,0,0,0,0,0,0,17,18};
            //			demoData[5] = new int[]{0,0,0,0,0,0,0,0};
            //			demoData[6] = new int[]{0,0,0,0,0,0,0,0};
            //			demoData[7] = new int[]{0,0,0,0,0,0,0,0};
            // �����к͵�Ԫ��
            ArrayList DaySch = new ArrayList(dayCount+1);//����ѡ��������������� ��1����Ϊ������һ��Ϣ��
            ArrayList DayTask = new ArrayList(dayCount+1); //��¼ÿ���ǰ��������ID
            DaySch.Add(new int[5][]);  //����һ������
            DayTask.Add(new String[5]);
            for(int p=0;p<dayCount;p++)
            {
                TaskData = new int[5][];
                string tmpDate = sDate.AddDays(p).ToString();
                String[] a = new String[5];
                a = task.GetTop5DayTaskList(tmpDate,UnameStr[0].ToString());

                //	TaskData[0] = new int[]{0,0,0,0,0,13,14,15,16,17,18};
                //				TaskData[1] = new int[]{8,9,10,11,0,0,0,0,0,0,0};
                //				TaskData[2] = new int[]{0,9,10,11,12,13,0,0,0,0,0};
                //				TaskData[3] = new int[]{8,9,10,11,12,13,14,15,0,0,0};
                //				TaskData[4] = new int[]{0,0,0,0,0,0,0,0,0,17,18};
                for(int k=0;k<a.Length;k++)
                {
                    TaskData[k] = task.GetTaskPeriod(tmpDate,UnameStr[0],Int32.Parse(a[k].ToString()));
                }
                DaySch.Add(TaskData);
                DayTask.Add(a);
            }

            #endregion

            int numcells = dayCount;
            //	int startTimeNo = 8;
            SqlDataReader dataReader = null;
            dataReader =  task.GetPeriodInfo();
            ArrayList period = new ArrayList();
            try
            {
                while (dataReader.Read())
                    period.Add(dataReader[1].ToString());
            }
            finally
            {
                dataReader.Close();
            }
            int numrows = period.Count;

            //  ��ʼ����ͷ

            TableRow r = new TableRow();
            // ����һ����һ�У���ͷΪʱ��
            TableCell c = null;

            if(Username!="")
            {

                for (int i=0; i<numcells+1; i++)
                {

                    string s = sDate.AddDays(i-1).ToShortDateString()==DateTime.Today.ToShortDateString()?"<font color=white><b>"+DateTime.Today.ToShortDateString()+"</b></font>":sDate.AddDays(i-1).ToShortDateString();
                    LiteralControl lc = new LiteralControl((i==0)?"<font color=white>&nbsp;&nbsp; ʱ��&nbsp;&nbsp;&nbsp;    ":"<font color=white>"+s+"&nbsp;&nbsp;&nbsp;"+UDS.Components.Tools.ConvertDayOfWeekToZh(sDate.AddDays(i-1).DayOfWeek)+"</font>");
                    if(i==numcells)
                        lc.Text +="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=tasklist.aspx?SchBeginDate="+DateTime.Parse(SchBeginDate).AddDays(-7).ToShortDateString()+"><font color=white size=3><</font></a>&nbsp;&nbsp;&nbsp; <a href=tasklist.aspx?SchBeginDate="+DateTime.Parse(SchBeginDate).AddDays(7).ToShortDateString()+"><font color=white size=3>></font></a>";
                    c = new TableCell();
                    c.CssClass = "top";
                    c.BackColor = Color.FromName("#337FB2");
                    c.Controls.Add(lc);
                    r.Cells.Add(c);
                }
                Table1.Rows.Add(r);
                // ��ʼ����ͷ����

                // ����ʱ��ι�����8��
                for (int j=0; j<numrows; j++)
                {

                    r = new TableRow();

                    // ÿ�и���ѡ�������������
                    for (int i=0; i<dayCount+1; i++)
                    {

                        c = new TableCell();

                        Table newtable = new Table();

                        if (i==0)
                            if(j%2==0)
                            {
                                string []a = period[j].ToString().Split('-');
                                c.Controls.Add(new LiteralControl("<div style='position:absolute; width:86px; height:76px; z-index:1'><font size=3>"+a[0].ToString()+"</font></div>"));
                            }
                            else
                                c.Controls.Add(new LiteralControl("-"));
                        else
                        { //������ǵ�һ��

                            //					newtable.BorderWidth = 0;
                            //newtable.GridLines = System.Web.UI.WebControls .GridLines.Vertical;
                            // ��ij������table���ÿ�ʼ
                            newtable = new Table();
                            TableRow nr = new TableRow();

                            for(int q=0;q<TaskData.Length;q++)
                            {

                                int[][] tmp =  (int[][])DaySch[i];
                                String[] a = (String[])DayTask[i];
                                TableCell nc = new TableCell();

                                bool flag=false;
                            //	string col = "";
                                string taskid = "";

                                //�������������ʱ�����飬����û�б�ռ
                                for(int co=0;co<TaskData.Length;co++)
                                {
                                    if(Int32.Parse(tmp[co][j].ToString())!=0)
                                    {
                                        flag = true;
                                        taskid = a[co].ToString();
                                    }
                                }

                                if(flag)
                                {

                                    nc.Controls.Add(new LiteralControl("<font color=#C597DD>0"+"</font>"));
                                    nc.BackColor=Color.FromName("#C597DD");
                                    nc.Style.Add("cursor","hand");
                                        nc.Attributes.Add("onclick","return dialwinprocess('"+sDate.AddDays(i-1).ToShortDateString()+"','"+(8+j).ToString()+"','2','"+taskid+"')");

                                }
                                else
                                {

                                    nc.Controls.Add(new LiteralControl("<font color=#FFFFFF>0</font>"));

                                }
                                nr.Cells.Add(nc);

                            }

                            newtable.CellPadding = 0;
                            newtable.CellSpacing = 0;
                            newtable.GridLines = System.Web.UI.WebControls .GridLines.Both;
                            newtable.BorderWidth = 0;
                            newtable.Rows.Add(nr);
                            // ��table���ý���

                            c.Controls.Add(newtable);
                        }

                        r.Cells.Add(c);
                    }
                    Table1.CellPadding = 0;
                    Table1.CellSpacing = 0;
                    Table1.GridLines = System.Web.UI.WebControls .GridLines.Horizontal;
                    Table1.BorderWidth = 1;
                    Table1.Rows.Add(r);

                }

            }
        }
示例#20
0
        private void InitData()
        {
            Username = (string)Session["Username"];

            this.tblContainer.Rows[0].Cells[0].Attributes.Add("background","../../images/maillistbutton2.gif");
            this.btnNew.Attributes["onclick"]= "var newwin=window.open('Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');newwin.moveTo(0,0);newwin.focus();";

            Task task = new Task();
            this.dgList.Visible = true;
            this.btnAccept .Visible = true;
            this.btnCancel.Visible = true;

            //this.lnkbtnAdd.Attributes.Add("onclick","return dialwinprocess('"+DateTime.Today.ToShortDateString()+"','8','1','0')");
            //this.lnkbtnAdd.Attributes.Add("onclick","self.location='CalendarView.aspx?Action=1';return true;");
            DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(),Username,displayType));
            this.dgList .DataSource = mydb.DefaultView;
            this.dgList.DataBind();
            setgrid();
            mydb.Dispose();
            for(int t=0;t<4;t++)
            {
                if(t==displayType-1)
                    this.tblContainer.Rows[0].Cells[t].Attributes.Add("background","../../images/maillistbutton2.gif");
                else
                    this.tblContainer.Rows[0].Cells[t].Attributes.Add("background","../../images/maillistbutton1.gif");
            }
        }
示例#21
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            HttpCookie UserCookie = Request.Cookies["Username"];

            if (null != UserCookie)
            {
                Username = UserCookie.Value.ToString();
            }

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

            if(!Page.IsPostBack)
            {
                if (string.IsNullOrEmpty(result))
                {
                    //���ڲ���
                    DutyOperation();
                    Bangding();
                    bindtaskgrid();
                }
                else
                {
                    switch(result)
                    {
                        case "task":
                            UDS.Components.Task task = new UDS.Components.Task();
                            DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1));
                            List<UDSTask> retTasks = new List<UDSTask>();
                            foreach (DataRow dr in mydb.Rows)
                            {
                                UDSTask t = new UDSTask();
                                t.ID = int.Parse(dr["ID"].ToString());
                                t.Subject = dr["Subject"].ToString();
                                t.BeginPeriodID = int.Parse(dr["beginPeriodID"].ToString());
                                t.EndPeriodID = int.Parse(dr["endPeriodID"].ToString());
                                t.EndTime = dr.IsNull("EndTime") ? "" : DateTime.Parse(dr["EndTime"].ToString()).ToShortDateString();
                                retTasks.Add(t);
                            }
                            var jsonSer = new Newtonsoft.Json.JsonSerializer();
                            StringWriter sw = new StringWriter();
                            using (JsonWriter jw = new JsonTextWriter(sw))
                            {
                                jw.Formatting = Formatting.Indented;

                                jsonSer.Serialize(jw, retTasks);
                            }

                            Response.Clear();
                            Response.ContentType = "application/json";

                            Response.Write(sw.ToString());
                            sw.Close();
                            //HttpContext.Current.ApplicationInstance.CompleteRequest();
                            Response.End();
                            break;
                    }
                }
            }
        }
示例#22
0
        private void lnkbtnFinish_Click(object sender, System.EventArgs e)
        {
            string Username = (string)Session["Username"];
            string ids = "";
            foreach(DataGridItem dgi in this.dgList .Items)
            {
                CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
                if (cb.Checked==true)
                {
                    ids += dgList.DataKeys[dgi.ItemIndex].ToString()+",";
                }
            }

            if(ids!="")
            {
                ids = ids.Substring(0,ids.Length-1);
                Task task = new Task();
                try
                {
                    task.DealTask(ids,2,Username,DateTime.Today.ToShortDateString());
                    Response.Write("<script language=javascript>alert('�����ɹ�!');window.location='TaskList.aspx';</script>");
                    //Response.AddHeader("Refresh","1");
                }
                catch(Exception ex)
                {
                    UDS.Components .Error.Log(ex.ToString());
                    Server.Transfer("../Error.aspx");
                }
            }
        }
示例#23
0
        private void btnSubscribe_Click(object sender, System.EventArgs e)
        {
            string Username = (string)Session["Username"];
            string ActualUsername = (string)Session["ActualUsername"];
            string ids = "";
            Task task = new Task();
            foreach(DataGridItem dgi in this.dgList .Items)
            {
                CheckBox cb=(CheckBox)(dgi.Cells[0].Controls[1]);
                Label  lb=(Label)(dgi.Cells[1].Controls[3]);
                if (cb.Checked==true)
                {
                    try
                    {
                        ids = dgList.DataKeys[dgi.ItemIndex].ToString();
                        if(task.AddTaskSubscription(ActualUsername,Username,Int32.Parse(ids),Convert.ToDateTime(lb.Text.ToString()).ToShortDateString()))
                        Response.Write("<script language=javascript>alert('���ijɹ�!');window.location='TaskList.aspx?displayType="+displayType.ToString()+"';</script>");
                    }
                    catch(Exception dbex)
                    {
                        UDS.Components .Error.Log(dbex.ToString());
                        Server.Transfer("../Error.aspx");
                    }

                }
            }
        }
示例#24
0
        protected void myCalendar_DayRender(object sender, DayRenderEventArgs e)
        {
            UDS.Components.Task task = new UDS.Components.Task();
            DataTable mydb = Tools.ConvertDataReaderToDataTable(task.GetAllTaskBySomeone(DateTime.Today.ToShortDateString(), Username, 1));
            Literal ltl = new Literal();

            e.Cell.Controls.Clear();
            ltl.Text = "";

            ltl.Text = "<a   href='#' onclick=\"javascript:window.open('../Schedule/Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');\">  " + e.Day.Date.Day + " </A>";
            //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>";
            //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>";
            e.Cell.Controls.Add(ltl);

            foreach (DataRow dr in mydb.Rows)
            {
                if (DateTime.Parse(dr["Date"].ToString()).ToShortDateString() == e.Day.Date.ToShortDateString())
                {
                  //  e.Cell.BackColor = System.Drawing.Color.Yellow;

                    e.Cell.Controls.Clear();
                    ltl.Text = "";

                    ltl.Text = "<a   href=\"javascript:dialwinprocess('','','2','" + dr["ID"].ToString() + "');\"> <font color='#FF0000'>" + e.Day.Date.Day + " </font></A>";
                    //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>";
                    //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>";
                    e.Cell.Controls.Add(ltl);
                }
                //else
                //{

                //    e.Cell.Controls.Clear();
                //    ltl.Text = "";

                //    ltl.Text = "<a   href='#' onclick=\"javascript:window.open('../Schedule/Manage.aspx','newtask','toolbar=yes,scrollbars=yes,width=800,height=600,resizable=yes');\">  " + e.Day.Date.Day + " </A>";
                //    //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>";
                //    //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>";
                //    e.Cell.Controls.Add(ltl);
                //}
            }

            //DateTime nextDate;
            //Literal ltl = new Literal();

            //        nextDate = DateTime.Now;
            //        if (nextDate.ToShortDateString() == e.Day.Date.ToShortDateString())
            //        {
            //            e.Cell.BackColor = System.Drawing.Color.Blue;
            //            e.Cell.Controls.Clear();
            //            ltl.Text = "";

            //            ltl.Text = "<a class=date href=\"javascript:location.href='http://www.google.com';\">  " + e.Day.Date.Day + " </A>";
            //            //ltl.Text += "<DIV class=\"BlackDate\">" + e.Day.Date.Day + "</DIV>";
            //            //ltl.Text += e.Day.Date == myCalendar.TodaysDate ? "<DIV class=\"RedDate\">" + e.Day.Date.Day + "</DIV>" : "<DIV class=\"WhiteDate\">" + e.Day.Date.Day + "</DIV>";
            //            e.Cell.Controls.Add(ltl);
            //        }
        }