コード例 #1
0
        public List <TaskMaster> SearchTaskMaster()
        {
            List <TaskMaster> listitem   = new List <TaskMaster>();
            SqlConnection     connection = new SqlConnection(DbReadConfig.DbConnection);
            SqlCommand        cmd        = new SqlCommand("Sp_FetchTaskMaster", connection);

            cmd.Parameters.AddWithValue("@EmployeeId", EmployeeId);
            cmd.Parameters.AddWithValue("@fromDate", fromDate);
            cmd.Parameters.AddWithValue("@toDate", toDate);
            cmd.Parameters.AddWithValue("@ActionMode", "FetchTaskMaster");
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter sda = new SqlDataAdapter();

            if (ConnectionState.Closed == connection.State)
            {
                connection.Open();
            }
            sda.SelectCommand = cmd;
            dtresult          = new DataTable();
            sda.Fill(dtresult);

            if (dtresult.Rows.Count > 0 && dtresult != null)
            {
                foreach (DataRow dr in dtresult.Rows)
                {
                    TaskMaster gr = new TaskMaster();

                    if (!dr.IsNull("Title"))
                    {
                        gr.Title = dr["Title"].ToString();
                    }
                    if (!dr.IsNull("TaskTitle"))
                    {
                        gr.TaskTitle = dr["TaskTitle"].ToString();
                    }
                    if (!dr.IsNull("Duration"))
                    {
                        gr.Duration = dr["Duration"].ToString();
                    }

                    if (!dr.IsNull("EmployeName"))
                    {
                        gr.EmployeName = dr["EmployeName"].ToString();
                    }

                    listitem.Add(gr);
                }
            }
            return(listitem.ToList());
        }
コード例 #2
0
        public List <TaskMaster> ProjectDropdowndata()
        {
            List <TaskMaster> listitem   = new List <TaskMaster>();
            SqlConnection     connection = new SqlConnection(DbReadConfig.DbConnection);
            SqlCommand        cmd        = new SqlCommand("SP_CommonForDropdown", connection);

            cmd.Parameters.AddWithValue("@ActionMode", "SymptomsRecord");
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter sda = new SqlDataAdapter();

            if (ConnectionState.Closed == connection.State)
            {
                connection.Open();
            }
            sda.SelectCommand = cmd;
            dtresult          = new DataTable();
            sda.Fill(dtresult);

            if (dtresult.Rows.Count > 0 && dtresult != null)
            {
                foreach (DataRow dr in dtresult.Rows)
                {
                    TaskMaster gr = new TaskMaster();

                    if (!dr.IsNull("Title"))
                    {
                        gr.Title = dr["Title"].ToString();
                    }
                    if (!dr.IsNull("ProjectId"))
                    {
                        gr.ProjectId = Convert.ToInt32(dr["ProjectId"]);
                    }


                    listitem.Add(gr);
                }
            }
            return(listitem.ToList());
        }