Beispiel #1
0
        public JsonResult AddService(ServiceTariff serviceTariff, FormCollection form)
        {
            //Redirect to the creation page
            //get id from session
            int tariff = Convert.ToInt32(form["Tariffid"]);

            if (serviceTariff != null)
            {
                // var name = _tariffService.GetCategory(serviceTariff.GroupId).Name;
                TariffCategory lst = _tariffService.GetallTariffCategory().Where(x => x.Type == 1 && x.TariffId == tariff).FirstOrDefault();

                if (lst == null)
                {
                    TariffCategory category = new TariffCategory();
                    category.Type     = 1;
                    category.Name     = "ALL";
                    category.TariffId = tariff;
                    _tariffService.AddnewCategory(category);
                    lst = category;
                }
                serviceTariff.GroupId   = lst.Id;
                serviceTariff.Groupname = "ALL";
                serviceTariff.Price     = Convert.ToDecimal(form["serviceprice"]);
                _tariffService.AddnewServiceTariff(serviceTariff);
            }

            return(Json("{result:1}", JsonRequestBehavior.AllowGet));
        }
        public void FilterData(StringBuilder res = null)
        {
            if (DisableBaseFilterData)
            {
                return;
            }
            if (res == null)
            {
                res = GetAutoPropertyFilterString();
            }
            if (res.Length == 0 && vloader.NavigationExpression.Count != 0)
            {
                res.Append("&& All");
            }
            if (res.Length > 0)
            {
                vloader.FilterExpression = res.ToString().Trim().Substring(2).Trim();
            }
            else
            {
                if (vloader.FilterExpression != "All")
                {
                    vloader.FilterExpression = null;
                }
            }

            TariffCategory.Refresh();
            NotifyPropertyChanged(x => this.TariffCategory);
        }
Beispiel #3
0
        public JsonResult GetProviderDrugTariffJson(int?providerid)
        {
            int      id       = Convert.ToInt32(providerid);
            Provider provider = _providerSvc.GetProvider(id);
            int      tariffid = -1;

            if (provider != null)
            {
                //var t_id = !string.IsNullOrEmpty(provider.ProviderTariffs) ? provider.ProviderTariffs.Split(',')[0] : "-1";
                tariffid = -1;

                //var tariffID = 0;

                if (!string.IsNullOrEmpty(provider.ProviderTariffs))
                {
                    if (!int.TryParse(provider.ProviderTariffs.Split(',')[0], out tariffid))
                    {
                        tariffid = -1;
                    }
                }

                TariffCategory categoryinlist = _tariffService.GetallTariffCategory().Where(x => x.TariffId == tariffid && x.Type == 0).FirstOrDefault();


                if (categoryinlist != null)
                {
                    IList <DrugTariff> service_tariff = _tariffService.GetalldrugtariffByCategory(categoryinlist.Id);

                    List <TariffGenericReponse> response = new List <TariffGenericReponse>();

                    foreach (DrugTariff item in service_tariff)
                    {
                        if (string.IsNullOrEmpty(item.Name))
                        {
                            item.Name = "--";
                        }
                        if (string.IsNullOrEmpty(item.Unit))
                        {
                            item.Unit = "--";
                        }
                        response.Add(new TariffGenericReponse
                        {
                            Id    = item.Id.ToString(),
                            Name  = item.Name.ToUpper() + " " + item.Unit.ToLower(),
                            Price = item.Price.ToString()
                        });
                    }

                    return(Json(response, JsonRequestBehavior.AllowGet));
                }
                return(Json(new { respcode = 99, respmsg = "There is not enrollee category." }, JsonRequestBehavior.AllowGet));
            }



            return(Json(new { respcode = 98, respmsg = "The provider id is invalid." }, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
 public bool DeleteCategory(TariffCategory category)
 {
     if (category != null)
     {
         _session.Transact(session => session.Delete(category));
         return(true);
     }
     return(false);
 }
Beispiel #5
0
        public ActionResult AddCategory(int?id)
        {
            int intid = Convert.ToInt32(id);

            TariffCategory model = new TariffCategory();

            model.Type = intid;
            //Redirect to the creation page
            return(PartialView("AddCategory", model));
        }
Beispiel #6
0
 public async Task SaveTariffCategory(TariffCategory i)
 {
     if (i == null)
     {
         return;
     }
     using (var ctx = new TariffCategoryService())
     {
         await ctx.UpdateTariffCategory(i).ConfigureAwait(false);
     }
 }
Beispiel #7
0
        public ActionResult Add(Tariff tariff, FormCollection form)
        {
            bool response = _tariffService.AddnewTariff(tariff);

            //Add Defaultcategory for both drug and service
            TariffCategory category = new TariffCategory();

            category.Name        = "ALL Drugs";
            category.Description = "all the drugs in the tariff.";
            category.TariffId    = tariff.Id;
            category.Type        = 0;
            _tariffService.AddnewCategory(category);


            //Category Service
            TariffCategory category2 = new TariffCategory();

            category2.Name        = "ALL Services";
            category2.Description = "all the services in the tariff.";
            category2.TariffId    = tariff.Id;
            category2.Type        = 1;
            _tariffService.AddnewCategory(category2);


            //assign to a provider

            if (tariff.defaultProvider > 0)
            {
                Provider theprovider = _providerSvc.GetProvider(tariff.defaultProvider);

                if (theprovider != null)
                {
                    theprovider.ProviderTariffs = tariff.Id.ToString();
                    _providerSvc.UpdateProvider(theprovider);
                }
            }



            if (response)
            {
                //successfule
                //Set the success message for user to see
                _pageMessageSvc.SetSuccessMessage(string.Format("Tariff [{0}] was added successfully.", tariff.Name.ToUpper()));
            }
            else
            {
                _pageMessageSvc.SetErrormessage(string.Format("There was a problem  adding tariff [{0}] ",
                                                              tariff.Name.ToUpper()));
            }

            return(_uniquePageService.RedirectTo <TariffPage>());
        }
Beispiel #8
0
 public bool AddnewCategory(TariffCategory category)
 {
     if (category != null)
     {
         category.Name = category.Name.ToUpper();
         _session.Transact(session => session.Save(category));
         _helper.Log(LogEntryType.Audit, null,
                     string.Format(
                         "New Tarrif category has been added to the system category name {0} , Tarriff id {1}, by {2}",
                         category.Name, category.Id, CurrentRequestData.CurrentUser.Id), "category Added.");
         return(true);
     }
     return(false);
 }
Beispiel #9
0
        public JsonResult AddCategory(TariffCategory category, FormCollection form)
        {
            //Redirect to the creation page
            //get id from session
            int id = Convert.ToInt32(CurrentRequestData.CurrentContext.Request["id"]);



            if (id > 0)
            {
                category.TariffId = id;
                //category.Type = 0;
                _tariffService.AddnewCategory(category);
            }

            return(Json("{result:1}", JsonRequestBehavior.AllowGet));
        }
 public async Task <TariffCategory> CreateTariffCategory(TariffCategory entity)
 {
     return(await Channel.CreateTariffCategory(entity).ConfigureAwait(false));
 }
Beispiel #11
0
        public ActionResult UploadService(FormCollection form)
        {
            if (CurrentRequestData.CurrentContext.Request.Files.Count > 0)
            {
                System.Web.HttpPostedFileBase file = CurrentRequestData.CurrentContext.Request.Files[0];
                int mode = Convert.ToInt32(form["mode"]);


                int            id  = Convert.ToInt32(form["Tariffid"]);
                TariffCategory lst = _tariffService.GetallTariffCategory().Where(x => x.Type == 1 && x.TariffId == id && x.IsDeleted == false).FirstOrDefault();

                if (lst == null)
                {
                    TariffCategory category = new TariffCategory();
                    category.Type     = 1;
                    category.Name     = "ALL";
                    category.TariffId = Convert.ToInt32(id);
                    _tariffService.AddnewCategory(category);
                    lst = category;
                }
                //the new reading using csv

                try
                {
                    using (TextReader reader = new StreamReader(file.InputStream))
                    {
                        CsvReader csv = new CsvReader(reader);
                        List <UploadTariffCSV> records = csv.GetRecords <UploadTariffCSV>().ToList();


                        foreach (UploadTariffCSV item in records)
                        {
                            ServiceTariff servicetariff = new ServiceTariff();

                            servicetariff.GroupId     = lst.Id;
                            servicetariff.Name        = item.itemname.ToUpper();
                            servicetariff.Description = item.itemname.ToUpper();
                            servicetariff.Unit        = item.unit.ToUpper();
                            servicetariff.Price       = item.price;
                            servicetariff.Groupname   = lst.Name.ToUpper();
                            servicetariff.Remark      = item.remark;

                            if (item.authorizationRequired.ToLower().Contains("y"))
                            {
                                servicetariff.PreauthorizationRequired = true;
                            }
                            else
                            {
                                servicetariff.PreauthorizationRequired = false;
                            }

                            if (mode > 0 && !string.IsNullOrEmpty(servicetariff.Name))
                            {
                                _tariffService.AddnewServiceTariff(servicetariff);
                            }
                            else
                            {
                                //do for drug
                                lst = _tariffService.GetallTariffCategory().Where(x => x.Type == 0 && x.TariffId == id).FirstOrDefault();
                                if (lst == null)
                                {
                                    TariffCategory category = new TariffCategory();
                                    category.Type     = 0;
                                    category.Name     = "ALL";
                                    category.TariffId = Convert.ToInt32(id);
                                    _tariffService.AddnewCategory(category);
                                    lst = category;
                                }
                                DrugTariff drugariff = new DrugTariff();

                                drugariff.GroupId     = lst.Id;
                                drugariff.Name        = item.itemname.ToUpper();
                                drugariff.Description = item.itemname.ToUpper();
                                drugariff.Unit        = item.unit.ToUpper();
                                drugariff.Price       = item.price;
                                drugariff.Groupname   = lst.Name.ToUpper();
                                drugariff.Remark      = item.remark;



                                if (item.authorizationRequired.ToLower().Contains("y"))
                                {
                                    drugariff.PreauthorizationRequired = true;
                                }
                                else
                                {
                                    drugariff.PreauthorizationRequired = false;
                                }

                                if (!string.IsNullOrEmpty(drugariff.Name))
                                {
                                    _tariffService.AddnewDrugTariff(drugariff);
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    _pageMessageSvc.SetErrormessage("There was an error reading the CSV uploaded,kindly check the format and try again.");

                    return
                        (Redirect(
                             string.Format(
                                 _uniquePageService.GetUniquePage <TariffContentPage>().AbsoluteUrl +
                                 "?id={0}", id)));
                }
            }
            else
            {
                _pageMessageSvc.SetErrormessage("You have not uploaded any file.");

                return
                    (Redirect(CurrentRequestData.CurrentContext.Request.UrlReferrer.AbsoluteUri));
            }



            _pageMessageSvc.SetSuccessMessage("File Upload Complete.");
            return
                (Redirect(CurrentRequestData.CurrentContext.Request.UrlReferrer.AbsoluteUri));
        }
Beispiel #12
0
        public TariffCategory GetCategory(int id)
        {
            TariffCategory tariffcat = _session.QueryOver <TariffCategory>().Where(x => x.Id == id).SingleOrDefault();

            return(tariffcat);
        }