Exemplo n.º 1
0
    protected void btnEditCMS_Click(object sender, EventArgs e)
    {
        try {
            var   DC         = new DataClassesDataContext();
            tblCM strEditCMS = (from obj in DC.tblCMs
                                where obj.CMSID == Convert.ToInt32(ddCMSList.SelectedValue)
                                select obj).Single();
            strEditCMS.Title   = txtTitle.Text;
            strEditCMS.Content = txtCkEditor.Text;
            //strEditCMS.ModifyOn = DateTime.Now;
            DC.SubmitChanges();
            Response.Redirect("CMSPage.aspx");
        }

        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }
Exemplo n.º 2
0
    protected void btnSaveCMS_Click(object sender, EventArgs e)
    {
        try {
            var   DC     = new DataClassesDataContext();
            tblCM tblCMS = new tblCM();
            tblCMS.Title   = txtTitle.Text;
            tblCMS.Content = txtCkEditor.Text;
            //tblCMS.CreatedBY = 101;
            //tblCMS.CreatedOn = DateTime.Now;
            tblCMS.IsActive = true;
            DC.tblCMs.InsertOnSubmit(tblCMS);
            DC.SubmitChanges();
            Response.Redirect("CMSPage.aspx");
        }

        catch (Exception ex)
        {
            int    session    = Convert.ToInt32(Session["AdminID"].ToString());
            string PageName   = System.IO.Path.GetFileName(Request.Url.AbsolutePath);
            string MACAddress = GetMacAddress();
            AddErrorLog(ref ex, PageName, "Admin", 0, session, MACAddress);
            ClientScript.RegisterStartupScript(GetType(), "abc", "alert('Something went wrong! Try again');", true);
        }
    }