Example #1
0
        public List <clsUnitRevaluation> GetRevaluationList()
        {
            List <clsUnitRevaluation> lst = new List <clsUnitRevaluation>();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_GetReavluationList"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        var info = new clsUnitRevaluation();

                        info.strProject                = reader["ProjectID"].ToString();
                        info.strBlock                  = reader["BlockID"].ToString();
                        info.dateRevaluationDate       = Convert.ToDateTime(reader["RevalueDate"]);
                        info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                        info.id = Convert.ToInt32(reader["id"].ToString());

                        lst.Add(info);
                    }
                    conn.Close();
                }
            }
            return(lst);
        }
Example #2
0
        public bool AddUnitRevaluation(clsUnitRevaluation info, ref int id)
        {
            int st = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();

                    {
                        using (SqlCommand cmd = new SqlCommand("TMR_USP_AddUnitRevaluation"))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Connection  = conn;
                            cmd.Parameters.AddWithValue("@ProjectID", info.strProject);
                            cmd.Parameters.AddWithValue("@BlockID", info.strBlock);
                            cmd.Parameters.AddWithValue("@RevalueDate", info.dateRevaluationDate);
                            cmd.Parameters.AddWithValue("@Revaluationid", info.id);
                            cmd.Parameters.AddWithValue("@ApprovalStatusCode", info.ApprovalStatusCode);
                            cmd.Parameters.AddWithValue("@ApprovalActionUser", info.ApprovalActionUser);
                            cmd.Parameters.AddWithValue("@ApprovalActionDate", info.ApprovalActionDate);
                            cmd.Parameters.AddWithValue("@CreatedBy", info.CreatedBy);
                            cmd.Parameters.AddWithValue("@CreationDate", info.CreationDate);
                            cmd.Parameters.AddWithValue("@LastUpdateUser", info.LastUpdateUser);
                            cmd.Parameters.AddWithValue("@LastUpdateDate", info.LastUpdateDate);
                            SqlParameter parm = new SqlParameter();
                            parm.ParameterName = "@Outid";
                            parm.SqlDbType     = SqlDbType.Int;
                            parm.Direction     = ParameterDirection.Output;
                            //parm.Value = info.id;

                            cmd.Parameters.Add(parm);

                            st = cmd.ExecuteNonQuery();

                            id = (int)parm.Value;
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex) { }
            if (st > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public clsUnitRevaluation GetUnitRevaluationById(int id)
        {
            clsUnitRevaluation info = new clsUnitRevaluation();

            using (SqlConnection conn = new SqlConnection(strConn))
            {
                conn.Open();

                using (SqlCommand cmd = new SqlCommand("TMR_USP_GetUnitRevaluationByID"))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = conn;
                    cmd.Parameters.AddWithValue("@id", id);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        info.strProject                = reader["ProjectID"].ToString();
                        info.strBlock                  = reader["BlockID"].ToString();
                        info.dateRevaluationDate       = Convert.ToDateTime(reader["RevalueDate"]);
                        info.ApprovalStatusCode        = Convert.ToInt32(reader["ApprovalStatusCode"].ToString());
                        info.ApprovalStatusDescription = reader["ApprovalStatusDescription"].ToString();
                        info.ApprovalActionUser        = reader["ApprovalActionUser"].ToString();
                        info.ApprovalActionDate        = Convert.ToDateTime(reader["ApprovalActionDate"].ToString());
                        info.CreatedBy                 = reader["CreatedBy"].ToString();
                        info.CreationDate              = Convert.ToDateTime(reader["CreationDate"].ToString());
                        info.LastUpdateUser            = reader["LastUpdateUser"].ToString();
                        info.LastUpdateDate            = Convert.ToDateTime(reader["LastUpdateDate"].ToString());

                        info.id = Convert.ToInt32(reader["id"]);
                    }
                    conn.Close();
                }
            }
            return(info);
        }