Пример #1
1
        public static ReturnObject Edit(HttpContext context, string name, string website = "", string phone = "", long? id = null)
        {
            Lib.Data.DrugCompany item = null;
            if (id > 0)
                item = new Lib.Data.DrugCompany(id);
            else
                item = new Lib.Data.DrugCompany();

            item.Name = name;
            item.Website = website;
            item.Phone = phone;
            item.Save();

            return new ReturnObject()
            {
                Result = item,
                Redirect = new ReturnRedirectObject()
                {
                    Hash = "admin/drugs/companies/list"
                },
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully saved this drug company.",
                        title = "Drug Company Saved"
                    }
                }
            };
        }
Пример #2
1
        public static ReturnObject Delete(HttpContext context, long id)
        {
            if (id <= 0)
                return new ReturnObject() { Error = true, Message = "Invalid Drug Company." };

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

            return new ReturnObject()
            {
                Growl = new ReturnGrowlObject()
                {
                    Type = "default",
                    Vars = new ReturnGrowlVarsObject()
                    {
                        text = "You have successfully deleted a drug company.",
                        title = "Drug Company Deleted"
                    }
                },
                Actions = new List<ReturnActionObject>()
                {
                    new ReturnActionObject() {
                        Ele = "#companies-table tr[data-id=\""+id.ToString()+"\"]",
                        Type = "remove"
                    }
                }
            };
        }
Пример #3
0
        protected void Page_Init(object sender, EventArgs e)
        {
            string strID = Request.QueryString["id"];
            long id;

            string strParentID = Request.QueryString["parent-id"];
            long parent_id;

            if (!long.TryParse(strParentID, out parent_id))
                RedirectHash("admin/drugs/companies/list");

            Company = new Lib.Data.DrugCompany(parent_id);

            if (string.IsNullOrEmpty(strID) || !long.TryParse(strID, out id))
            {
                item = new Lib.Data.DrugCompanyUser();
                profile = new Lib.Data.UserProfile();
                contact = new Lib.Data.Contact();
                address = new Lib.Data.Address();
                user = new Framework.Security.User();
            }
            else
            {
                item = new Lib.Data.DrugCompanyUser(id);
                profile = item.Profile;
                user = profile.User;
                contact = profile.PrimaryContact;
                address = profile.PrimaryAddress;
            }
        }
Пример #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))
     {
         RedirectHash("admin/drugs/companies/list", true, "Invalid Drug Company ID");
     }
     else
     {
         item = new Lib.Data.DrugCompany(id);
     }
 }
Пример #5
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.DrugCompany();
         Users = new List<Lib.Data.DrugCompanyUser>();
     }
     else
     {
         item = new Lib.Data.DrugCompany(id);
         Users = Lib.Data.DrugCompanyUser.FindByDrugCompany(item);
     }
 }