public GetPODOrderDetailViewModel GetOrderDetails_OrderID(int orderid) { DataSet ds = _rsdal.GetOrderDetails_OrderID(orderid); GetPODOrderDetailViewModel Order = new GetPODOrderDetailViewModel(); List <GetPODOrderDetailModel> productlist = new List <GetPODOrderDetailModel>(); GetPODOrderDetailModel product = null; if (ds != null && ds.Tables[0] != null && ds.Tables[1] != null) { if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) {/* * RecordID Quantity PricePerUnit Total ProductID ProductName PackageID PackageName*/ Order.OrderRefNo = ds.Tables[0].Rows[0]["OrderRefNo"].ToString(); Order.DealerName = ds.Tables[0].Rows[0]["Dealer"].ToString(); Order.FarmerId = ds.Tables[0].Rows[0]["FarmerID"].ToString(); Order.FarmerName = ds.Tables[0].Rows[0]["FarmerName"].ToString(); Order.FarmerAddress = ds.Tables[0].Rows[0]["Address"].ToString(); Order.OrderDate = ds.Tables[0].Rows[0]["OrderDate"].ToString(); Order.FarmerContact = ds.Tables[0].Rows[0]["MobNo"].ToString(); Order.GrandTotal = ds.Tables[0].Rows[0]["GrandTotal"].ToString(); Order.DeliveryRemark = ds.Tables[0].Rows[0]["DeliveryRemark"].ToString(); for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { product = new GetPODOrderDetailModel(); product.ProductName = ds.Tables[1].Rows[i]["ProductName"].ToString(); product.Package = ds.Tables[1].Rows[i]["PackageName"].ToString(); product.Qty = ds.Tables[1].Rows[i]["Quantity"].ToString(); product.PricePerUnit = ds.Tables[1].Rows[i]["PricePerUnit"].ToString(); product.TotalPrice = ds.Tables[1].Rows[i]["Total"].ToString(); product.RecordId = ds.Tables[1].Rows[i]["RecordID"].ToString(); product.DiscAmount = ds.Tables[1].Rows[i]["DiscAmt"].ToString(); product.AmountAfterDiscount = ds.Tables[1].Rows[i]["NetAmount"].ToString(); product.OtherCharges = ds.Tables[1].Rows[i]["OtherCharges"].ToString(); // NetDiscount NetPrice product.HSNCode = ds.Tables[1].Rows[i]["HSNcode"].ToString(); product.CGST = ds.Tables[1].Rows[i]["CGST"].ToString(); product.SGST = ds.Tables[1].Rows[i]["SGST"].ToString(); product.TaxValue = ds.Tables[1].Rows[i]["GSTAmout"].ToString(); product.UnitPrice = ds.Tables[1].Rows[i]["UnitPrice"].ToString(); productlist.Add(product); } Order.ProductList = productlist; } } return(Order); }
public GetPODOrderDetailViewModel GetOrderDetails_OrderID(int orderid) { DataSet ds = _Apdal.GetOrderDetails_OrderID(orderid); GetPODOrderDetailViewModel Order = new GetPODOrderDetailViewModel(); List <GetPODOrderDetailModel> productlist = new List <GetPODOrderDetailModel>(); GetPODOrderDetailModel product = null; if (ds != null && ds.Tables[0] != null && ds.Tables[1] != null) { if (ds.Tables[0].Rows.Count > 0 && ds.Tables[1].Rows.Count > 0) {/* * RecordID Quantity PricePerUnit Total ProductID ProductName PackageID PackageName*/ Order.OrderRefNo = ds.Tables[0].Rows[0]["OrderRefNo"].ToString(); Order.DealerName = ds.Tables[0].Rows[0]["Dealer"].ToString(); Order.FarmerId = ds.Tables[0].Rows[0]["FarmerID"].ToString(); Order.FarmerName = ds.Tables[0].Rows[0]["FarmerName"].ToString(); Order.FarmerAddress = ds.Tables[0].Rows[0]["Address"].ToString(); Order.StateName = ds.Tables[0].Rows[0]["StateName"].ToString(); Order.StateId = Convert.ToInt32(ds.Tables[0].Rows[0]["StateID"].ToString()); Order.DistrictName = ds.Tables[0].Rows[0]["DistrictName"].ToString(); Order.DistrictId = Convert.ToInt32(ds.Tables[0].Rows[0]["DistrictID"].ToString()); Order.PaymentMode = Convert.ToInt32(ds.Tables[0].Rows[0]["PaymentMode"].ToString()); Order.BlockName = ds.Tables[0].Rows[0]["BlockName"].ToString(); Order.VillageName = ds.Tables[0].Rows[0]["VillageName"].ToString(); Order.NearByVillageName = ds.Tables[0].Rows[0]["NearByVillage"].ToString(); Order.OrderDate = ds.Tables[0].Rows[0]["OrderDate"].ToString(); Order.DeliveryDate = ds.Tables[0].Rows[0]["DeliveryDate"].ToString(); Order.FarmerContact = ds.Tables[0].Rows[0]["MobNo"].ToString(); Order.GrandTotal = ds.Tables[0].Rows[0]["GrandTotal"].ToString(); Order.DeliveryRemark = ds.Tables[0].Rows[0]["DeliveryRemark"].ToString(); for (int i = 0; i < ds.Tables[1].Rows.Count; i++) { product = new GetPODOrderDetailModel(); product.ProductName = ds.Tables[1].Rows[i]["ProductName"].ToString(); product.ProductID = Convert.ToInt32(ds.Tables[1].Rows[i]["ProductID"].ToString()); product.couponStatus = Convert.ToInt32(ds.Tables[1].Rows[i]["couponStatus"].ToString()); product.Company = ds.Tables[1].Rows[i]["OrganisationName"].ToString(); product.CompanyId = Convert.ToInt32(ds.Tables[1].Rows[i]["CompanyID"].ToString()); product.Brand = ds.Tables[1].Rows[i]["BrandName"].ToString(); product.BrandId = Convert.ToInt32(ds.Tables[1].Rows[i]["BrandID"].ToString()); product.CategoryId = Convert.ToInt32(ds.Tables[1].Rows[i]["CategoryID"].ToString()); product.SubCategoryId = Convert.ToInt32(ds.Tables[1].Rows[i]["SubCategoryID"].ToString()); product.Package = ds.Tables[1].Rows[i]["PackageName"].ToString(); product.Qty = ds.Tables[1].Rows[i]["Quantity"].ToString(); product.PricePerUnit = ds.Tables[1].Rows[i]["PricePerUnit"].ToString(); product.TotalPrice = ds.Tables[1].Rows[i]["Total"].ToString(); product.RecordId = ds.Tables[1].Rows[i]["RecordID"].ToString(); product.DiscAmount = ds.Tables[1].Rows[i]["DiscAmt"].ToString(); product.AmountAfterDiscount = ds.Tables[1].Rows[i]["NetAmount"].ToString(); product.OtherCharges = ds.Tables[1].Rows[i]["OtherCharges"].ToString(); // NetDiscount NetPrice product.HSNCode = ds.Tables[1].Rows[i]["HSNcode"].ToString(); product.CGST = ds.Tables[1].Rows[i]["CGST"].ToString(); product.SGST = ds.Tables[1].Rows[i]["SGST"].ToString(); product.TaxValue = ds.Tables[1].Rows[i]["GSTAmout"].ToString(); product.UnitPrice = ds.Tables[1].Rows[i]["UnitPrice"].ToString(); product.PackageId = ds.Tables[1].Rows[i]["PackageID"].ToString(); product.DistrictID = Convert.ToInt32(ds.Tables[1].Rows[i]["DistrictId"].ToString()); product.CouponID = Convert.ToInt32(ds.Tables[1].Rows[0]["CouponID"].ToString()); product.CouponCode = ds.Tables[1].Rows[0]["CouponCode"].ToString(); product.DiscType = Convert.ToInt32(ds.Tables[1].Rows[0]["DiscTypeID"].ToString()); product.DiscAmount = ds.Tables[1].Rows[0]["DiscAmt"].ToString(); productlist.Add(product); } Order.ProductList = productlist; } } return(Order); }