Esempio n. 1
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            var t = new Item();
            var tc = new ItemController();

            if (ItemId > 0)
            {
                t = tc.GetItem(ItemId);
                t.HelloText = txtName.Text.Trim();

            }
            else
            {
                t = new Item()
                {

                    HelloText = txtName.Text.Trim(),

                };
            }

            if (t.TextId > 0)
            {
                tc.UpdateItem(t);
            }
            else
            {
                tc.CreateItem(t);
            }
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
        }
Esempio n. 2
0
        public void rptItemListOnItemCommand(object source, RepeaterCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                Response.Redirect(EditUrl(string.Empty, string.Empty, "Edit", "tid=" + e.CommandArgument));
            }

            if (e.CommandName == "Delete")
            {
                var tc = new ItemController();
                tc.DeleteItem(Convert.ToInt32(e.CommandArgument));
            }
            Response.Redirect(DotNetNuke.Common.Globals.NavigateURL());
        }
Esempio n. 3
0
 public HttpResponseMessage HelloWorld()
 {
     try
     {
          var tc = new ItemController();
          var defaultvalue=tc.GetItems().First();
          return Request.CreateResponse(HttpStatusCode.OK, defaultvalue.HelloText);
     }
     catch (System.Exception ex)
     {
         //Log to DotNetNuke and reply with Error
         Exceptions.LogException(ex);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message);
     }
 }
Esempio n. 4
0
 public HttpResponseMessage UpdateHelloTextByPost(string HelloText)
 {
     try
     {
         var tc = new ItemController();
         var defaultvalue = tc.GetItems().First();
         defaultvalue.HelloText =HelloText;
         tc.UpdateItem(defaultvalue);
         return Request.CreateResponse(HttpStatusCode.OK, "Update successfully");
     }
     catch (System.Exception ex)
     {
         //Log to DotNetNuke and reply with Error
         Exceptions.LogException(ex);
         return Request.CreateErrorResponse(HttpStatusCode.InternalServerError,"post"+ ex.Message);
     }
 }
Esempio n. 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //Implement your edit logic for your module
                if (!Page.IsPostBack)
                {
                    //get a list of users to assign the user to the Object

                    //check if we have an ID passed in via a querystring parameter, if so, load that item to edit.
                    //ItemId is defined in the ItemModuleBase.cs file
                    if (ItemId > 0)
                    {
                        var tc = new ItemController();

                        var t = tc.GetItem(ItemId);
                        if (t != null)
                        {
                            txtName.Text = t.HelloText;
                        }
                    }
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Esempio n. 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         var tc = new ItemController();
         rptItemList.DataSource = tc.GetItems();
         rptItemList.DataBind();
     }
     catch (Exception exc) //Module failed to load
     {
         Exceptions.ProcessModuleLoadException(this, exc);
     }
 }