Beispiel #1
0
        /// <summary>
        /// This method returns the pdf details of car from stored procedure based on requestID
        /// </summary>
        /// <param name="requestID"></param>
        /// <returns></returns>
        public CarApprovalModel GetPDFDetailsFromCAR(string requestID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                CarApprovalModel ObjSA = null;
                // Create an array list for storing parameters
                ArrayList parameterArray = new ArrayList();
                // Initialize a new sql parameter list
                List <SqlParameter> sqlParameters = new List <SqlParameter>();
                // Initialize a new sql parameters
                SqlParameter pRequestID = new SqlParameter("@RequestID", requestID);
                pRequestID.Direction = ParameterDirection.Input;
                // Adding all sql parameters to sql parameter array
                sqlParameters.Add(pRequestID);
                // Open a new SQL Connection
                sqldataProvider.OpenConnection(ConfigurationManager.ConnectionStrings["BakendAgentCarConnectionString"].ConnectionString);
                // Execute stored procedure for fetching PDf details from CAR Backend.
                DataSet    dsPdfDetails    = (DataSet)sqldataProvider.ExecuteDataSet(CommandType.StoredProcedure, ConfigurationManager.AppSettings["GetCarPDFDetailsSPName"], sqlParameters.ToArray());
                CarSummary objCarbasicInfo = null;
                //stored procedure returns two result sets
                if (dsPdfDetails != null && dsPdfDetails.Tables.Count > 0)
                {
                    //getting CARApprovalBasicInfo details from dataset table 1
                    if (dsPdfDetails.Tables[0] != null && dsPdfDetails.Tables[0].Rows.Count > 0)
                    {
                        DataRow row = dsPdfDetails.Tables[0].Rows[0];
                        objCarbasicInfo = new CarSummary()
                        {
                            Name                      = (!row.IsNull("Name")) ? Convert.ToString(row["Name"]) : string.Empty,
                            Description               = (!row.IsNull("Description")) ? Convert.ToString(row["Description"]) : string.Empty,
                            Controller                = (!row.IsNull("Controller") && !string.IsNullOrEmpty(Convert.ToString(row["Controller"]))) ? Convert.ToInt32(row["Controller"]) : 0,
                            Requestor                 = (!row.IsNull("Requestor") && !string.IsNullOrEmpty(Convert.ToString(row["Requestor"]))) ? Convert.ToInt32(row["Requestor"]) : 0,
                            DateofRequest             = (!row.IsNull("DateofRequest") && !string.IsNullOrEmpty(Convert.ToString(row["DateofRequest"]))) ? Convert.ToDateTime(row["DateofRequest"]) : (DateTime?)null,
                            BrandDescription          = (!row.IsNull("BrandDescription")) ? Convert.ToString(row["BrandDescription"]) : string.Empty,
                            CountryDescription        = (!row.IsNull("CountryDescription")) ? Convert.ToString(row["CountryDescription"]) : string.Empty,
                            MarketDescription         = (!row.IsNull("MarketDescription")) ? Convert.ToString(row["MarketDescription"]) : string.Empty,
                            InvestmentTypeDescription = (!row.IsNull("InvestmentTypeDescription")) ? Convert.ToString(row["InvestmentTypeDescription"]) : string.Empty,
                            EstimatedStartDate        = (!row.IsNull("EstimatedStartDate") && !string.IsNullOrEmpty(Convert.ToString(row["EstimatedStartDate"]))) ? Convert.ToDateTime(row["EstimatedStartDate"]) : (DateTime?)null,
                            EstimatedCompletionDate   = (!row.IsNull("EstimatedCompletionDate") && !string.IsNullOrEmpty(Convert.ToString(row["EstimatedCompletionDate"]))) ? Convert.ToDateTime(row["EstimatedCompletionDate"]) : (DateTime?)null,
                            Budgeted                  = (!row.IsNull("Budgeted") && !string.IsNullOrEmpty(Convert.ToString(row["Budgeted"]))) ? Convert.ToBoolean(Convert.ToInt32(row["Budgeted"])) : false,
                            Capex                     = (!row.IsNull("Capex") && !string.IsNullOrEmpty(Convert.ToString(row["Capex"]))) ? Convert.ToDecimal(row["Capex"]) : 0,
                            CapexLocal                = (!row.IsNull("CapexLocal") && !string.IsNullOrEmpty(Convert.ToString(row["CapexLocal"]))) ? Convert.ToDecimal(row["CapexLocal"]) : 0,
                            SpenttodateEUR            = (!row.IsNull("SpenttodateEUR") && !string.IsNullOrEmpty(Convert.ToString(row["SpenttodateEUR"]))) ? Convert.ToDecimal(row["SpenttodateEUR"]) : 0,
                            CAPEXThisRequest          = (!row.IsNull("CAPEXthisrequest") && !string.IsNullOrEmpty(Convert.ToString(row["CAPEXthisrequest"]))) ? Convert.ToDecimal(row["CAPEXthisrequest"]) : 0,
                            LocalCurency              = (!row.IsNull("LocalCurency") && !string.IsNullOrEmpty(Convert.ToString(row["LocalCurency"]))) ? Convert.ToInt32(row["LocalCurency"]) : 0,
                            AssetNo                   = (!row.IsNull("AssetNo")) ? Convert.ToString(row["AssetNo"]) : string.Empty,
                            CostCenterInternalOrder   = (!row.IsNull("CostCenterInternalOrder")) ? Convert.ToString(row["CostCenterInternalOrder"]) : string.Empty,
                            IMSNumber                 = (!row.IsNull("IMSNumber") && !string.IsNullOrEmpty(Convert.ToString(row["IMSNumber"]))) ? Convert.ToInt32(row["IMSNumber"]) : 0,
                            CAPEXCodeGrape            = (!row.IsNull("CAPEXCodeGrape")) ? Convert.ToString(row["CAPEXCodeGrape"]) : string.Empty,
                            FinanceLease              = (!row.IsNull("FinanceLease") && !string.IsNullOrEmpty(Convert.ToString(row["FinanceLease"]))) ? Convert.ToBoolean(Convert.ToInt32(row["FinanceLease"])) : false,
                            ContractualObligation     = (!row.IsNull("ContractualObligation") && !string.IsNullOrEmpty(Convert.ToString(row["ContractualObligation"]))) ? Convert.ToBoolean(Convert.ToInt32(row["ContractualObligation"])) : false,
                            PurchaseOption            = (!row.IsNull("PurchaseOption") && !string.IsNullOrEmpty(Convert.ToString(row["PurchaseOption"]))) ? Convert.ToBoolean(Convert.ToInt32(row["PurchaseOption"])) : false,
                            GlobalRealEstate          = (!row.IsNull("Budgeted") && !string.IsNullOrEmpty(Convert.ToString(row["GlobalRealEstate"]))) ? Convert.ToBoolean(Convert.ToInt32(row["GlobalRealEstate"])) : false,
                            NoOfYears                 = (!row.IsNull("NoOfYears") && !string.IsNullOrEmpty(Convert.ToString(row["NoOfYears"]))) ? Convert.ToInt32(row["NoOfYears"]) : 0,
                        };
                    }
                    //getting CarCapexMatrix details from dataset table 2
                    //writing it into CarCapexMatrixlist
                    List <CarCapexMatrix> lstCarCapexmatrix = null;
                    if (dsPdfDetails.Tables[1] != null && dsPdfDetails.Tables[1].Rows.Count > 0)
                    {
                        lstCarCapexmatrix = dsPdfDetails.Tables[1].AsEnumerable().Select(row =>
                                                                                         new CarCapexMatrix
                        {
                            CapexMatricDescription = row.Field <string>("Description"),
                            Y1       = row.Field <decimal>("Y1"),
                            Y2       = row.Field <decimal>("Y2"),
                            Y3       = row.Field <decimal>("Y3"),
                            TotalSum = row.Field <decimal>("TotalSum")
                        }).ToList();
                    }
                    //clone CAR pdf details into CarApprovalModel class
                    ObjSA = new CarApprovalModel()
                    {
                        CarBasicInformation   = objCarbasicInfo,
                        CarCapexMatrixDetails = lstCarCapexmatrix
                    };
                }
                return(ObjSA);
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                throw new DataAccessException(exception.Message, exception.InnerException);
            }
        }
Beispiel #2
0
        /// <summary>
        /// This method returns the pdf details of store from stored procedure based on requestID
        /// </summary>
        /// <param name="requestID"></param>
        /// <returns></returns>
        public StoreApprovalModel GetPDFDetailsFromStore(string requestID)
        {
            string callerMethodName = string.Empty;

            try
            {
                //Get Caller Method name from CallerInformation class
                callerMethodName = CallerInformation.TrackCallerMethodName();
                StoreApprovalModel ObjSA = null;
                // Create an array list for storing parameters
                ArrayList parameterArray = new ArrayList();
                // Initialize a new sql parameter list
                List <SqlParameter> sqlParameters = new List <SqlParameter>();
                // Initialize a new sql parameters
                SqlParameter pRequestID = new SqlParameter("@BPMID", requestID);
                pRequestID.Direction = ParameterDirection.Input;
                // Adding all sql parameters to sql parameter array
                sqlParameters.Add(pRequestID);
                // Open a new SQL Connection
                sqldataProvider.OpenConnection(ConfigurationManager.ConnectionStrings["BakendAgentStoreConnectionString"].ConnectionString);
                // Execute stored procedure for fetching PDf details from STORE Backend.
                DataSet dsPdfDetails = (DataSet)sqldataProvider.ExecuteDataSet(CommandType.StoredProcedure, ConfigurationManager.AppSettings["GetStorePDFDetailsSPName"], sqlParameters.ToArray());
                StoreApprovalBasicInfo objSAbasicInfo = null;
                //stored procedure returns two result sets
                if (dsPdfDetails != null && dsPdfDetails.Tables.Count > 0)
                {
                    //getting StoreApprovalBasicInfo details from dataset table 1
                    if (dsPdfDetails.Tables[0] != null && dsPdfDetails.Tables[0].Rows.Count > 0)
                    {
                        DataRow row = dsPdfDetails.Tables[0].Rows[0];
                        objSAbasicInfo = new StoreApprovalBasicInfo()
                        {
                            DisplayBPMID     = (!row.IsNull("DisplayBPMID")) ? Convert.ToString(row["DisplayBPMID"]) : string.Empty,
                            RequestName      = (!row.IsNull("RequestName")) ? Convert.ToString(row["RequestName"]) : string.Empty,
                            MarketName       = (!row.IsNull("MarketName")) ? Convert.ToString(row["MarketName"]) : string.Empty,
                            ProjectName      = (!row.IsNull("ProjectName")) ? Convert.ToString(row["ProjectName"]) : string.Empty,
                            BrandName        = (!row.IsNull("BrandName")) ? Convert.ToString(row["BrandName"]) : string.Empty,
                            SecurityDeposit  = (!row.IsNull("SecurityDeposit") && !string.IsNullOrEmpty(Convert.ToString(row["SecurityDeposit"]))) ? Convert.ToDecimal(row["SecurityDeposit"]) : 0,
                            TotalInvestment  = (!row.IsNull("TotalInvestment") && !string.IsNullOrEmpty(Convert.ToString(row["TotalInvestment"]))) ? Convert.ToDecimal(row["TotalInvestment"]) : 0,
                            KeyMoney         = (!row.IsNull("KeyMoney") && !string.IsNullOrEmpty(Convert.ToString(row["KeyMoney"]))) ? Convert.ToDecimal(row["KeyMoney"]) : 0,
                            Brand            = (!row.IsNull("Brand") && !string.IsNullOrEmpty(Convert.ToString(row["Brand"]))) ? Convert.ToDecimal(row["Brand"]) : 0,
                            CaseID           = (!row.IsNull("CaseID") && !string.IsNullOrEmpty(Convert.ToString(row["CaseID"]))) ? Convert.ToInt32(row["CaseID"]) : 0,
                            StoreTypeName    = (!row.IsNull("StoreTypeName")) ? Convert.ToString(row["StoreTypeName"]) : string.Empty,
                            NetSellingSpace  = (!row.IsNull("NetSellingSpace") && !string.IsNullOrEmpty(Convert.ToString(row["NetSellingSpace"]))) ? Convert.ToInt32(row["NetSellingSpace"]) : 0,
                            OpeningDate      = (!row.IsNull("OpeningDate") && !string.IsNullOrEmpty(Convert.ToString(row["OpeningDate"]))) ? Convert.ToDateTime(row["OpeningDate"]) : (DateTime?)null,
                            LeaseEndDate     = (!row.IsNull("LeaseEndDate") && !string.IsNullOrEmpty(Convert.ToString(row["LeaseEndDate"]))) ? Convert.ToDateTime(row["LeaseEndDate"]) : (DateTime?)null,
                            LeasingPeriodDec = (!row.IsNull("LeasingPeriodDec") && !string.IsNullOrEmpty(Convert.ToString(row["LeasingPeriodDec"]))) ? Convert.ToDecimal(row["LeasingPeriodDec"]) : 0,
                            CancelPeriod     = (!row.IsNull("CancelPeriod") && !string.IsNullOrEmpty(Convert.ToString(row["CancelPeriod"]))) ? Convert.ToInt32(row["CancelPeriod"]) : 0,
                            LeaseBreakOption = (!row.IsNull("LeaseBreakOption") && !string.IsNullOrEmpty(Convert.ToString(row["LeaseBreakOption"]))) ? Convert.ToInt32(row["LeaseBreakOption"]) : 0,
                            CapexSpendYear   = (!row.IsNull("CapexSpendYear") && !string.IsNullOrEmpty(Convert.ToString(row["CapexSpendYear"]))) ? Convert.ToInt32(row["CapexSpendYear"]) : 0,
                            GrossLeasedArea  = (!row.IsNull("GrossLeasedArea") && !string.IsNullOrEmpty(Convert.ToString(row["GrossLeasedArea"]))) ? Convert.ToInt32(row["GrossLeasedArea"]) : 0
                        };
                    }
                    //getting StoreExecutiveSummary details from dataset table 2
                    List <StoreExecutiveSummary> lstSASummary = null;
                    if (dsPdfDetails.Tables[1] != null && dsPdfDetails.Tables[1].Rows.Count > 0)
                    {
                        lstSASummary = dsPdfDetails.Tables[1].AsEnumerable().Select(row =>
                                                                                    new StoreExecutiveSummary
                        {
                            LineID      = row.Field <string>("LineID"),
                            Description = row.Field <string>("Description"),
                            Y0          = row.Field <string>("Y0"),
                            Y0Val       = row.Field <string>("Y0Val"),
                            Y1          = row.Field <string>("Y1"),
                            Y1Val       = row.Field <string>("Y1Val"),
                            Y2          = row.Field <string>("Y2"),
                            Y2Val       = row.Field <string>("Y2Val"),
                            Y3          = row.Field <string>("Y3"),
                            Y3Val       = row.Field <string>("Y3Val"),
                            Y4          = row.Field <string>("Y4"),
                            Y4Val       = row.Field <string>("Y4Val"),
                            Y5          = row.Field <string>("Y5"),
                            Y5Val       = row.Field <string>("Y5Val"),
                            GRSVal      = row.Field <string>("GRSVal"),
                        }).ToList();
                    }
                    //getting store pdf details into StoreApprovalModel class
                    ObjSA = new StoreApprovalModel()
                    {
                        StoreBasicInformation = objSAbasicInfo,
                        StoreSummaryDetails   = lstSASummary
                    };
                }
                return(ObjSA);
            }
            catch (Exception exception)
            {
                InsightLogger.Exception(exception.Message, exception, callerMethodName);
                throw new DataAccessException(exception.Message, exception.InnerException);
            }
        }