public string GetReportData(string companyCode, string userName, System.Web.Mvc.FormCollection coll, string subDominName, out string error) { DALAPI objdalAPI = new DALAPI(); CurrentInfo _objcurrentInfo = new CurrentInfo(); Data _objData = new Data(); int apiID = Convert.ToInt32(coll["APIId"]); string serviceId = coll["ServiceId"].ToString(); //string ErrorMSG = string.Empty; string TransNumber = Guid.NewGuid().ToString(); string CurrentUserCode = _objcurrentInfo.GetUserCode(); //string CurrentUserName = _objcurrentInfo.GetUserName(); string ConnectionString = _objData.GetConnectionString_Client(); string ExcelURL = string.Empty; StringBuilder ParamDetails = new StringBuilder(); DataSet ds = GetAPIUIElements(apiID); object[] param = new object[ds.Tables[0].Rows.Count]; int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Show_In_UI"].ToString().ToUpper() == "N") { param[i] = HttpContext.Current.Session[dr["Session_Key"].ToString()].ToString(); } else { if (dr["Type"].ToString() != "TEXT_CSV") { param[i] = coll[dr["InputParam"].ToString()].ToString(); } else { // input string formate for TEXT_CSV aaa^bbb^ccc^bbbb^ string paramValue = coll[dr["InputParam"].ToString()].ToString(); paramValue = paramValue.Replace("^", "','"); paramValue = "'" + paramValue + "'"; param[i] = paramValue; } } ParamDetails.Append(dr["InputParam"].ToString() + ": " + param[i].ToString() + "<br />"); i++; } //Log Bulk API SVC Log string hdLogId = Guid.NewGuid().ToString(); string OutError; objdalAPI.BulkAPISvcLog(companyCode, userName, serviceId, hdLogId, apiID); HDCoreDataService.HDCoreDataServiceClient coreClt = new HDCoreDataService.HDCoreDataServiceClient(); DataSet dsReport = new DataSet(); dsReport = coreClt.ExecuteServiceDS("SWAAS", subDominName, apiID, "", "", 0, param, out OutError); // dsReport = coreClt.ExecuteServiceDS(out OutError,"SWAAS", subDominName, apiID, "", "", 0, param); error = ""; return(bindReport(dsReport).ToString()); }
public string ExecuteService(string companyCode, string userName, System.Web.Mvc.FormCollection coll, string subDominName, out string error) { try { //string companyCode = HttpContext.Current.Session["Company_Code"].ToString(); //string userName = HttpContext.Current.Session["User_Name"].ToString(); DALAPI objdalAPI = new DALAPI(); int apiID = Convert.ToInt32(coll["APIId"]); string serviceId = coll["ServiceId"].ToString(); DataSet ds = GetAPIUIElements(apiID); object[] param = new object[ds.Tables[0].Rows.Count]; int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Show_In_UI"].ToString().ToUpper() == "N") { param[i] = HttpContext.Current.Session[dr["Session_Key"].ToString()].ToString(); } else { if (dr["Type"].ToString() != "TEXT_CSV") { param[i] = coll[dr["InputParam"].ToString()].ToString(); } else { // input string formate for TEXT_CSV aaa^bbb^ccc^bbbb^ string paramValue = coll[dr["InputParam"].ToString()].ToString(); paramValue = paramValue.Replace("^", "','"); paramValue = "'" + paramValue + "'"; param[i] = paramValue; } } i++; } //Log Bulk API SVC Log string hdLogId = Guid.NewGuid().ToString(); objdalAPI.BulkAPISvcLog(companyCode, userName, serviceId, hdLogId, apiID); //HDCoreDataService.HDCoreDataServiceClient coreClt = new HDCoreDataService.HDCoreDataServiceClient(); HDCoreDataService.HDCoreDataServiceClient coreClt = new HDCoreDataService.HDCoreDataServiceClient(); string url = coreClt.ExecuteService("SWAAS", subDominName, apiID, hdLogId, param, out error); // string url = coreClt.ExecuteService(out error,"SWAAS", subDominName, apiID, hdLogId, param); if (!string.IsNullOrEmpty(url)) { return(url); } else { return("FAIL:" + error); } } catch (Exception ex) { error = ex.Message.ToString(); return("FAIL:" + error); } }
public string GetExcelData(string companyCode, string userName, System.Web.Mvc.FormCollection coll, string subDominName, out string error) { DALAPI objdalAPI = new DALAPI(); CurrentInfo _objcurrentInfo = new CurrentInfo(); Data _objData = new Data(); int apiID = Convert.ToInt32(coll["APIId"]); string serviceId = coll["ServiceId"].ToString(); //string ErrorMSG = string.Empty; string TransNumber = Guid.NewGuid().ToString(); string CurrentUserCode = _objcurrentInfo.GetUserCode(); //string CurrentUserName = _objcurrentInfo.GetUserName(); string ConnectionString = _objData.GetConnectionString_Client(); string ExcelURL = string.Empty; StringBuilder ParamDetails = new StringBuilder(); DataSet ds = GetAPIUIElements(apiID); object[] param = new object[ds.Tables[0].Rows.Count]; int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Show_In_UI"].ToString().ToUpper() == "N") { param[i] = HttpContext.Current.Session[dr["Session_Key"].ToString()].ToString(); } else { if (dr["Type"].ToString() != "TEXT_CSV") { param[i] = coll[dr["InputParam"].ToString()].ToString(); } else { // input string formate for TEXT_CSV aaa^bbb^ccc^bbbb^ string paramValue = coll[dr["InputParam"].ToString()].ToString(); paramValue = paramValue.Replace("^", "','"); paramValue = "'" + paramValue + "'"; param[i] = paramValue; } } ParamDetails.Append(dr["InputParam"].ToString() + ": " + param[i].ToString() + "<br />"); i++; } //Log Bulk API SVC Log string hdLogId = Guid.NewGuid().ToString(); string OutError; objdalAPI.BulkAPISvcLog(companyCode, userName, serviceId, hdLogId, apiID); InsertExcelAPITransactionQueue(companyCode, TransNumber, apiID, ParamDetails.ToString(), "In Progress", false, "", "", "", ConnectionString, CurrentUserCode); //HDCoreDataService.HDCoreDataServiceClient coreClt = new HDCoreDataService.HDCoreDataServiceClient(); Task task = Task.Factory.StartNew(() => { try { HDCoreDataService.HDCoreDataServiceClient coreClt = new HDCoreDataService.HDCoreDataServiceClient(); // ExcelURL = coreClt.ExecuteService(out OutError,"SWAAS", subDominName, apiID, hdLogId, param); ExcelURL = coreClt.ExecuteService("SWAAS", subDominName, apiID, hdLogId, param, out OutError); if (ExcelURL != "") { OnAsyncReportProcessCompletion(companyCode, CurrentUserCode, TransNumber, apiID, ExcelURL, ConnectionString); } else { UpdateExcelAPITransactionQueue(TransNumber, "Error", OutError, OutError, "", ConnectionString, CurrentUserCode); } } catch (Exception ex) { UpdateExcelAPITransactionQueue(TransNumber, "Error", ex.Message, "Error occurred while processing the request, please try again later", "", ConnectionString, CurrentUserCode); } }); error = TransNumber; return("SUCCESS"); }