Beispiel #1
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                DateTimeCalcController controller = new DateTimeCalcController();
                DateTimeCalcInfo       item       = new DateTimeCalcInfo();

                item.Content       = txtContent.Text;
                item.ItemId        = itemId;
                item.ModuleId      = this.ModuleId;
                item.CreatedByUser = this.UserId;

                //determine if we are adding or updating
                if (Null.IsNull(item.ItemId))
                {
                    controller.AddDateTimeCalc(item);
                }
                else
                {
                    controller.UpdateDateTimeCalc(item);
                }

                Response.Redirect(Globals.NavigateURL(), true);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Beispiel #2
0
 protected void cmdDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (!Null.IsNull(itemId))
         {
             DateTimeCalcController controller = new DateTimeCalcController();
             controller.DeleteDateTimeCalc(this.ModuleId, itemId);
             Response.Redirect(Globals.NavigateURL(), true);
         }
     }
     catch (Exception ex)
     {
         Exceptions.ProcessModuleLoadException(this, ex);
     }
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (Request.QueryString["ItemId"] != null)
                {
                    itemId = Int32.Parse(Request.QueryString["ItemId"]);
                }

                if (!IsPostBack)
                {
                    //load the data into the control the first time
                    //we hit this page


                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('" + Localization.GetString("DeleteItem") + "');");

                    //check we have an item to lookup
                    if (!Null.IsNull(itemId))
                    {
                        //load the item
                        DateTimeCalcController controller = new DateTimeCalcController();
                        DateTimeCalcInfo       item       = controller.GetDateTimeCalc(this.ModuleId, itemId);

                        if (item != null)
                        {
                            txtContent.Text        = item.Content;
                            ctlAudit.CreatedByUser = item.CreatedByUserName;
                            ctlAudit.CreatedDate   = item.CreatedDate.ToLongDateString();
                        }
                        else
                        {
                            Response.Redirect(Globals.NavigateURL(), true);
                        }
                    }
                    else
                    {
                        cmdDelete.Visible = false;
                        ctlAudit.Visible  = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }