private int GetAvailableBids(string referralScheme, decimal moneyLevel)
{
int freeBids=0;
DataSet dsScheme = new DataSet();
XmlDocument XmlDocumentObject = new XmlDocument();
string MembershipFile = string.Empty;
//SubscriptionFileName = Server.MapPath(ConfigurationManager.AppSettings["ImageFolder"].ToString()) + "Subscription.xml";
MembershipFile = HttpContext.Current.Server.MapPath("~\\App_Data\\Files\\MembershipSheme.xml");
XmlDocumentObject.Load(MembershipFile);
XmlNodeList Nodelist = XmlDocumentObject.SelectNodes("/Membership/SignupBids/" + referralScheme);
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
string strXML = "<MembershipSheme>";
strXML = strXML + Nodelist.Item(0).InnerXml;
strXML = strXML + "</MembershipSheme>";
doc.LoadXml(strXML);
dsScheme.ReadXml(new System.IO.StringReader(doc.OuterXml));
if (dsScheme != null)
{
if (dsScheme.Tables[0].Rows.Count > 0)
{
foreach (DataRow dr in dsScheme.Tables[0].Rows)
{
decimal moneyLevelxml = Convert.ToDecimal(dr["price"]);
if (moneyLevel == moneyLevelxml)
{
freeBids = Convert.ToInt32(dr["value"]);
}
}
}
}
if (referralScheme.ToUpper() == "RESIDUAL")
{
freeBids = freeBids / 12;
}
return (freeBids);
}
No comments:
Post a Comment