Documente Academic
Documente Profesional
Documente Cultură
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using rcw.PMIContactObjects;
using rcw.pmiFormat;
using rcw.pmiMessageWrapper;
using System.Reflection;
checkIfBillingOrUsageLnkEnbl();
if(Convert.ToString(Request.ServerVariables["HTTPS"])=="off")
strIsSecureSite = "0";
else
strIsSecureSite = "1";
try
{
// Initialize Hash key so it has a value. This is important so
single users being billed get a hash key.
UCMHashKeyValidation csHashKeyValidation = new
UCMHashKeyValidation();
csHashKeyValidation.CreateHashKey(csHashKeyValidation.GENERICHash,
Convert.ToString(Session["userkey"]));
strCurrentHashKey = csHashKeyValidation.hash;
strPrevHashKey = csHashKeyValidation.hashprev;
//----------------------------Individuals Usages
Summary-------------------------------------
DisplaySubscriberUsage(strUserKey, "");
fnCalculateLiveReceptionMinutes(strUserKey, "12/31/1959 00:00:00");
//---------------------------Company Usage
--------------------------------------------------
objCompColl =
(rcw.PMIContactObjects.pmiCollection)ObjTypeUser.InvokeMember("GetAdministeredCompa
nies", BindingFlags.InvokeMethod, null, objUser, new object[] { strUserKey });
//---------------------------SP Usage
-------------------------------------------------------
objSPCollection =
(rcw.PMIContactObjects.pmiCollection)ObjTypeUser.InvokeMember("GetAdministeredSPs",
BindingFlags.InvokeMethod, null, objUser, new object[] { strUserKey });
//-------------------------------------------------------------------
-------------------------
if ((blnIsBillingOrUsageLnkEnbl) ||
((Convert.ToBoolean(Session["CoBrandFeaturesFindMeFollowMe"]) &&
Convert.ToBoolean(Session["CoBrandFeatureTUI_CallerAccess"])) ||
(Convert.ToBoolean(Session["CoBrandFeatureVoiceMessageAccess"]) &&
Convert.ToBoolean(Session["CoBrandFeatureTUI_CallerAccess"])) ||
(Convert.ToBoolean(Session["CoBrandFeatureInboundFax"]))) )
{
LoadRndExtender("divRoundedIndividual");
}
if (blnIsBillingOrUsageLnkEnbl)
{
//LoadRndExtender("divRoundedIndUsageSummary");
}
//-----------------------------------------------All COMPANY
----------------------------------------------------
int intIndexOfCompSP = 0;
strActionServerName=Request.ServerVariables["SERVER_NAME"];
foreach (string objCompany in objCompColl)
{
intIndexOfCompSP++;
strCompanyKey = objCompany.Split('~')[0];
DisplayCompanyUsage(strCompanyKey);
HtmlTableRow objTabCompHeaderRow = new HtmlTableRow();
HtmlTableCell objTabCompHeaderCell = new HtmlTableCell();
objTabCompHeaderCell.Attributes["class"] = "header_text1";
objTabCompHeaderCell.Align = "left";
objTabCompHeaderCell.InnerHtml =
"<br> Company: " + strCompanyName;
objTabCompHeaderRow.Cells.Add(objTabCompHeaderCell);
TBL_BillingUsage.Rows.Add(objTabCompHeaderRow);
HtmlTableRow objTabCompUsageRow = new HtmlTableRow();
HtmlTableCell objTabCompUsageCell = new HtmlTableCell();
Panel objPanelCompanyUsage = new Panel();
objPanelCompanyUsage.ID = "divRoundCompanyUsage" +
intIndexOfCompSP;
objPanelCompanyUsage.Style["width"] = "99%";
objPanelCompanyUsage.CssClass = "roundedPanel";
Label objlabelCompanyUsage = new Label();
objlabelCompanyUsage.Text = "<table width='100%' border='0'
cellspacing='0' cellpadding='0'>" +
"<tr>" +
"<td height='20' align='left'> <img
src='" + strBrandPath + "images/icon1.gif' width='6' alt='' height='8'/><a
href='./ASPXTOASP.ASPX?destpage=/content/CompanyLedger.asp?lstCompany=" +
strCompanyKey + "ASPX_ANDhdnAction=ChangeCompany'
onclick=\"javascript:LoadBillingUpdatePage('CompanyLedger.asp');\" target='_self'
class='link3'>View Billing History</a></td>" +
"</tr>" +
"<tr>" +
"<td height='20' align='left'> <img
src='" + strBrandPath + "images/icon1.gif' width='6' alt='' height='8'/><a
href='./ASPXTOASP.ASPX?destpage=/content/CompanyUsageSummary.asp?lstCompany=" +
strCompanyKey + "'
onclick=\"javascript:LoadBillingUpdatePage('CompanyUsageSummary.asp');\"
target='_self' class='link3'>View Current Usage </a></td>" +
"</tr>";
// ------------------------ Show link for Company Credit Card
Entry Screen-----------------------------
blnCompanyBilling=IsCompanyBillingInfoUpdatable(strCompanyKey);
csHashKeyValidation = new UCMHashKeyValidation();
csHashKeyValidation.CreateHashKey(csHashKeyValidation.GENERICHash,
Convert.ToString(Session["userkey"]));
strCurrentHashKey = csHashKeyValidation.hash;
strPrevHashKey = csHashKeyValidation.hashprev;
if (blnCompanyBilling)
{
strActionFilePath=Request.ServerVariables["PATH_INFO"];
intTemp = strActionFilePath.LastIndexOf("/");
if (intTemp < 2)
{
//No path in the URL.
strActionFilePath = "";
}
else
{
//Strip file name from URL path.
strActionFilePath = strActionFilePath.Substring(0,
intTemp);// left(strActionFilePath, intTemp);
}
//-----------------------------------------------All
SP----------------------------------------------------
intIndexOfCompSP = 0;
foreach (string strSPItem in objSPCollection)
{
intIndexOfCompSP++;
SPNum = Convert.ToInt32(strSPItem.Split('~')[0]);
DisplaySPUsage(SPNum);
HtmlTableRow objTabSPHeaderRow = new HtmlTableRow();
HtmlTableCell objTabSPHeaderCell = new HtmlTableCell();
objTabSPHeaderCell.Attributes["class"] = "header_text1";
objTabSPHeaderCell.Align = "left";
objTabSPHeaderCell.InnerHtml = "<br> SP: "
+ strSPItem.Substring((strSPItem.IndexOf("~") + 1));
objTabSPHeaderRow.Cells.Add(objTabSPHeaderCell);
TBL_BillingUsage.Rows.Add(objTabSPHeaderRow);
HtmlTableRow objTabSPUsageRow = new HtmlTableRow();
HtmlTableCell objTabSPUsageCell = new HtmlTableCell();
Panel objPanelSPUsage = new Panel();
objPanelSPUsage.ID = "divRoundSPUsage" + intIndexOfCompSP;
objPanelSPUsage.Style["width"] = "99%";
objPanelSPUsage.CssClass = "roundedPanel";
Label objlabelSPUsage = new Label();
objlabelSPUsage.Text = "<table width='100%' cellspacing='0'
cellpadding='0'>" +
"<tr>" +
"<td height='20' align='left'> <img
src='" + strBrandPath + "images/icon1.gif' width='6' alt='' height='8'/><a
href='./ASPXTOASP.ASPX?destpage=/content/SPLedger.asp?lstSP=" + SPNum +
"ASPX_ANDhdnAction=ChangeSP'
onclick=\"javascript:LoadBillingUpdatePage('SPLedger.asp');\" target='_self'
class='link3'>View Billing History</a></td>" +
"</tr>" +
"<tr>" +
"<td height='20' align='left'> <img
src='" + strBrandPath + "images/icon1.gif' width='6' alt='' height='8'/><a
href='./ASPXTOASP.ASPX?destpage=/content/SPUsageSummary.asp?lstSP=" + SPNum + "'
onclick=\"javascript:LoadBillingUpdatePage('SPUsageSummary.asp');\"
class='link3'>View Current Usage</a></td>" +
"</tr>" +
"</table>";
objPanelSPUsage.Controls.Add(objlabelSPUsage);
objTabSPUsageCell.Controls.Add(objPanelSPUsage);
objTabSPUsageRow.Controls.Add(objTabSPUsageCell);
TBL_BillingUsage.Rows.Add(objTabSPUsageRow);
LoadRndExtender("divRoundSPUsage" + intIndexOfCompSP);
//=============================================================
}
MakeDivRounded();
}
catch(Exception ex)
{
Response.Write("Unexpected error...");
Response.End();
}
}
"setAjaxRoundedCornerBorderColorForDiv(controlBehaver,'.roundedPanel')}}";
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "RefreshMap",
strJsScript, true);
}
if (!(objSPInfo.SummaryBilling))
{
blnIsBillingOrUsageLnkEnbl = true;
}
}
}
}
//-------------------------------------------------------------------------
----------------
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(objServiceProvider);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ObjFormat);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objSPOverage);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objUsagefunctions);
}
//====================FreeMinutes==================================================
=====================
intUserRatePlanID = objUser.RatePlanID;
if (intUserRatePlanID > 0)
{
objTypeRatePlan.InvokeMember("GetRatePlan", BindingFlags.InvokeMethod,
null, objRatePlan, new object[] { intUserRatePlanID });
lblFreeMinPkg.Text = Convert.ToString(objRatePlan.FreeCallminutes);
}
//====================Forward & Outgoing Calls -
International===================================================
lblFrdOutCall.Text =
fnCalculateBillingMinutes("GetInternationalCallDetails", UserKey, sBillingDate);
//====================CallMe Notification Calls -
International==================================================
lblCallMeNotifiCall.Text =
fnCalculateBillingMinutes("GetInternationalCallMeCallDetails", UserKey,
sBillingDate);
//==================== Click to call International Minute
=======================================================
double dblC2CInternMin=0;
objpmiCollection =
(rcw.PMIContactObjects.pmiCollection)objTypeBillingUsage.InvokeMember("GetInternati
onalC2CDetails", BindingFlags.InvokeMethod, null, objBillingUsage, new object[]
{UserKey, sBillingDate});
foreach (pmiCallDetails objC2CDetails in objpmiCollection)
{
if (objCommon.fnIsDate(Convert.ToString(objC2CDetails.StartTime)) &&
objCommon.fnIsDate(Convert.ToString(objC2CDetails.EndTime)))
{
dblC2CInternMin = dblC2CInternMin +
(double)Math.Ceiling(DateTimeUtil.DateDiff("s",
Convert.ToDateTime(objC2CDetails.StartTime),
Convert.ToDateTime(objC2CDetails.EndTime))/60.0);
}
}
lblC2CIntCallMin.Text = Convert.ToString(dblC2CInternMin);
//====================Outgoing International Faxes(pages)============
lngUsageMinutes = 0;
objpmiCollection =
(rcw.PMIContactObjects.pmiCollection)objTypeBillingUsage.InvokeMember("GetInternati
onalFaxDetails", BindingFlags.InvokeMethod, null, objBillingUsage, new object[]
{ UserKey, sBillingDate });
foreach (pmiFaxDetails objpmiFaxDetails in objpmiCollection)
{
if (objpmiFaxDetails.FaxStatusCode == 6)
{
lngUsageMinutes = lngUsageMinutes +
Convert.ToInt64(objpmiFaxDetails.FaxPages);
}
}
lblinternationalFax.Text = Convert.ToString(lngUsageMinutes);
//=======================================================
if (CompanyKey != "")
{
Response.Write("<br />No Company Usage...<br />");
rcw.PMIContactObjects.pmiCompanyOverage objOverageSummary = new
pmiCompanyOverage();
Type objTypeCompanyOverage =
typeof(rcw.PMIContactObjects.pmiCompanyOverage);
objTypeCompanyOverage.InvokeMember("GetCompanyUsageSummary",
BindingFlags.InvokeMethod, null, objOverageSummary, new object[] { CompanyKey,
sBillingDate });
sStartDate = objOverageSummary.BillStartDate;
sEndDate = objOverageSummary.BillEndDate.AddDays(-1);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objOverageSummary);
}
else
{ //if end date ends up prior to now then we need to add a month to
EndDate and StartDate
sEndDate =
Convert.ToDateTime(objUser.DateAdded).AddMonths(Convert.ToInt32(DateTimeUtil.DateDi
ff("m", Convert.ToDateTime(objUser.DateAdded), DateTime.Now)));
sEndDate = sEndDate.AddDays(-1);
sEndDate = Convert.ToDateTime(objTypeFormat.InvokeMember("pmiFormat",
BindingFlags.InvokeMethod, null, ObjFormat, new object[] { sEndDate,
"mm/dd/yyyy" }));
sEndDate = sEndDate.AddHours(23).AddMinutes(59).AddSeconds(59);
if (DateTimeUtil.DateDiff("d", DateTime.Now, sEndDate) >= 0)
{
sStartDate =
Convert.ToDateTime(objUser.DateAdded).AddMonths(Convert.ToInt32(DateTimeUtil.DateDi
ff("m", Convert.ToDateTime(objUser.DateAdded), DateTime.Now)) - 1);
sEndDate =
Convert.ToDateTime(objUser.DateAdded).AddMonths(Convert.ToInt32(DateTimeUtil.DateDi
ff("m", Convert.ToDateTime(objUser.DateAdded), DateTime.Now)));
}
else
{
sEndDate =
Convert.ToDateTime(objUser.DateAdded).AddMonths(Convert.ToInt32(DateTimeUtil.DateDi
ff("m", Convert.ToDateTime(objUser.DateAdded), DateTime.Now)) + 1);
sStartDate =
Convert.ToDateTime(objUser.DateAdded).AddMonths(Convert.ToInt32(DateTimeUtil.DateDi
ff("m", Convert.ToDateTime(objUser.DateAdded), DateTime.Now)));
}
}
lblStartDt.Text = Convert.ToString(objTypeFormat.InvokeMember("pmiFormat",
BindingFlags.InvokeMethod, null, ObjFormat, new object[] { sStartDate, "MMMM DD
YYYY" }));
if (CompanyKey == "")
{
lblEndDt.Text =
Convert.ToString(objTypeFormat.InvokeMember("pmiFormat", BindingFlags.InvokeMethod,
null, ObjFormat, new object[] { sEndDate.AddDays(-1), "MMMM DD YYYY" }));
}
else
{
lblEndDt.Text =
Convert.ToString(objTypeFormat.InvokeMember("pmiFormat", BindingFlags.InvokeMethod,
null, ObjFormat, new object[] {sEndDate, "MMMM DD YYYY" }));
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(objpmiOutboundCallColl);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objpmiCollection);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objUser);
System.Runtime.InteropServices.Marshal.ReleaseComObject(ObjFormat);
System.Runtime.InteropServices.Marshal.ReleaseComObject(objRatePlan);
}
objpmiOutboundCallColl =
(pmiOutboundCallColl)objTypeBillingUsage.InvokeMember(pMethodName,
BindingFlags.InvokeMethod, null, objBillingUsage, new object[] { pUserKey,
pBillingDate });
foreach (pmiOutboundCall objpmiOutboundCall in objpmiOutboundCallColl)
{
if
(objCommon.fnIsDate(Convert.ToString(objpmiOutboundCall.OutboundCallStart)) &&
objCommon.fnIsDate(Convert.ToString(objpmiOutboundCall.OutboundCallEnd)))
{
lngMinutes = lngMinutes +
Convert.ToInt64(Math.Ceiling(DateTimeUtil.DateDiff("s",
objpmiOutboundCall.OutboundCallStart, objpmiOutboundCall.OutboundCallEnd) / 60.0));
}
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(objpmiOutboundCallColl);
return Convert.ToString(lngMinutes);
}
if (objRatePlan.LiveReceptionistFreeMinutes > 0)
{
strLvRecIncludePkg = "<tr><td class='bodytext_5' align='left'><table
border='0' width='100%'><tr><td style='width:60%;'>Live Receptionist Minutes
included in Package: </td><td><label ID='lblLiveReception'>" +
objRatePlan.LiveReceptionistFreeMinutes + "</Label></td></tr></table>" +
"</td></tr>";
if (objRatePlan.LiveReceptionistRate>0)
{
if (objLiveReceptionCollection.Count==0)
{
strLvRecNotIncludePkg = "<tr><td class='bodytext_5'
align='left'><table border='0' width='100%'><tr><td style='width:60%;'>Live
Receptionist Calls (minutes):</td><td><label
ID='lblLiveReception'>0</Label></td></tr></table></td></tr>";
}
else if(objLiveReceptionCollection.Count>0)
{
foreach(pmiLiveReceptCall objLvRecCall in
objLiveReceptionCollection)
{
if
(objCommon.fnIsDate(Convert.ToString(objLvRecCall.Time_Presented)) &&
objCommon.fnIsDate(Convert.ToString(objLvRecCall.Time_Completed)))
{
dblLiveRec = dblLiveRec +
(double)Math.Ceiling(DateTimeUtil.DateDiff("s",
Convert.ToDateTime(objLvRecCall.Time_Presented),
Convert.ToDateTime(objLvRecCall.Time_Completed)) / 60.0);
}
}
strLvRecNotIncludePkg = "<tr><td class='bodytext_5'
align='left'><table border='0' width='100%'><tr><td style='width:60%;'>Live
Receptionist Calls (minutes):</td><td><label ID='lblLiveReception'>" + dblLiveRec +
"</Label></td></tr></table></td></tr>";
}
}
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(objRatePlan);
}
//GLOBAL