Esempio n. 1
0
        /// <summary>
        /// Get
        /// Calls [usp_select_TaskStatus]
        /// </summary>
        public override TaskStatusDetails Get(System.Int32?taskStatusId)
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_select_TaskStatus", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cmd.Parameters.Add("@TaskStatusId", SqlDbType.Int).Value = taskStatusId;
                cn.Open();
                DbDataReader reader = ExecuteReader(cmd, CommandBehavior.SingleRow);
                if (reader.Read())
                {
                    //return GetTaskStatusFromReader(reader);
                    TaskStatusDetails obj = new TaskStatusDetails();
                    obj.TaskStatusId = GetReaderValue_Int32(reader, "TaskStatusId", 0);
                    obj.Name         = GetReaderValue_String(reader, "Name", "");
                    return(obj);
                }
                else
                {
                    return(null);
                }
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get TaskStatus", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// DropDown
        /// Calls [usp_dropdown_TaskStatus]
        /// </summary>
        public override List <TaskStatusDetails> DropDown()
        {
            SqlConnection cn  = null;
            SqlCommand    cmd = null;

            try {
                cn                 = new SqlConnection(this.ConnectionString);
                cmd                = new SqlCommand("usp_dropdown_TaskStatus", cn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 30;
                cn.Open();
                DbDataReader             reader = ExecuteReader(cmd);
                List <TaskStatusDetails> lst    = new List <TaskStatusDetails>();
                while (reader.Read())
                {
                    TaskStatusDetails obj = new TaskStatusDetails();
                    obj.TaskStatusId = GetReaderValue_Int32(reader, "TaskStatusId", 0);
                    obj.Name         = GetReaderValue_String(reader, "Name", "");
                    lst.Add(obj);
                    obj = null;
                }
                return(lst);
            } catch (SqlException sqlex) {
                //LogException(sqlex);
                throw new Exception("Failed to get TaskStatuss", sqlex);
            } finally {
                cmd.Dispose();
                cn.Close();
                cn.Dispose();
            }
        }
Esempio n. 3
0
        private static TaskStatus PopulateFromDBDetailsObject(TaskStatusDetails obj)
        {
            TaskStatus objNew = new TaskStatus();

            objNew.TaskStatusId = obj.TaskStatusId;
            objNew.Name         = obj.Name;
            return(objNew);
        }