TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Prasad Bhagat
NA
516
236.5k
How to access a value when its inside of a list in the matho
Sep 28 2015 4:09 AM
Dear All,
Find Bellow code for above Question...
this is my method ....in DAL..
public Entity.ProductDetails GetAdminProductDetails(string Id, string CompanyCode)
{
DAO.Product getProductDetails = null;
DataSet dsProductDetails = null;
getProductDetails = new DAO.Product();
dsProductDetails = getProductDetails.GetAdminProductDetails(Id, CompanyCode);
productDetails.Id = dtblProductDetails.Rows[0]["Id"].ToString();
productDetails.Name = dtblProductDetails.Rows[0]["Name"].ToString();
productDetails.Description = dtblProductDetails.Rows[0]["Description"].ToString(); // Long Description (Wine Master * Wine Details)
productDetails.Vintage = Common.ChangeVintageTo4Digit(dtblProductDetails.Rows[0]["Vintage"].ToString().Trim());
productDetails.TastingNotes = dtblProductDetails.Rows[0]["TastingNotes"].ToString();
productDetails.BottleSize = dtblProductDetails.Rows[0]["BottleSize"].ToString();
Now I Have a list in this method.....
-------------------------------------
if (dsProductDetails.Tables[1] != null)
{
DataTable dtblWineRatings = dsProductDetails.Tables[1];
List<Entity.RatingDetails> lstRating = new List<Entity.RatingDetails>();
for (int i = 0; i < dtblWineRatings.Rows.Count; i++)
{
Entity.RatingDetails rating = new Entity.RatingDetails();
rating.Rating = dtblWineRatings.Rows[i]["Rating"].ToString();
rating.Description = dtblWineRatings.Rows[i]["Description"].ToString();
// Commented by Gopi dated on Jun-15-2015
// Reason for : Rating value required 92+ or 92-94. So chnage the data type int to string.
//rating.Value = Common.ConvertInt(dtblWineRatings.Rows[i]["Value"]);
rating.Value = dtblWineRatings.Rows[i]["Value"].ToString();
if (dtblWineRatings.Rows[i]["Description"].ToString() != "" && dtblWineRatings.Rows[i]["Value"].ToString() != "")
rating.PointsDescription = rating.Description + ": " + rating.Value + " points";
rating.TastingNotes = dtblWineRatings.Rows[i]["TastingNotes"].ToString();
rating.CreatedDate = dtblWineRatings.Rows[i]["Date"].ToString();
lstRating.Add(rating);
}
productDetails.LstRatingDetails = lstRating;
}
}
Now Coming To my UI Layer i am Aceessing values like bellow ..
protected void GetProductDetails_Click(object sender, EventArgs e)
{
WineLegend.BO.Admin.Products obj = new WineLegend.BO.Admin.Products();
string CompanyCode = "WL";
string ItemNumber = Text9.Text.Trim();
if (ItemNumber.Length > 0)
{
var temp = obj.GetProductDetailsByItemNumber(ItemNumber, CompanyCode);
if (temp != null)
{
if (temp.Name.Length > 0)
Text5.Text = temp.Name;
if (temp.RegularPrice.Length > 0)
Text6.Text = temp.RegularPrice;
if (temp.SalePrice.Length > 0)
Text7.Text = temp.SalePrice;
if (temp.FreeShipping == "Y")
Text4.Text = "+ FREE SHIPPING";
else
Text4.Text = "NO FREE SHIPPING";
if (temp.NoOfBtlFreeShipping > 0)
Text8.Text = "Free Shipping With" + " " + Convert.ToInt32(temp.NoOfBtlFreeShipping).ToString() + " " + "OR More BTLS";
else
Text8.Text = "NO FREE SHIPPING";
if (temp.ImageMedium.Length > 0)
lblImagepath.Text = temp.ImageSmall;
---Now Here I want to Access the list vallues of PointsDescription,TastingNotes to my controles please help me
how is it possible ...am anble to do this please..
Reply
Answers (
3
)
Connect to MQ to get and put message
Data Need Export in Encript formate in text File