public clsSizeCodes GetSizeCodeInfoByProjectandSizeCode(string Project, string SizeCode)
        {
            clsSizeCodes info = new clsSizeCodes();

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

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

                    cmd.Parameters.AddWithValue("@ProjectID", Project);
                    cmd.Parameters.AddWithValue("@SizeCodeID", SizeCode);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        info.strUnitSizeCode        = reader["Project"].ToString();
                        info.strUnitSizeCode        = reader["UnitSizeCode"].ToString();
                        info.strUnitSizeDescription = reader["UnitSizeDescription"].ToString();
                        info.decArea          = Convert.ToDecimal(reader["Area"]);
                        info.UoMID            = reader["UoMID"].ToString();
                        info.UoMDescription   = reader["UoMDescription"].ToString();
                        info.strPrefix        = reader["Prefix"].ToString();
                        info.strCurrentNumber = reader["CurrentNumber"].ToString();
                        info.ID = Convert.ToInt32(reader["ID"]);
                    }
                    conn.Close();
                }
            }
            return(info);
        }
        public bool AddSizeCode(clsSizeCodes info)
        {
            int st = 0;

            try
            {
                using (SqlConnection conn = new SqlConnection(strConn))
                {
                    conn.Open();
                    {
                        using (SqlCommand cmd = new SqlCommand("TMR_USP_AddSizeCode"))
                        {
                            cmd.CommandType = CommandType.StoredProcedure;
                            cmd.Connection  = conn;
                            cmd.Parameters.AddWithValue("@Project", info.strProject);
                            cmd.Parameters.AddWithValue("@UnitSizeCode", info.strUnitSizeCode);
                            cmd.Parameters.AddWithValue("@UnitSizeDescription", info.strUnitSizeDescription);
                            cmd.Parameters.AddWithValue("@Area", info.decArea);
                            cmd.Parameters.AddWithValue("@UnitID", info.UoMID);
                            cmd.Parameters.AddWithValue("@UnitDescription", info.UoMDescription);
                            cmd.Parameters.AddWithValue("@Prefix", info.strPrefix);
                            cmd.Parameters.AddWithValue("@CurrentNumber", info.strCurrentNumber);
                            cmd.Parameters.AddWithValue("@ID", info.ID);
                            st = cmd.ExecuteNonQuery();
                        }
                    }
                    conn.Close();
                }
            }
            catch (Exception ex) { }
            if (st > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public List <clsSizeCodes> GetAllSizeCodeInfoByProject(string strProject)
        {
            List <clsSizeCodes> lst = new List <clsSizeCodes>();

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

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

                    cmd.Parameters.AddWithValue("@ProjectID", strProject);

                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        var info = new clsSizeCodes();
                        info.strProject             = reader["Project"].ToString();
                        info.strUnitSizeCode        = reader["UnitSizeCode"].ToString();
                        info.strUnitSizeDescription = reader["UnitSizeDescription"].ToString();
                        info.decArea          = Convert.ToDecimal(reader["Area"]);
                        info.UoMID            = reader["UoMID"].ToString();
                        info.UoMDescription   = reader["UoMDescription"].ToString();
                        info.strPrefix        = reader["Prefix"].ToString();
                        info.strCurrentNumber = reader["CurrentNumber"].ToString();
                        info.ID = Convert.ToInt32(reader["ID"]);

                        lst.Add(info);
                    }
                    conn.Close();
                }
            }
            return(lst);
        }