using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Admin_DashBoard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["AdminEMAILID"] == null)
            {
                Response.Redirect("AdminLogin.aspx");
            }
            else
            {
                TotalAmount();
                
                //lbl_eGenApiBal.Text = "NA";
                //lbl_IWTApiBal.Text = "NA";//CommonFunction.ChackBalanceIWTAPI();
                ////lbl_IWTApiBal.Text = obj_hermes.getApibalance();
                
                //lbl_ApiWorld.Text = CommonFunction.CheckBalApiWorld();
                //lbl_TotalAmountinAPI.Text = Convert.ToString(Convert.ToDouble(0) + Convert.ToDouble(IWT) + Convert.ToDouble(Excel) + Convert.ToDouble(lbl_ApiWorld.Text));
                //lbl_reserveposition.Text = Convert.ToString(Convert.ToDouble(lbl_TotalAmountinAPI.Text) - Convert.ToDouble(lbl_WL.Text));
            }
        }
        catch (Exception ex)
        {
            throw (ex);
        }  
    }
    public void TotalAmount()
    {
        try
        {           
            DataSet ds = SqlHelper.GetDataSet(SqlHelper.mainConnectionString, CommandType.StoredProcedure, "usp_GetTotalAmountInApplication");
            if (ds.Tables[0].Rows.Count > 0)
            {
                lbl_TotalAmountUser.Text = ds.Tables[0].Rows[0]["NetAmount"].ToString();
                Session["TotalAmount"] = lbl_TotalAmountUser.Text;
           
                lbl_AgentAmount.Text = ds.Tables[1].Rows[0]["NetAmountAG"].ToString();
            
                lbl_DistributorAmount.Text = ds.Tables[2].Rows[0]["NetAmountDS"].ToString();
            
                lbl_MDS.Text = ds.Tables[3].Rows[0]["NetAmountMDS"].ToString();

                lbl_WL.Text = ds.Tables[4].Rows[0]["NetAmountWL"].ToString();
            }
        }
        catch (Exception ex)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OhCrap", String.Format("alert('There is some technical problem.Please try again');"), true);
            throw (ex);
        }
    }
}
