Пример #1
0
        /* END OF API WEB SERVICE */


        /** FUNCTION DEFINITION **/

        public ContractListModel GetContractByWalletId(Guid walletid, Guid geoid)
        {
            List <ContractModel> l = new List <ContractModel>();

            foreach (var item in DataAccessAction.contract.GetContractByWalletId(walletid, geoid))
            {
                l.Add(new ContractModel()
                {
                    Id         = item.Id,
                    Start      = item.Start.Year + "/" + item.Start.Month.ToString("D2") + "/" + item.Start.Day.ToString("D2"),
                    End        = item.End.ToString(),
                    Cover      = item.Cover,
                    Negociable = item.Negociable,
                    Prime      = item.Prime,
                    Rompu      = item.Rompu,
                    Company    = item.Company,
                    Wallet     = item.Wallet,
                    WalletName = "",
                    Value      = item.Value,
                    //GeographicZones = Utils.ToGeographicZoneModel(item.GeographicZones)
                });
            }
            Session["currentWallet"] = walletid;
            ViewBag.service          = walletid;
            Guid userId           = (Guid)(Session["XenonUserId"]);
            ContractListModel clm = new ContractListModel()
            {
                ContractList             = l,
                NumberOfContractInWallet = DataAccessAction.wallet.NumberOfContractsByWalletId(walletid),
                WalletName = DataAccessAction.wallet.GetWalletById(walletid).Service,
                Scope      = (DataAccessAction.wallet.GetScopeWalletByWalletIdAndUserId(userId, walletid) ? "Inital" : "Extend")
            };

            return(clm);
        }
Пример #2
0
        public virtual IActionResult _ListContractPaymentPaidInYearByConstructionTypeId(int constructionTypeId, int year)
        {
            var model = new ContractListModel();
            var items = _contractService.GetAllContractInYearPaymentPaidByConstructionTypeId(constructionTypeId, year);

            model.Data = items.Select(c => _contractModelFactory.PrepareDashBoardThongKe(c, null, year)).ToList();
            return(PartialView(model));
        }
Пример #3
0
        public virtual IActionResult _ListContractByConstructionType(int constructionTypeId, int year)
        {
            var model = new ContractListModel();
            var items = _contractService.GetAllContractByConstructionInYear(constructionTypeId, year);

            model.Data = items.Select(c => c.ToModel <ContractModel>());
            return(PartialView(model));
        }
Пример #4
0
        public virtual IActionResult _ListContractAcceptanceInYear(int year)
        {
            var model = new ContractListModel();
            var items = _contractService.GetAllContractInYearAcceptance(year);

            model.Data = items.Select(c => _contractModelFactory.PrepareDashBoardThongKe(c, null, year)).ToList();
            return(PartialView(model));
        }
Пример #5
0
        public virtual IActionResult _ListTotalContractInYear(int year)
        {
            var model = new ContractListModel();
            var items = _contractService.GetAllContractInYear(year);

            model.Data = items.Select(c => c.ToModel <ContractModel>()).ToList();
            return(PartialView(model));
        }
Пример #6
0
        /* */


        /* WEBSITE WEB SERVICE*/
        public ActionResult Index(PaginationModel pm)
        {
            if (Session["XenonUserId"] == null)
            {
                return(Redirect("/"));
            }

            if (((string)Session["XenonStatus"]).Equals("souscripteur") ||
                ((string)Session["XenonStatus"]).Equals("manager"))
            {
                Guid geoid            = (Guid)Session["XenonGeoId"];
                ContractListModel clm = GetContractByWalletId(pm.WalletId, geoid);
                return(View(clm));
            }

            return(Redirect("/"));
        }
Пример #7
0
        /* API WEB SERVICE */

        public String IndexApi(PaginationModel pm)
        {
            if (Session["XenonUserId"] == null)
            {
                return(JsonConvert.SerializeObject(new ContractListModel()));
            }

            if (((string)Session["XenonStatus"]).Equals("souscripteur") ||
                ((string)Session["XenonStatus"]).Equals("manager"))
            {
                Guid geoid            = (Guid)Session["XenonGeoId"];
                ContractListModel clm = GetContractByWalletId(pm.WalletId, geoid);
                return(JsonConvert.SerializeObject(clm));
            }

            return(JsonConvert.SerializeObject(new ContractListModel()));
        }
Пример #8
0
        //private IEnumerable<dynamic> dbGetProviderList(ref int totalRecordCount )
        private dynamic dbGetClaimsList(ref int totalRecordCount)
        {
            bool   initGrid   = Request.Query["type"].ToString() == "initGrid" ? true : false;
            bool   exportGrid = Request.Query["type"].ToString() == "exportGrid" ? true : false;
            string remoteIP   = this.HttpContext.Connection.RemoteIpAddress.ToString();
            string localIP    = this.HttpContext.Connection.LocalIpAddress.ToString();

            List <dynamic>  rows            = new List <dynamic>();
            GIGridInitModel giGridInitModel = new GIGridInitModel()
            {
                ColumnList = new List <GIGridColumn>()
            };

            try
            {
                using (SqlConnection sqlConnection = new SqlConnection(
                           GIxUtils.DecodeConnectionString(
                               _configuration,
                               ref _loginRequest,
                               Request.Headers["X-WebGI-Authentication"],
                               Request.Headers["X-WebGI-Version"])))
                {
                    sqlConnection.Open();
                    using (SqlCommand sqlCommand = sqlConnection.CreateCommand())
                    {
                        sqlCommand.Connection  = sqlConnection;
                        sqlCommand.CommandType = CommandType.StoredProcedure;
                        sqlCommand.CommandText = "dbo.[usp_WebGI_GetAutoPolicyList]";
                        sqlCommand.Parameters.AddWithValue("@IP_Local", localIP);
                        sqlCommand.Parameters.AddWithValue("@IP_Remote", remoteIP);

                        sqlCommand.Parameters.AddWithValue("@Salt", _loginRequest.salt);
                        sqlCommand.Parameters.AddWithValue("@Version", _loginRequest.version);


                        if (Request != null && Request.Query != null && Request.Query.Keys != null && Request.Query.Keys.Count > 0)
                        {
                            foreach (string key in Request.Query.Keys)
                            {
                                if (!key.StartsWith("_"))
                                {
                                    string param = $"@{key}";
                                    sqlCommand.Parameters.AddWithValue(param, Request.Query[key].ToString());
                                }
                            }
                        }
                        ;

                        SqlParameter outputValue = sqlCommand.Parameters.Add("@totalCount", SqlDbType.Int);
                        outputValue.Direction = ParameterDirection.Output;

                        SqlDataReader recordSet = sqlCommand.ExecuteReader();
                        using (recordSet)
                        {
                            object value;
                            while (recordSet.Read())
                            {
                                dynamic model = null;
                                if (initGrid == true)
                                {
                                    model = new GIGridColumn();
                                }
                                else
                                {
                                    model = new ContractListModel(); ///////////////// !!!!!!!! //////////
                                }
                                var properties = model.GetType().GetProperties();
                                foreach (var el in properties)
                                {
                                    string name = el.Name;
                                    value = recordSet[recordSet.GetOrdinal(name)];
                                    if (value != System.DBNull.Value)
                                    {
                                        switch (el.PropertyType.Name)
                                        {
                                        case "Int32":
                                            el.SetValue(model, (int)value);
                                            break;

                                        case "String":
                                            el.SetValue(model, (string)value);
                                            break;

                                        case "Boolean":
                                            el.SetValue(model, (bool)value);
                                            break;

                                        case "Decimal":
                                            el.SetValue(model, (decimal)value);
                                            break;

                                        case "DateTime":
                                            el.SetValue(model, (DateTime)value);
                                            break;
                                        }
                                    }
                                }

                                if (initGrid == true)
                                {
                                    giGridInitModel.ColumnList.Add(model);
                                }
                                else
                                {
                                    rows.Add(model);
                                }
                            }

                            if (initGrid == true && recordSet.NextResult() && recordSet.Read())
                            {
                                if ((value = recordSet[recordSet.GetOrdinal("Title")]) != System.DBNull.Value)
                                {
                                    giGridInitModel.Title = (string)value;
                                }
                                if ((value = recordSet[recordSet.GetOrdinal("Toolbar")]) != System.DBNull.Value)
                                {
                                    giGridInitModel.Toolbar = (string)value;
                                }
                            }

                            recordSet.Close();
                            recordSet.Dispose();

                            if (outputValue.Value != null)
                            {
                                totalRecordCount = (int)outputValue.Value;
                            }
                        }
                    }

                    sqlConnection.Close();
                    sqlConnection.Dispose();
                }
            }

            catch (Exception ex)
            {
                GIxUtils.Log(ex);
                throw new Exception(ex.Message);
            }

            if (initGrid == false)
            {
                return(rows);
            }
            return(giGridInitModel);
        }