Hi Experts
i am using below code to download files from Documtum by C# application and getting the below error log .
"Service method "Get" invocation failed. IMM202 MY Visa-->View Docs DMS Connection Failed"
Please suggest what i can change as there is no error log reported we have done all the possible modification but the issue is same .
It seems that " FileInfo expFile = contentObj.GetAsFile();" is not working properly
#region Namespace
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FRX_Utility.FRX;
using System.Data;
using FRX_Controller.FRX;
using System.Web.UI.HtmlControls;
using AjaxControlToolkit;
using System.IO;
using System.Configuration;
using DMS_DMSData;
using DMS_LogEntry;
using Emc.Documentum.FS.DataModel.Core;
using Emc.Documentum.FS.DataModel.Core.Query;
using Emc.Documentum.FS.DataModel.Core.Properties;
using Emc.Documentum.FS.Runtime.Context;
using Emc.Documentum.FS.DataModel.Core.Context;
using Emc.Documentum.FS.DataModel.Core.Content;
using System.Text;
#endregion Namespace
#region History
/*
* ---------------------------------------------------------------------------------------------------
* MODIFICATION HISTORY:
* --------------------------------------------------------------------------------------------
* PHASE AUTHOR DATE(MM/DD/YYYY) MODIFICATION DETAILS DESCRIPTION
* --------------------------------------------------------------------------------------------
1 Shivani 12-06-2014 CREATED
*----------------------------------------------------------------------------------------------------
*/
#endregion
public partial class ASPX_FrmCompleteDisbursement : System.Web.UI.Page
{
#region Shared Variables
private string strInput;
string strPageName = "FrmCompleteDisbursement.aspx";
string strPath = "Complete Disbursement";
int intErrorType;
string strEvent = "";
string strRefNo = "";
string strProjType = string.Empty;
private string strSearchCriteria = string.Empty;
private string strSearchMode = string.Empty;
private string strSearchAt = string.Empty;
string projCode = string.Empty;
string EngID = string.Empty;
string strEmpID = string.Empty;
CommonUtility objCommUtility = null;
private DataSet dsData;
Boolean strLoggedInISForexAdmin = true;
//DMS Variables
string _DMSObjID = string.Empty;
private DMSData DMSDataObj;
private DataObject dobject = null;
private string strRepositoryName = string.Empty;
private string strUserName = string.Empty;
private string strPassword = string.Empty;
#endregion Shared Variables
static FileStream fs1 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + String.Format("ErrorLog/ErrorLog_{0}.txt", DateTime.Today.ToString("yyyy-MM-dd")), FileMode.OpenOrCreate, FileAccess.ReadWrite);
#region Page_Load
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
strLoggedInISForexAdmin = ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInISForexAdmin;
if (!IsPostBack)
{
intErrorType = 3;
strEvent = "Page Load";
strRefNo = "FRX330";
if (Request.QueryString["Loa_No"] != null && Request.QueryString["Request_Id"] != null && Request.QueryString["Status_Id"] != null)
{
ViewState["Loa_No"] = Convert.ToInt64(Request.QueryString["Loa_No"].ToString());
ViewState["Request_Id"] = Convert.ToInt64(Request.QueryString["Request_Id"].ToString());
Session["Comments_Request_Id"] = Convert.ToInt32(Request.QueryString["Request_Id"].ToString());
ViewState["Status_Id"] = Convert.ToInt32(Request.QueryString["Status_Id"].ToString());
}
if (strLoggedInISForexAdmin)
{
hypAttachment.NavigateUrl = "javascript:popupWin('FrmAttachments.aspx?Request_ID=" + ViewState["Request_Id"].ToString() + "','600','400');";
}
else
{
hypAttachment.Visible = false;
}
Int64 LOA = Convert.ToInt64(ViewState["Loa_No"].ToString());
ctrlAimsDetails.LOA_Number = LOA.ToString();
ctrlAimsDetails.Forex_RequestId = ViewState["Request_Id"].ToString();
LoadPagedata();
LoadCurrency();
LoadFrxTeamdetails();
int StatusId = Convert.ToInt32(ViewState["Status_Id"].ToString());
Int64 Forex_requestId = Convert.ToInt64(ViewState["Request_Id"].ToString());
ViewState["DocsToUpload"] = "0";
string Paymentoption = hdnPaymentId.Value;
decimal Cash = Convert.ToDecimal(lblCashAmt.Text);
if (Paymentoption == "2" && Cash == Convert.ToDecimal(0))
{
//lblVendoreInvioce.Visible = false;
lblmandatoryRole.Visible = false;
//lblColon19.Visible = false;
txtvendorInvoice.Enabled = false;
rfvVendorinvoiveNo.Enabled = false;
}
else
{
// lblVendoreInvioce.Visible = true;
lblmandatoryRole.Visible = true;
//lblColon19.Visible = true;
txtvendorInvoice.Enabled = true;
rfvVendorinvoiveNo.Enabled = true;
}
if (StatusId == 4 || StatusId == 6)
{
lblHeaderPage.Text = hdnVerifyHeader.Value;
}
else
{
lblHeaderPage.Text = hdnAcknowledgeHeader.Value;
}
if (StatusId == 7)
{
BtnAcknowledge.Visible = true;
btnDisbursementComplete.Visible = false;
txtAmountPaid.Enabled = false;
txtExchangerate.Enabled = false;
txtvendorInvoice.Enabled = false;
ddlCurrency.Enabled = false;
ReloadController oController = new ReloadController();
DataSet dsData = oController.GetVerificationData(Convert.ToInt64(ViewState["Request_Id"]));
if (dsData.Tables.Count > 0)
{
if (dsData.Tables[0].Rows.Count > 0)
{
txtAmountPaid.Text = dsData.Tables[0].Rows[0]["Amount_Paid"].ToString();
txtvendorInvoice.Text = dsData.Tables[0].Rows[0]["Vendor_InvoiceNo"].ToString();
txtExchangerate.Text = dsData.Tables[0].Rows[0]["Exchange_Rate"].ToString();
lblINRAmount.Text = ((double.Parse(txtAmountPaid.Text)) * (double.Parse(txtExchangerate.Text))).ToString();
ddlCurrency.SelectedValue = dsData.Tables[0].Rows[0]["Currency_Id"].ToString();
}
}
}
else if (StatusId == 5)
{
ReloadController oController = new ReloadController();
DataSet dsData = oController.GetVerificationData(Convert.ToInt64(ViewState["Request_Id"]));
if (dsData.Tables.Count > 0)
{
if (dsData.Tables[0].Rows.Count > 0)
{
txtAmountPaid.Text = dsData.Tables[0].Rows[0]["Amount_Paid"].ToString();
txtvendorInvoice.Text = dsData.Tables[0].Rows[0]["Vendor_InvoiceNo"].ToString();
txtExchangerate.Text = dsData.Tables[0].Rows[0]["Exchange_Rate"].ToString();
lblINRAmount.Text = ((double.Parse(txtAmountPaid.Text)) * (double.Parse(txtExchangerate.Text))).ToString();
ddlCurrency.SelectedValue = dsData.Tables[0].Rows[0]["Currency_Id"].ToString();
}
}
btnDisbursementComplete.Visible = false;
BtnAcknowledge.Visible = false;
txtComments.Enabled = false;
txtAmountPaid.Enabled = false;
txtExchangerate.Enabled = false;
txtvendorInvoice.Enabled = false;
ddlCurrency.Enabled = false;
}
else
{
BtnAcknowledge.Visible = false;
btnDisbursementComplete.Visible = true;
}
ReloadController objController = new ReloadController();
DataSet dsGridDocData = objController.GetGridData(Convert.ToString(ViewState["Request_Id"]));
if (dsGridDocData != null && dsGridDocData.Tables.Count > 0)
{
if (dsGridDocData.Tables[0].Rows.Count > 0)
{
gdvDocuments.DataSource = dsGridDocData;
gdvDocuments.DataBind();
gdvDocuments = null;
objController = null;
}
}
}
else
{
//Response.Redirect("FrmSessionTimeOut.aspx", false);
}
}
else
{
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('INFO: Session time out. Please re-login.');window.parent.navigate('http://talent.capgemini.com/in/', '_self');", true);
Session.Abandon();
}
}
catch (Exception excp)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
# region LoadPagedata
protected void LoadPagedata()
{
try
{
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
intErrorType = 4;
strEvent = "Load Pagedata";
strRefNo = "FRX331";
Int64 LOA = Convert.ToInt64(ViewState["Loa_No"].ToString());
Int64 Forex_requestId = Convert.ToInt64(ViewState["Request_Id"].ToString());
CommonController objController = new CommonController();
DataSet dsPageData = null;
dsPageData = objController.GetForexRequestData(LOA, Forex_requestId);
if (dsPageData.Tables.Count > 0)
{
if (dsPageData.Tables[0].Rows.Count > 0)
{
hdnPaymentId.Value = dsPageData.Tables[0].Rows[0]["Payment_Option_ID"].ToString();
if (hdnPaymentId.Value == "2")
{
trBank.Visible = true;
trBank1.Visible = true;
trBank2.Visible = true;
}
ctrlAimsDetails.LOA_Number = LOA.ToString();
ctrlAimsDetails.Forex_RequestId = ViewState["Request_Id"].ToString();
lblLocationName.Text = dsPageData.Tables[0].Rows[0]["Location_Name"].ToString();
lblUnitDetailLocation.Text = dsPageData.Tables[0].Rows[0]["Sub_Location_Name"].ToString();
lblFlight_No.Text = dsPageData.Tables[0].Rows[0]["Ticket_Flight_No"].ToString();
lblMobileNumber.Text = dsPageData.Tables[0].Rows[0]["Mobile_Number"].ToString();
lblPaymentoption.Text = dsPageData.Tables[0].Rows[0]["Code_Description"].ToString();
lblBankName.Text = dsPageData.Tables[0].Rows[0]["Bank_Name"].ToString();
lblBankAddress.Text = dsPageData.Tables[0].Rows[0]["Bank_Address"].ToString();
lblBICCode.Text = dsPageData.Tables[0].Rows[0]["BIC_Code"].ToString();
lblIBAN.Text = dsPageData.Tables[0].Rows[0]["IBAN_No"].ToString();
lblAccountNumber.Text = dsPageData.Tables[0].Rows[0]["Account_Number"].ToString();
lblCheckbox.Text = dsPageData.Tables[0].Rows[0]["Cash_Needed"].ToString();
}
}
dsPageData = null;
}
else
{
//Response.Redirect("FrmSessionTimeOut.aspx", false);
}
}
catch (Exception excp)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
# region LoadFrxTeamdetails
protected void LoadFrxTeamdetails()
{
try
{
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
intErrorType = 4;
strEvent = "Load FrxTeamdetails";
strRefNo = "FRX332";
Int64 LOA = Convert.ToInt64(ViewState["Loa_No"].ToString());
Int64 Forex_requestId = Convert.ToInt64(ViewState["Request_Id"].ToString());
ReloadController oController = new ReloadController();
DataSet dsData = oController.GetVerificationData(Convert.ToInt64(ViewState["Request_Id"]));
if (dsData != null && dsData.Tables.Count > 0)
{
if (dsData.Tables[0].Rows.Count > 0)
{
lblstat.Text = dsData.Tables[1].Rows[0]["Status"].ToString();
lblPaymentdate.Text = dsData.Tables[0].Rows[0]["Payment_Till_Date"].ToString();
lblNoOfDays.Text = dsData.Tables[0].Rows[0]["No_Of_Days"].ToString();
lblTotalAmt.Text = dsData.Tables[0].Rows[0]["Total_Amount"].ToString();
lblCashAmt.Text = dsData.Tables[0].Rows[0]["Cash_Amount"].ToString();
hdntotalamt.Value = dsData.Tables[0].Rows[0]["TotalAmt"].ToString();
Decimal dTotalAmt = Convert.ToDecimal(hdntotalamt.Value);
Decimal dCashAmt = Convert.ToDecimal(lblCashAmt.Text);
lblBalanceAmt.Text = Decimal.Round((dTotalAmt - dCashAmt), 2).ToString();
txtvendorInvoice.Text = dsData.Tables[0].Rows[0]["Vendor_InvoiceNo"].ToString();
txtAmountPaid.Text = dsData.Tables[0].Rows[0]["Amount_Paid"].ToString();
if (dsData.Tables[0].Rows[0]["Currency_Id"].ToString() != "")
{
ddlCurrency.SelectedIndex = ddlCurrency.Items.IndexOf(ddlCurrency.Items.FindByValue(dsData.Tables[0].Rows[0]["Currency_Id"].ToString()));
}
txtExchangerate.Text = dsData.Tables[0].Rows[0]["Exchange_Rate"].ToString();
if (txtAmountPaid.Text != "" && txtExchangerate.Text != "")
{
Decimal dAmountPaid = Convert.ToDecimal(txtAmountPaid.Text);
Decimal dExchangeRate = Convert.ToDecimal(txtExchangerate.Text);
lblINRAmount.Text = Decimal.Round((dAmountPaid * dExchangeRate), 2).ToString();
}
}
if (dsData.Tables[1].Rows.Count > 0)
{
lblstat.Text = dsData.Tables[1].Rows[0]["Status"].ToString();
}
}
dsData = null;
oController = null;
}
else
{
//Response.Redirect("FrmSessionTimeOut.aspx", false);
}
}
catch (Exception excp)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
# region LoadCurrency
protected void LoadCurrency()
{
try
{
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
intErrorType = 4;
strEvent = "Load Currency";
strRefNo = "FRX333";
dsData = new DataSet();
objCommUtility = new CommonUtility();
CommonController CommonController = new CommonController();
dsData = CommonController.populateDDL(",12,", "FRX");
if (dsData.Tables.Count > 0)
{
objCommUtility.FillDropdown(ddlCurrency, dsData.Tables[0], false);
}
dsData = null;
}
else
{
//Response.Redirect("FrmSessionTimeOut.aspx", false);
}
}
catch (Exception excp)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
#region Page Init
protected void Page_Init(object sender, EventArgs e)
{
string javaScriptPath = System.Configuration.ConfigurationManager.AppSettings["JavaScript_Path"].ToString();
string cssClanerPath = System.Configuration.ConfigurationManager.AppSettings["CCS_Path"].ToString();
string cssCalendarPath = System.Configuration.ConfigurationManager.AppSettings["CSS_Calendar"].ToString();
HtmlGenericControl html = new HtmlGenericControl();
html.TagName = "script";
html.Attributes.Add("type", "text/javascript");
html.Attributes.Add("language", "javascript");
html.Attributes.Add("src", ResolveClientUrl(javaScriptPath));
Page.Header.Controls.Add(html);
//HtmlGenericControl JSClander = new HtmlGenericControl();
//JSClander.TagName = "link";
//JSClander.Attributes.Add("type", "text/javascript");
//JSClander.Attributes.Add("rel", "stylesheet");
//JSClander.Attributes.Add("href", ResolveClientUrl(javaScriptPath));
//Page.Header.Controls.Add(JSClander);
HtmlGenericControl cssClander = new HtmlGenericControl();
cssClander.TagName = "link";
cssClander.Attributes.Add("type", "text/css");
cssClander.Attributes.Add("rel", "stylesheet");
cssClander.Attributes.Add("href", ResolveClientUrl(cssClanerPath));
Page.Header.Controls.Add(cssClander);
HtmlGenericControl cssCalendar = new HtmlGenericControl();
cssCalendar.TagName = "link";
cssCalendar.Attributes.Add("type", "text/css");
cssCalendar.Attributes.Add("rel", "stylesheet");
cssCalendar.Attributes.Add("href", ResolveClientUrl(cssCalendarPath));
Page.Header.Controls.Add(cssCalendar);
}
#endregion
# region btnDisbursementComplete_Click
protected void btnDisbursementComplete_Click(object sender, EventArgs e)
{
try
{
intErrorType = 6;
strEvent = "Complete Button";
strRefNo = "FRX334";
Int64 RequestId = Convert.ToInt64(ViewState["Request_Id"].ToString());
string Comments = txtComments.Text;
strEmpID = ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID;
Decimal ExchangeRate = Convert.ToDecimal(txtExchangerate.Text);
Int32 currency = Convert.ToInt32(ddlCurrency.SelectedValue);
Decimal Amount_Paid = Convert.ToDecimal(txtAmountPaid.Text);
string Vendor_VoiceNo = txtvendorInvoice.Text;
DisbursementController objController = new DisbursementController();
CommonUtility objCommon = new CommonUtility();
Int32 Error_Flag = objController.CompleteDisbursement(RequestId, Comments, strEmpID, Vendor_VoiceNo, ExchangeRate, currency, Amount_Paid);
if (Error_Flag == 0)
{
CommonController commController = new CommonController();
string PaymentId = hdnPaymentId.Value;
Decimal dCashAmt = Convert.ToDecimal(lblCashAmt.Text);
if (PaymentId == "2" && dCashAmt == Convert.ToDecimal(0))
{
commController.SendMail(43, RequestId);
}
else
{
commController.SendMail(6, RequestId);
}
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Info: Disbursement request verified successfully');", true);
Page.RegisterStartupScript("RefreshParent", "<script>parent.frames[0].location.href = 'FrmDisbursementSummary.aspx';</script>");
}
}
catch (Exception ex)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
#region Cancel
protected void Btncancel_Click(object sender, EventArgs e)
{
try
{
intErrorType = 7705;
strEvent = "Cancel Button";
strRefNo = "FRX335";
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
Response.Redirect("FrmDisbursementSummary.aspx");
}
}
catch (Exception ex)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
#region BtnAcknowledge_Click
protected void BtnAcknowledge_Click(object sender, EventArgs e)
{
try
{
intErrorType = 6;
strEvent = "Acknowledge Button";
strRefNo = "FRX336";
Int64 RequestId = Convert.ToInt64(ViewState["Request_Id"].ToString());
string Comments = txtComments.Text;
strEmpID = ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID;
Decimal ExchangeRate = Convert.ToDecimal(txtExchangerate.Text);
string Vendor_VoiceNo = txtvendorInvoice.Text;
Int32 currency = Convert.ToInt32(ddlCurrency.SelectedValue);
Decimal Amount_Paid = Convert.ToDecimal(txtAmountPaid.Text);
DisbursementController objController = new DisbursementController();
CommonUtility objCommon = new CommonUtility();
Int32 Error_Flag = objController.CompleteDisbursement(RequestId, Comments, strEmpID, Vendor_VoiceNo, ExchangeRate, currency, Amount_Paid);
if (Error_Flag == 0)
{
CommonController commController = new CommonController();
commController.SendMail(7, RequestId);
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Info: Disbursement request completed successfully.');", true);
Page.RegisterStartupScript("RefreshParent", "<script>parent.frames[0].location.href = 'FrmDisbursementSummary.aspx';</script>");
}
}
catch (Exception ex)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
#region DownloadFile
public void DownloadFile(string fileName, string docMode)
{
try
{
string[] arrDocMode = docMode.Split('#');
System.IO.FileInfo file = null;
if (arrDocMode[1] == "2")
{
if (arrDocMode[0].ToLower() == "frx")
{
fileName = ConfigurationManager.AppSettings["FRX_Emp_Doc_Folder_Loc"].Trim().ToString() + fileName;
file = new System.IO.FileInfo(Server.MapPath(fileName));
}
else
{
file = new System.IO.FileInfo(fileName);
}
if (File.Exists(file.FullName))
{
Response.Clear();
Response.ContentType = @application\octet-stream;
Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.Flush();
}
else
{
//ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), Guid.NewGuid().ToString(), @showAlert(' + Resources.RNR.errorTitleFileNotFound + "','" + Resources.RNR.errorMessageFileNotFound + "','info');", true);
string script = "<script type=\"text/javascript\">alert('Error : File not found.');</script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "Alert", script);
}
}
else if (arrDocMode[1] == "1")
{
// Jitu
LogMessage("Visa FILE " + Convert.ToString(fileName), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
OpenFileDMS(fileName);
}
}
catch (Exception excp)
{
// throw excp;
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, strEmpID);
objCommUtility = null;
}
}
#endregion
#region gdvDocuments_RowDataBound
protected void gdvDocuments_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (Session["FRX_LOGGEDIN_EMPLOYEE_INFO"] != null)
{
intErrorType = 4;
strEvent = "gdvDocuments_RowDataBound";
strRefNo = "FRX316";
int iDocCount = 0;
iDocCount = Convert.ToInt32(ViewState["DocsToUpload"].ToString());
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField hdnIs_editable = e.Row.FindControl("hdnIs_editable") as HiddenField;
ImageButton ImageBrowse = e.Row.FindControl("ImageBrowse") as ImageButton;
if (hdnIs_editable.Value == "1")
{
if (ImageBrowse.CommandArgument.ToLower() == "n.a.doc")
{
iDocCount = iDocCount + 1;
}
}
}
ViewState["DocsToUpload"] = iDocCount;
}
else
{
//Response.Redirect("FrmSessionTimeOut.aspx", false);
}
}
catch (Exception excp)
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
objCommUtility = null;
}
}
#endregion
#region OpenFileDMS
private void OpenFileDMS(string strFileName)
{
Boolean boolConnection = false;
try
{
strRepositoryName = ConfigurationManager.AppSettings["QMS_RepositoryName"];
strUserName = ConfigurationManager.AppSettings["QMS_UserName"];
strPassword = ConfigurationManager.AppSettings["QMS_Password"];
DMSDataObj = new DMSData(strRepositoryName, strUserName, strPassword);
// Jitu
LogMessage("RepositoryName " + Convert.ToString(strRepositoryName) + "UserName " + Convert.ToString(strUserName) + "Password " + Convert.ToString(strPassword), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
}
catch (Exception ex)
{
//throw ex;
intErrorType = 21;
strEvent = "DMS Connection";
strRefNo = "FRX201";
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, strEmpID);
objCommUtility = null;
boolConnection = true;
}
if (boolConnection == false)
{
try
{
GetDMSFile(strFileName);
}
catch (Exception ex)
{
//throw ex;
intErrorType = 21;
strEvent = "DMS Connection Failed";
strRefNo = "FRX202";
if (ex.Message == "Service method \"Get\" invocation failed." && ex.Message != "")
{
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, strEmpID);
objCommUtility = null;
Page.RegisterStartupScript("View", "<script language=javascript> alert('INFO: File not found.');</script>");
}
}
}
}
#endregion
#region GetDMSFile
private void GetDMSFile(string strDMSObjectID)
{
strEvent = "GetDMSFile";
//try
//{
//JITU
LogMessage("Visa Object ID " + Convert.ToString(strDMSObjectID), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
dobject = DMSDataObj.getWithContent(strDMSObjectID, strRepositoryName);
LogMessage("Content Name " + Convert.ToString(dobject.Properties.Properties[0].ToString()) + Convert.ToString(dobject.Properties.Properties[1].ToString()), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
Emc.Documentum.FS.DataModel.Core.Content.Content contentObj = (Emc.Documentum.FS.DataModel.Core.Content.Content)dobject.Contents[0];
LogMessage("Content Format " + Convert.ToString(contentObj.Format), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
LogMessage("Content object Created ", ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
PropertySet prset = dobject.Properties; //added-
LogMessage("Proprerty " + Convert.ToString(prset.Properties[0].ToString()) + Convert.ToString(prset.Properties[1].ToString()) + " Emp code " + Convert.ToString(prset.Properties[42].ToString()), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
String strFileNamenew = prset.Get("object_name").GetValueAsString(); //added
LogMessage("string Name " + Convert.ToString(strFileNamenew), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
FileInfo expFile = contentObj.GetAsFile();
LogMessage("FileNamenew " + Convert.ToString(strFileNamenew) + "expFile " + Convert.ToString(expFile), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
string strfileName = expFile.Name;
string strfilePath = expFile.FullName;
string strExtension = expFile.Extension;
LogMessage("fileName " + Convert.ToString(strfileName) + "filePath " + Convert.ToString(strfilePath) + "Extension " + Convert.ToString(strExtension), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.BufferOutput = true;
Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileNamenew);
Response.AddHeader("Content-Length", Convert.ToString(expFile.Length));
Response.ContentType = "application/x-download";
FileStream fs = new FileStream(strfilePath, FileMode.Open, FileAccess.Read);
LogMessage("File open successfully ", ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
long FileSize;
FileSize = fs.Length;
byte[] getContent = new byte[(int)FileSize];
fs.Read(getContent, 0, (int)fs.Length);
fs.Close();
Response.BinaryWrite(getContent);
Response.Flush();
Response.Close();
LogMessage("File size " + Convert.ToString(FileSize), ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
LogMessage("-----------------------------------------------------------------", ((LoggedInEmpDataBE)Session["FRX_LOGGEDIN_EMPLOYEE_INFO"]).LoggedInEmpID);
}
//jitu
// catch (Exception ex)
// {
// Response.Redirect("FrmError.aspx?Action=Process&ErrorType=6&PageName=FrmCompleteDisbursement&Create&RefNo=EXP285&ErrorDesc=" + ex.Message + "&EMPID=" + objLogonUser.LoggedInEmpID + "&DMSID=" + objErrorController.GetExceptionID());
// objCommUtility = new CommonUtility();
// objCommUtility.CallErrorPage(ex, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, strEmpID);
// objCommUtility = null;
// }
//}
#endregion
#region ImageBrowse_Click
protected void ImageBrowse_Click(object sender, ImageClickEventArgs e)
{
try
{
string strFileName = (sender as ImageButton).CommandArgument;
string strMode = (sender as ImageButton).CommandName;
DownloadFile(strFileName, strMode);
//OpenFileDMS("09003039801f9790");
}
catch (Exception excp)
{
//throw excp;
objCommUtility = new CommonUtility();
objCommUtility.CallErrorPage(excp, strPageName, strPath, intErrorType, strEvent, strRefNo, 0, strEmpID);
objCommUtility = null;
}
}
#endregion
public void LogMessage(string txtMessage, string strUser)
{
StringBuilder txtFile = new StringBuilder();
txtFile.AppendLine(DateTime.Now.ToString("dd-MM-yyyy hh:mm:Ss") + "-" + strUser + "-" + txtMessage);
StreamWriter writer = new StreamWriter(fs1);
writer.Write(txtFile);
writer.Flush();
// writer.Close();
}
}
//catch (Exception oEx)
// {
// CommonUtility.LogMessage("Add expense PopulateTask Error Page..." + "-" + oEx.Message, loggedInEmpDataBE.LoggedInEmpID);
// ErrorController objErrorController = new ErrorController(_ExpenseReportID, oEx.Message, "EXP285", HttpContext.Current.Request.Url.AbsolutePath, oEx.StackTrace, objLogonUser.LoggedInEmpID, "Expense --> Create", this.Title, "Process");
// commonUtility.SendMail(ConfigurationManager.AppSettings["Exp_MailMonitoring"].ToString(), ConfigurationManager.AppSettings["Exp_MailFrom"].ToString(), "", "", "Expense Error", objErrorController.ToString(true));
// Response.Redirect("FrmError.aspx?Action=Process&ErrorType=6&PageName=Add Expense&PagePath=Expense --> Create&RefNo=EXP285&ErrorDesc=" + oEx.Message + "&EMPID=" + objLogonUser.LoggedInEmpID + "&ExceptionID=" + objErrorController.GetExceptionID());
// }
//CommonUtility.LogMessage("Add expense PopulateTask start...", loggedInEmpDataBE.LoggedInEmpID); //jitendra sahoo
Thanks And Regards
Parivesh mishra