Ejemplo n.º 1
0
Archivo: Task.cs Proyecto: youye00/UDS
        /// <summary>
        /// 获得某条任务的详细信息
        /// </summary>
        public TaskClass GetTaskDetail(int TaskID)
        {
            // 定义数据库操作类及DataReader
            Database      data       = new Database();
            SqlDataReader dataReader = null;
            TaskClass     tsk        = new TaskClass();

            // 执行存储过程,并返回SqlDataReader对象
            SqlParameter[] prams =
            {
                data.MakeInParam("@TaskID", SqlDbType.Int, 8, TaskID)
            };

            try
            {
                data.RunProc("sp_GetTaskDetail", prams, out dataReader);

                if (dataReader.Read())
                {
                    tsk.ArrangedBy     = dataReader["ArrangedBy"].ToString();
                    tsk.Detail         = dataReader["Detail"].ToString();
                    tsk.StartTime      = dataReader["StartTime"].ToString();
                    tsk.EndTime        = dataReader["EndTime"].ToString();
                    tsk.ProjectID      = Int32.Parse(dataReader["ProjectID"].ToString());
                    tsk.Subject        = dataReader["Subject"].ToString();
                    tsk.CooperatorList = dataReader["CooperatorList"].ToString();
                    tsk.Type           = Int32.Parse(dataReader["Type"].ToString());
                    tsk.Attribute      = dataReader["Attribute"].ToString() == "True"?1:0;
                    tsk.ContractList   = dataReader["ContractList"].ToString();
                }


                dataReader = null;
                data.Dispose();
                return(tsk);
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("获得某条任务某天的的时间段出错!", ex);
            }
            finally
            {
                data.Dispose();
                dataReader = null;
            }
        }
Ejemplo n.º 2
0
Archivo: Task.cs Proyecto: youye00/UDS
        /// <summary>
        /// 任务添加
        /// </summary>
        /// <param name="TaskClass">Task类</param>
        public string AddTask(TaskClass tc)
        {
            // create data object and params
            Database data   = new Database();
            string   TaskID = "";

            SqlParameter[] prams =
            {
                data.MakeInParam("@ArrangedBy",      SqlDbType.VarChar,    20, tc.ArrangedBy),
                data.MakeInParam("@Subject",         SqlDbType.VarChar,    50, tc.Subject),
                data.MakeInParam("@Detail",          SqlDbType.VarChar,   300, tc.Detail),
                data.MakeInParam("@ProjectID",       SqlDbType.SmallInt,   20, tc.ProjectID),
                data.MakeInParam("@StartTime",       SqlDbType.DateTime,   20, DateTime.Parse(tc.StartTime.ToString())),
                data.MakeInParam("@EndTime",         SqlDbType.DateTime,   20, DateTime.Parse(tc.EndTime.ToString())),
                data.MakeInParam("@Attribute",       SqlDbType.Int,         1, tc.Attribute),
                data.MakeInParam("@Type",            SqlDbType.Int,         1, tc.Type),
                data.MakeInParam("@Status",          SqlDbType.Bit,         1, tc.Status),
                data.MakeInParam("@Tag",             SqlDbType.Int,         1, tc.Tag),
                data.MakeInParam("@IsAwake",         SqlDbType.Bit,         1, tc.IsAwake),
                data.MakeInParam("@AwakeTime",       SqlDbType.DateTime,   20, DateTime.Parse(tc.AwakeTime)),
                data.MakeInParam("@ContractList",    SqlDbType.NVarChar, 6000, tc.ContractList),
                data.MakeInParam("@CooperatorList",  SqlDbType.NVarChar, 6000, tc.CooperatorList),
                data.MakeOutParam("@InsertedTaskID", SqlDbType.Int, 20)
            };

            try
            {
                data.RunProc("SP_AddTask", prams);
                TaskID = prams[14].Value.ToString();
                if (TaskID == string.Empty)
                {
                    return(null);
                }
                else
                {
                    return(TaskID);
                }
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("任务添加出错!", ex);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// �������
        /// </summary>
        /// <param name="TaskClass">Task��</param>
        public string AddTask(TaskClass tc)
        {
            // create data object and params
            Database data = new Database();
            string TaskID = "";
            SqlParameter[] prams = {
                                       data.MakeInParam("@ArrangedBy",  SqlDbType.VarChar, 20, tc.ArrangedBy),
                                       data.MakeInParam("@Subject",  SqlDbType.VarChar, 50, tc.Subject),
                                       data.MakeInParam("@Detail",  SqlDbType.VarChar, 300, tc.Detail),
                                       data.MakeInParam("@ProjectID",  SqlDbType.SmallInt,20, tc.ProjectID),
                                       data.MakeInParam("@StartTime",  SqlDbType.DateTime, 20, DateTime.Parse(tc.StartTime.ToString())),
                                       data.MakeInParam("@EndTime",  SqlDbType.DateTime, 20, DateTime.Parse(tc.EndTime.ToString())),
                                       data.MakeInParam("@Attribute",  SqlDbType.Int, 1, tc.Attribute),
                                       data.MakeInParam("@Type",  SqlDbType.Int, 1, tc.Type),
                                       data.MakeInParam("@Status",  SqlDbType.Bit , 1, tc.Status),
                                       data.MakeInParam("@Tag",  SqlDbType.Int, 1, tc.Tag),
                                       data.MakeInParam("@IsAwake",  SqlDbType.Bit, 1, tc.IsAwake),
                                       data.MakeInParam("@AwakeTime",  SqlDbType.DateTime, 20, DateTime.Parse(tc.AwakeTime)),
                                       data.MakeInParam("@ContractList",  SqlDbType.VarChar, 50, tc.ContractList),
                                       data.MakeInParam("@CooperatorList", SqlDbType.VarChar, 200, tc.CooperatorList),
                                       data.MakeOutParam("@InsertedTaskID", SqlDbType.Int,20)
                                   };

            try
            {
                data.RunProc("SP_AddTask", prams);
                TaskID = prams[14].Value.ToString();
                if (TaskID == string.Empty )
                    return null;
                else
                    return TaskID;
            }
            catch (Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("������ӳ���!",ex);
            }
        }
Ejemplo n.º 4
0
        private void PopulateData(TaskClass tsk)
        {
            //			string Type="";
            //
            //			switch (tsk.Type)
            //			{
            //				case 1:
            //					Type="����";
            //					break;
            //				case 2:
            //					Type="��";
            //					break;
            //				case 3:
            //					Type="����";
            //					break;
            //				case 4:
            //					Type="�绰";
            //					break;
            //				case 5:
            //					Type="�߷�";
            //					break;
            //				case 6:
            //					Type="���";
            //					break;
            //				case 7:
            //					Type="����";
            //					break;
            //				case 8:
            //					Type="����";
            //					break;
            //
            //			}
            //

            this.lblArrangedBy .Text	= UDS.Components .Staff.GetRealNameByUsername(tsk.ArrangedBy) ;
            //this.lblCooperator .Text    = tsk.CooperatorList ;
        }
Ejemplo n.º 5
0
        private TaskClass ProcessFormPost()
        {
            TaskClass tc = new TaskClass();
            tc.ArrangedBy = Username;
            tc.Detail = this.txtDetail.Text.ToString();
            tc.Type = Int32.Parse(this.rbType.SelectedItem.Value.ToString());
            tc.Attribute = Int32.Parse(this.rbAttribute.SelectedItem.Value.ToString());
            tc.Subject = this.txtSubject.Text.ToString();
            tc.ProjectID = Request.Form["hdnProjectID"].ToString() != "" ? Int32.Parse(Request.Form["hdnProjectID"].ToString()) : 0;
            tc.StartTime = this.txtBeginDate.Text.ToString() + " " + ((this.cbIsAllDay.Checked) ? "" : this.listBeginTime.SelectedItem.Text.ToString());
            tc.EndTime = this.txtEndDate.Text.ToString() + " " + ((this.cbIsAllDay.Checked) ? "" : this.listEndTime.SelectedItem.Text.ToString());
            tc.AwakeTime = DateTime.Parse(tc.EndTime).AddMinutes(-10).ToString();
            tc.Tag = 0;
            tc.ContractList = "";
            tc.CooperatorList = UnameStr;
            //			foreach(ListItem i in this.listCooperator .Items)
            //				if(i.Selected == true)
            //					tc.CooperatorList+= i.Value.ToString()+",";

            return tc;
        }
Ejemplo n.º 6
0
        private void PopulateData(TaskClass tsk)
        {
            string ClassName = "",Type="";

            switch (tsk.Type) {
            case 1:
                Type="����";
                break;
            case 2:
                Type="��";
                break;
            case 3:
                Type="����";
                break;
            case 4:
                Type="�绰";
                break;
            case 5:
                Type="�߷�";
                break;
            case 6:
                Type="���";
                break;
            case 7:
                Type="����";
                break;
            case 8:
                Type="����";
                break;

            }

            this.lblSubject .Text		= tsk.Subject ;
            this.lblDetail .Text		= tsk.Detail ;
            this.lblStartTime .Text		= (DateTime.Parse(tsk.StartTime).ToShortTimeString()=="0:00")?DateTime.Parse(tsk.StartTime).ToShortDateString()+" 8:00":tsk.StartTime;
            this.lblEndTime .Text		= (DateTime.Parse(tsk.EndTime).ToShortTimeString()=="0:00")?DateTime.Parse(tsk.EndTime).ToShortDateString()+" 18:00":tsk.EndTime;
            this.lblArrangedBy .Text	= UDS.Components .Staff.GetRealNameByUsername(tsk.ArrangedBy) ;
            this.lblCooperator .Text    = UDS.Components .Staff.GetRealNameStrByUsernameStr(tsk.CooperatorList,0) ;

            this.lblType.Text			= Type;
            this.lblAttribute.Text		= tsk.Attribute.ToString()=="1"?"��ռ����":"��ʱ����";
            if(tsk.ProjectID!=0)
            {
                ProjectClass prj = new ProjectClass();
                SqlDataReader dataReader =  prj.GetProjectDetail(tsk.ProjectID);
                try
                {
                    if (dataReader.Read())
                        ClassName = dataReader["ClassName"].ToString();
                }
                finally
                {
                    dataReader.Close();
                }
                prj = null;
            }
            this.lblProjectID .Text = (tsk.ProjectID ==0)?"��":"<a href='#' onclick=javascript:window.close();window.dialogArguments.location='../UnitiveDocument/Project.aspx?classID="+tsk.ProjectID .ToString()+"'>"+ClassName+"</a>";
        }
Ejemplo n.º 7
0
        /// <summary>
        /// ���ij���������ϸ��Ϣ
        /// </summary>
        public TaskClass GetTaskDetail(int TaskID)
        {
            // �������ݿ�����༰DataReader
            Database data = new Database();
            SqlDataReader dataReader = null;
            TaskClass tsk = new TaskClass();
            // ִ�д洢���̣�������SqlDataReader����
            SqlParameter[] prams = {
                                       data.MakeInParam("@TaskID",  SqlDbType.Int,8, TaskID)
                                   };

            try
            {
                data.RunProc("sp_GetTaskDetail",prams,out dataReader);

                if(dataReader.Read())
                {
                    tsk.ArrangedBy     = dataReader["ArrangedBy"].ToString();
                    tsk.Detail		   = dataReader["Detail"].ToString();
                    tsk.StartTime	   = dataReader["StartTime"].ToString();
                    tsk.EndTime		   = dataReader["EndTime"].ToString();
                    tsk.ProjectID	   = Int32.Parse(dataReader["ProjectID"].ToString());
                    tsk.Subject		   = dataReader["Subject"].ToString();
                    tsk.CooperatorList = dataReader["CooperatorList"].ToString();
                    tsk.Type		   = Int32.Parse(dataReader["Type"].ToString());
                    tsk.Attribute	   = dataReader["Attribute"].ToString()=="True"?1:0;
                    tsk.ContractList   = dataReader["ContractList"].ToString();
                }

                dataReader = null;
                data.Dispose();
                return tsk;

            }
            catch(Exception ex)
            {
                Error.Log(ex.ToString());
                throw new Exception("���ij������ij��ĵ�ʱ��γ���!",ex);
            }
            finally
            {

                if (data != null)
                {
                    data.Close();
                }
                if (dataReader != null)
                {
                    dataReader.Close();
                }
                dataReader = null;
            }
        }