Esempio n. 1
0
        public DataSet GetAPIServices(string companyCode, string userTypeCode)
        {
            DALAPI objdalAPI = new DALAPI();

            //string companyCode = HttpContext.Current.Session["Company_Code"].ToString();
            return(objdalAPI.GetAPIServices(companyCode, userTypeCode));
        }
Esempio n. 2
0
        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());
        }
Esempio n. 3
0
 public int UpdateExcelAPITransactionQueue(string TransactionID, string ProcessState, string TechError, string UserError, string Excel_File_Path, string Connection, string CurrUserCode)
 {
     try
     {
         DALAPI objdalAPI = new DALAPI();
         return(objdalAPI.UpdateExcelAPITransactionQueue(TransactionID, ProcessState, TechError, UserError, Excel_File_Path, Connection, CurrUserCode));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 4
0
 public int InsertExcelAPITransactionQueue(string CompanyCode, string TransactionID, int API_ID, string Rpt_Parameters, string ProcessState, bool IsRptViewed, string TechError, string UserError, string Excel_File_Path, string Connection, string CurrUserCode)
 {
     try
     {
         DALAPI objdalAPI = new DALAPI();
         return(objdalAPI.InsertExcelAPITransactionQueue(CompanyCode, TransactionID, API_ID, Rpt_Parameters, ProcessState, IsRptViewed, TechError, UserError, Excel_File_Path, Connection, CurrUserCode));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 5
0
 public IList <UsersExcelAPIQueues> GetUsersExcelAPIProcessQueue(string UserCode, int API_ID)
 {
     try
     {
         DALAPI objdalAPI = new DALAPI();
         return(objdalAPI.GetUsersExcelAPIProcessQueue(UserCode, API_ID));
     }
     catch
     {
         throw;
     }
 }
Esempio n. 6
0
 public List <ExcelApiInput> GetExcelApiInputData(string companyCode, string userCode, string regionCode, string sessionKey, string searchKey)
 {
     try
     {
         DALAPI objDALAPI = new DALAPI();
         List <ExcelApiInput> lstExcelApiInput = new List <ExcelApiInput>();
         lstExcelApiInput = objDALAPI.GetExcelApiInputData(companyCode, userCode, regionCode, sessionKey, searchKey).ToList();
         return(lstExcelApiInput);
     }
     catch
     {
         throw;
     }
 }
Esempio n. 7
0
        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);
            }
        }
Esempio n. 8
0
        public DataSet GetAPIUIElements(int apiId)
        {
            DALAPI objdalAPI = new DALAPI();

            return(objdalAPI.GetAPIUIElements(apiId));
        }
Esempio n. 9
0
        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");
        }