Beispiel #1
0
        public static ReturnObject Delete(HttpContext context, long id)
        {
            if (id <= 0)
                return new ReturnObject() { Error = true, Message = "Invalid Drug System." };

            var item = new Lib.Data.DrugSystem(id);
            item.Delete();

            return new ReturnObject()
            {
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully deleted a drug system.",
                        title = "Drug System Deleted"
                    }
                },
                Actions = new List<ReturnActionObject>()
                {
                    new ReturnActionObject() {
                        Ele = "#systems-table tr[data-id=\""+id.ToString()+"\"]",
                        Type = "remove"
                    }
                }
            };
        }
Beispiel #2
0
        public static ReturnObject Edit(HttpContext context, long id, string name)
        {
            Lib.Data.DrugSystem item = null;
            if (id > 0)
                item = new Lib.Data.DrugSystem(id);
            else
                item = new Lib.Data.DrugSystem();

            item.Name = name;
            item.Save();

            return new ReturnObject() {
                Result = item,
                Redirect = new ReturnRedirectObject() {
                    Hash = "admin/drugs/systems/list"
                },
                Growl = new ReturnGrowlObject() {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject() {
                        text = "You have successfully saved this drug system.",
                        title = "Drug System Saved"
                    }
                }
            };
        }
        public GeneralInfoView()
            : base()
        {
            string strID = System.Web.HttpContext.Current.Request.QueryString["id"];
            long id;
            if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id))
                item = new Lib.Data.Drug();
            else
                item = new Lib.Data.Drug(id);

            TheSystem = new Lib.Data.DrugSystem(item.SystemID);
            Formulations = Lib.Data.DrugFormulation.FindByDrug(item);
            Versions = (from v in Lib.Data.DrugVersion.FindByDrug( item )
                        where v.Status == "Approved"
                        orderby v.Updated descending
                        select v).ToList();

            var profile = Lib.Systems.Security.GetCurrentProfile();
            UserType = profile.UserType.Name;
            if( UserType == "prescriber" )
                UserEocs = Lib.Data.UserEoc.FindByUserandDrug( profile.ID.Value, item.ID.Value );
            else if( UserType == "provider" )
            {
                var facilities = Lib.Data.ProviderFacility.FindAllByProviderUser( Lib.Systems.Security.GetCurrentProviderUser() );
                if( facilities != null && facilities.Count > 0 )
                    FacilityEocs = Lib.Data.FacilityEoc.FindByFacilityandDrug( facilities[0].ID.Value, item.ID.Value );
            }
        }
Beispiel #4
0
 protected void Page_Init(object sender, EventArgs e)
 {
     string strID = Request.QueryString["id"];
     long id;
     if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id))
         item = new Lib.Data.DrugSystem();
     else
         item = new Lib.Data.DrugSystem(id);
 }