예제 #1
0
 protected override void ResetPersonalizationBlob(WebPartManager webPartManager, string path, string userName)
 {
     if (userName != null)
     {
         if (userName.IndexOf('\\') >= 0)
         {
             userName = userName.Substring(userName.IndexOf('\\') + 1);
         }
     }
     try
     {
         SqlProcs.spUSER_PREFERENCES_DeleteByUser(userName, path);
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
     }
 }
예제 #2
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Terminology.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spTERMINOLOGY_Delete(gID);
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     //SqlProcs.spTERMINOLOGY_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
예제 #3
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Documents.Create":
                    Response.Redirect("~/Documents/edit.aspx?PARENT_ID=" + gID.ToString());
                    break;

                case "Documents.Edit":
                {
                    Guid gDOCUMENT_ID = Sql.ToGuid(e.CommandArgument);
                    Response.Redirect("~/Documents/view.aspx?ID=" + gDOCUMENT_ID.ToString());
                    break;
                }

                case "Documents.Remove":
                {
                    Guid gDOCUMENT_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spCONTRACTS_DOCUMENTS_Delete(gID, gDOCUMENT_ID);
                    Response.Redirect("view.aspx?ID=" + gID.ToString());
                    break;
                }

                case "Documents.GetLatest":
                {
                    Guid gDOCUMENT_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spCONTRACTS_DOCUMENTS_GetLatest(gID, gDOCUMENT_ID);
                    Response.Redirect("view.aspx?ID=" + gID.ToString());
                    break;
                }

                default:
                    throw(new Exception("Unknown command: " + e.CommandName));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                lblError.Text = ex.Message;
            }
        }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "NewRecord")
     {
         reqNAME.Enabled       = true;
         reqTIME_START.Enabled = true;
         reqNAME.Validate();
         reqTIME_START.Validate();
         if (Page.IsValid)
         {
             Guid gID = Guid.Empty;
             try
             {
                 // 02/28/2006 Paul.  The easiest way to parse the two separate date/time fields is to combine the text.
                 DateTime dtDATE_START = T10n.ToServerTime(Sql.ToDateTime(ctlDATE_START.DateText + " " + txtTIME_START.Text));
                 if (radScheduleCall.Checked)
                 {
                     SqlProcs.spCALLS_New(ref gID, txtNAME.Text, dtDATE_START);
                 }
                 else
                 {
                     SqlProcs.spMEETINGS_New(ref gID, txtNAME.Text, dtDATE_START);
                 }
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                 lblError.Text = ex.Message;
             }
             if (!Sql.IsEmptyGuid(gID))
             {
                 if (radScheduleCall.Checked)
                 {
                     Response.Redirect("~/Calls/view.aspx?ID=" + gID.ToString());
                 }
                 else
                 {
                     Response.Redirect("~/Meetings/view.aspx?ID=" + gID.ToString());
                 }
             }
         }
     }
 }
예제 #5
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Import")
                {
                    reqNAME.Enabled = true;
                    reqNAME.Validate();
                    reqFILENAME.Enabled = true;
                    reqFILENAME.Validate();
                    if (Page.IsValid)
                    {
                        HttpPostedFile pstIMPORT = fileIMPORT.PostedFile;
                        if (pstIMPORT != null)
                        {
                            if (pstIMPORT.FileName.Length > 0)
                            {
                                string sFILENAME       = Path.GetFileName(pstIMPORT.FileName);
                                string sFILE_EXT       = Path.GetExtension(sFILENAME);
                                string sFILE_MIME_TYPE = pstIMPORT.ContentType;

                                RdlDocument rdl = new RdlDocument();
                                rdl.Load(pstIMPORT.InputStream);
                                rdl.SetSingleNodeAttribute(rdl.DocumentElement, "Name", txtNAME.Text);
                                // 10/22/2007 Paul.  Use the Assigned User ID field when saving the record.
                                Guid gID = Guid.Empty;
                                SqlProcs.spREPORTS_Update(ref gID, Sql.ToGuid(txtASSIGNED_USER_ID.Value), txtNAME.Text, lstMODULE.SelectedValue, lstREPORT_TYPE.SelectedValue, rdl.OuterXml);
                            }
                        }
                        Response.Redirect("default.aspx");
                    }
                }
                else if (e.CommandName == "Cancel")
                {
                    Response.Redirect("default.aspx");
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                ctlImportButtons.ErrorText = ex.Message;
            }
        }
 public static void InsertHelp(string sPathName, bool bForceUTF8)
 {
     try
     {
         const string         sDocType     = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
         string               sModuleName  = GetModuleName(sPathName);
         string               sLang        = GetLanguage(sPathName);
         string               strEntryName = Path.GetFileName(sPathName).Split('.')[2];
         System.Text.Encoding enc          = GetEncoding(sLang);
         if (bForceUTF8)
         {
             enc = Encoding.UTF8;
         }
         using (StreamReader sr = new StreamReader(sPathName, enc, true))
         {
             string sData    = sr.ReadToEnd();
             int    nDocType = sData.IndexOf(sDocType);
             if (nDocType >= 0)
             {
                 nDocType += sDocType.Length;
             }
             else
             {
                 nDocType = sData.IndexOf("-->");
                 if (nDocType >= 0)
                 {
                     nDocType += 3;
                 }
             }
             while (sData[nDocType] == ControlChars.Cr || sData[nDocType] == ControlChars.Lf)
             {
                 nDocType++;
             }
             sData = sData.Substring(nDocType);
             Guid gID = Guid.Empty;
             SqlProcs.spTERMINOLOGY_HELP_Update(ref gID, strEntryName, sLang, sModuleName, sData);
         }
     }
     catch
     {
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx");
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spEMAILMAN_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
         else if (e.CommandName == "SendQueued")
         {
             // 12/20/2007 Paul.  Send all queued emails, regardless of send date.
             EmailUtils.SendQueued(Application, Guid.Empty, Guid.Empty, true);
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #8
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Search":
                {
                    break;
                }

                case "Roles.Edit":
                {
                    Guid gROLE_ID = Sql.ToGuid(e.CommandArgument);
                    Response.Redirect("~/Administration/ACLRoles/edit.aspx?ID=" + gROLE_ID.ToString());
                    break;
                }

                case "Roles.Remove":
                {
                    Guid gUSER_ID = Sql.ToGuid(lstUSERS.SelectedValue);
                    Guid gROLE_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spACL_ROLES_USERS_Delete(gROLE_ID, gUSER_ID);
                    // 05/03/2006 Paul.  Don't redirect so that the selected user will not change.
                    //Response.Redirect("RolesByUser.aspx");
                    // 05/03/2006 Paul.  We do have to rebind after the modification.
                    BindGrid();
                    // 12/07/2006 Paul.  We need to rebind the access view after changing the roles.
                    ctlAccessView.BindGrid();
                    break;
                }

                default:
                    throw(new Exception("Unknown command: " + e.CommandName));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
예제 #9
0
        public static void LoadFile(Guid gID, Stream stm, IDbTransaction trn)
        {
            const int BUFFER_LENGTH = 4 * 1024;

            byte[] binFILE_POINTER = new byte[16];
            // 01/20/2006 Paul.  Must include in transaction
            SqlProcs.spBUGS_ATTACHMENT_InitPointer(gID, ref binFILE_POINTER, trn);
            using (BinaryReader reader = new BinaryReader(stm))
            {
                int    nFILE_OFFSET = 0;
                byte[] binBYTES     = reader.ReadBytes(BUFFER_LENGTH);
                while (binBYTES.Length > 0)
                {
                    // 08/14/2005 Paul.  gID is used by Oracle, binFILE_POINTER is used by SQL Server.
                    SqlProcs.spBUGS_ATTACHMENT_WriteOffset(gID, binFILE_POINTER, nFILE_OFFSET, binBYTES, trn);
                    nFILE_OFFSET += binBYTES.Length;
                    binBYTES      = reader.ReadBytes(BUFFER_LENGTH);
                }
            }
        }
예제 #10
0
        protected void Page_Command(Object sender, CommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Edit")
                {
                    Response.Redirect("edit.aspx?ID=" + gID.ToString());
                }
                else if (e.CommandName == "Duplicate")
                {
                    Response.Redirect("edit.aspx?DuplicateID=" + gID.ToString());
                }
                else if (e.CommandName == "Delete")
                {
                    DbProviderFactory dbf = DbProviderFactories.GetFactory();
                    using (IDbConnection con = dbf.CreateConnection())
                    {
                        con.Open();
                        string sSQL;
                        sSQL = "select *            " + ControlChars.CrLf
                               + "  from vwCONFIG_Edit" + ControlChars.CrLf
                               + " where ID = @ID     " + ControlChars.CrLf;
                        using (IDbCommand cmd = con.CreateCommand())
                        {
                            cmd.CommandText = sSQL;
                            Sql.AddParameter(cmd, "@ID", gID);
                            string sNAME = Sql.ToString(cmd.ExecuteScalar());

                            SqlProcs.spCONFIG_Delete(gID);
                            Application.Remove("CONFIG." + sNAME);
                        }
                    }
                    Response.Redirect("default.aspx");
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                ctlDetailButtons.ErrorText = ex.Message;
            }
        }
예제 #11
0
        /*
         * public override void Initialize(string name, NameValueCollection config)
         * {
         *      // Assign the provider a default name if it doesn't have one
         *      if ( String.IsNullOrEmpty(name) )
         *              name = "SplendidPersonalizationProvider";
         *
         *      // Add a default "description" attribute to config if the
         *      // attribute doesn't exist or is empty
         *      if ( String.IsNullOrEmpty(config["description"]) )
         *      {
         *              config.Remove("description");
         *              config.Add("description", "Text file personalization provider");
         *      }
         *
         *      // Call the base class's Initialize method
         *      base.Initialize(name, config);
         * }
         */

        public static void USER_PREFERENCES_Write(Guid gID, byte[] blob, IDbTransaction trn)
        {
            using (MemoryStream stm = new MemoryStream(blob))
            {
                const int BUFFER_LENGTH   = 4 * 1024;
                byte[]    binFILE_POINTER = new byte[16];

                SqlProcs.spUSER_PREFERENCES_InitPointer(gID, ref binFILE_POINTER, trn);
                using (BinaryReader reader = new BinaryReader(stm))
                {
                    int    nFILE_OFFSET = 0;
                    byte[] binBYTES     = reader.ReadBytes(BUFFER_LENGTH);
                    while (binBYTES.Length > 0)
                    {
                        SqlProcs.spUSER_PREFERENCES_WriteOffset(gID, binFILE_POINTER, nFILE_OFFSET, binBYTES, trn);
                        nFILE_OFFSET += binBYTES.Length;
                        binBYTES      = reader.ReadBytes(BUFFER_LENGTH);
                    }
                }
            }
        }
예제 #12
0
 public static void UpdateTracker(Page pParent, string sModule, Guid gID, string sName)
 {
     // 08/21/2005 Paul.  This function is also called after a user clicks Duplicate.
     // In this scenerio, the gID will be NULL, so don't do anything.
     if (!Sql.IsEmptyGuid(gID))
     {
         SqlProcs.spTRACKER_Update(Security.USER_ID, sModule, gID, sName);
         if (pParent != null)
         {
             _controls.Header ctlHeader = pParent.FindControl("ctlHeader") as _controls.Header;
             if (ctlHeader != null)
             {
                 _controls.LastViewed ctlLastViewed = ctlHeader.FindControl("ctlLastViewed") as _controls.LastViewed;
                 if (ctlLastViewed != null)
                 {
                     ctlLastViewed.Refresh();
                 }
             }
         }
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Add")
         {
             SqlProcs.spUSERS_FEEDS_Update(Security.USER_ID, gID, 0);
             Response.Redirect("view.aspx?ID=" + gID.ToString());
         }
         else if (e.CommandName == "Delete")
         {
             SqlProcs.spUSERS_FEEDS_Delete(Security.USER_ID, gID);
             Response.Redirect("view.aspx?ID=" + gID.ToString());
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Edit")
         {
             Response.Redirect("edit.aspx?ID=" + gID.ToString());
         }
         else if (e.CommandName == "Delete")
         {
             SqlProcs.spCONTRACT_TYPES_Delete(gID);
             Cache.Remove("vwCONTRACT_TYPES_LISTBOX");
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         ctlDetailButtons.ErrorText = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Schedulers.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spSCHEDULERS_Delete(gID);
             Response.Redirect("default.aspx");
         }
         else if (e.CommandName == "Cancel")
         {
             Response.Redirect("~/Administration/default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = Server.HtmlEncode(ex.Message);
     }
 }
예제 #16
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SplendidError.SystemMessage("Log", new StackTrace(true).GetFrame(0), "Tracker image request for " + Request["identifier"]);
            Guid gID = Sql.ToGuid(Request["identifier"]);

            try
            {
                if (!Sql.IsEmptyGuid(gID))
                {
                    Guid   gTARGET_ID   = Guid.Empty;
                    string sTARGET_TYPE = string.Empty;
                    SqlProcs.spCAMPAIGN_LOG_UpdateTracker(gID, "viewed", Guid.Empty, ref gTARGET_ID, ref sTARGET_TYPE);
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
            Response.ContentType = "image/gif";
            Response.WriteFile(Request.MapPath("~/include/images/blank.gif"));
        }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            if (e.CommandName == "Save")
            {
                try
                {
                    string sUSER_PREFERENCES = Sql.ToString(Session["USER_PREFERENCES"]);
                    if (Sql.IsEmptyString(sUSER_PREFERENCES))
                    {
                        sUSER_PREFERENCES = "<xml></xml>";
                    }

                    XmlDocument xml = SplendidInit.InitUserPreferences(sUSER_PREFERENCES);
                    XmlUtil.SetSingleNode(xml, "timezone", lstTIMEZONE.SelectedValue);
                    Session["USER_SETTINGS/TIMEZONE"]          = lstTIMEZONE.SelectedValue;
                    Session["USER_SETTINGS/TIMEZONE/ORIGINAL"] = lstTIMEZONE.SelectedValue;

                    SqlProcs.spUSERS_PreferencesUpdate(Security.USER_ID, xml.OuterXml);
                    Session["USER_PREFERENCES"] = xml.OuterXml;
                }
                catch (Exception ex)
                {
                    lblError.Text = ex.Message;
                    return;
                }
                string sDefaultModule = Sql.ToString(Application["CONFIG.default_module"]);
                if (sDefaultModule.StartsWith("~"))
                {
                    Response.Redirect(sDefaultModule);
                }
                else if (!Sql.IsEmptyString(sDefaultModule))
                {
                    Response.Redirect("~/" + sDefaultModule + "/");
                }
                else
                {
                    Response.Redirect("~/Home/");
                }
            }
        }
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Save" || e.CommandName == "SaveNew")
     {
         if (Page.IsValid)
         {
             try
             {
                 // 06/02/2006 Paul.  Can't be your own parent.  Just clear parent value.
                 Guid gPARENT_ID = Sql.ToGuid(txtPARENT_ID.Value);
                 if (gPARENT_ID == gID)
                 {
                     gPARENT_ID = Guid.Empty;
                 }
                 SqlProcs.spPRODUCT_CATEGORIES_Update(
                     ref gID
                     , gPARENT_ID
                     , txtNAME.Text
                     , txtDESCRIPTION.Text
                     , Sql.ToInteger(txtLIST_ORDER.Text)
                     );
                 Cache.Remove("vwPRODUCT_CATEGORIES_LISTBOX");
             }
             catch (Exception ex)
             {
                 SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                 lblError.Text = ex.Message;
                 return;
             }
             if (e.CommandName == "SaveNew")
             {
                 Response.Redirect("edit.aspx");
             }
             else
             {
                 Response.Redirect("default.aspx");
             }
         }
     }
 }
예제 #19
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "TaxRates.Create")
         {
             Response.Redirect("edit.aspx");
         }
         else if (e.CommandName == "TaxRates.Delete")
         {
             Guid gID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spTAX_RATES_Delete(gID);
             Cache.Remove("vwTAX_RATES_LISTBOX");
             Response.Redirect("default.aspx");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Delete")
         {
             SqlProcs.spEMAILMAN_Delete(gID);
             // 12/20/2007 Paul.  Use RegisterStartupScript so that the rest of the page is rendered before the code is run.
             Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "UpdateParent", "<script type=\"text/javascript\">UpdateParent();</script>");
         }
         else if (e.CommandName == "Send")
         {
             EmailUtils.SendQueued(Application, gID, Guid.Empty, true);
             Page.ClientScript.RegisterStartupScript(System.Type.GetType("System.String"), "UpdateParent", "<script type=\"text/javascript\">UpdateParent();</script>");
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #21
0
 protected void Page_Command(Object sender, CommandEventArgs e)
 {
     if (e.CommandName == "Save")
     {
         if (Page.IsValid)
         {
             reqNAME.Enabled = true;
             reqNAME.Validate();
             if (Page.IsValid)
             {
                 Guid gID = Guid.Empty;
                 try
                 {
                     SqlProcs.spTERMINOLOGY_Update(txtNAME.Text, lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, Sql.ToInteger(txtLIST_ORDER.Text), txtDISPLAY_NAME.Text);
                     // 01/16/2006 Paul.  Update language cache.
                     if (Sql.IsEmptyString(lstLIST_NAME.SelectedValue))
                     {
                         L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                     }
                     else
                     {
                         L10N.SetTerm(lstLANGUAGE.SelectedValue, lstMODULE_NAME.SelectedValue, lstLIST_NAME.SelectedValue, txtNAME.Text, txtDISPLAY_NAME.Text);
                     }
                 }
                 catch (Exception ex)
                 {
                     SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                     ctlEditButtons.ErrorText = ex.Message;
                     return;
                 }
             }
             Response.Redirect("default.aspx");
         }
     }
     else if (e.CommandName == "Cancel")
     {
         Response.Redirect("default.aspx");
     }
 }
예제 #22
0
        public static void RefreshAllViews()
        {
            // 05/08/2007 Paul.  Keep the original procedure call so that we will get a compiler error if something changes.
            bool bIncreaseTimeout = true;

            if (!bIncreaseTimeout)
            {
                SqlProcs.spSqlRefreshAllViews();
            }
            else
            {
                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    con.Open();
                    using (IDbTransaction trn = con.BeginTransaction())
                    {
                        try
                        {
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.Transaction = trn;
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.CommandText = "spSqlRefreshAllViews";
                                // 05/08/2007 Paul.  Allow this to run until it completes.
                                cmd.CommandTimeout = 0;
                                cmd.ExecuteNonQuery();
                            }
                            trn.Commit();
                        }
                        catch (Exception ex)
                        {
                            trn.Rollback();
                            throw(new Exception(ex.Message, ex.InnerException));
                        }
                    }
                }
            }
        }
예제 #23
0
 protected override void SavePersonalizationBlob(WebPartManager webPartManager, string path, string userName, byte[] dataBlob)
 {
     if (userName != null)
     {
         if (userName.IndexOf('\\') >= 0)
         {
             userName = userName.Substring(userName.IndexOf('\\') + 1);
         }
         userName = userName.ToLower();
     }
     path = path.ToLower();
     try
     {
         DbProviderFactory dbf = DbProviderFactories.GetFactory();
         using (IDbConnection con = dbf.CreateConnection())
         {
             con.Open();
             using (IDbTransaction trn = con.BeginTransaction())
             {
                 try
                 {
                     Guid gID = Guid.Empty;
                     SqlProcs.spUSER_PREFERENCES_InsertByUser(ref gID, userName, path, trn);
                     USER_PREFERENCES_Write(gID, dataBlob, trn);
                     trn.Commit();
                 }
                 catch (Exception ex)
                 {
                     trn.Rollback();
                     throw(new Exception(ex.Message, ex.InnerException));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
     }
 }
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Search")
         {
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         // 12/14/2007 Paul.  We need to capture the sort event from the SearchView.
         else if (e.CommandName == "SortGrid")
         {
             grdMain.SetSortFields(e.CommandArgument as string[]);
         }
         else if (e.CommandName == "Feeds.Add")
         {
             Guid gFEED_ID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spUSERS_FEEDS_Update(Security.USER_ID, gFEED_ID, 0);
             Response.Redirect("default.aspx");
         }
         // 03/20/2007 Michael.  The command should be Feeds.Remove and not Feeds.Delete.
         else if (e.CommandName == "Feeds.Remove")
         {
             Guid gFEED_ID = Sql.ToGuid(e.CommandArgument);
             SqlProcs.spUSERS_FEEDS_Delete(Security.USER_ID, gFEED_ID);
             Response.Redirect("default.aspx");
         }
         else
         {
             throw(new Exception("Unknown command: " + e.CommandName));
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
         lblError.Text = ex.Message;
     }
 }
예제 #25
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                // 05/06/2007 Paul.  Allow quote creation from contact.
                case "Quotes.Create":
                {
                    Response.Redirect("~/Quotes/edit.aspx?PARENT_ID=" + gID.ToString());
                    break;
                }

                case "Quotes.Edit":
                {
                    Guid gQUOTE_ID = Sql.ToGuid(e.CommandArgument);
                    Response.Redirect("~/Quotes/edit.aspx?ID=" + gQUOTE_ID.ToString());
                    break;
                }

                case "Quotes.Remove":
                {
                    Guid gQUOTE_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spQUOTES_CONTACTS_Delete(gID, gQUOTE_ID);
                    Response.Redirect("view.aspx?ID=" + gID.ToString());
                    break;
                }

                default:
                    throw(new Exception("Unknown command: " + e.CommandName));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
예제 #26
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                Guid gID = Sql.ToGuid(e.CommandArgument);
                switch (e.CommandName)
                {
                case "Activity.Accept":  SqlProcs.spACTIVITIES_UpdateStatus(gID, Security.USER_ID, "Accept");  break;

                case "Activity.Tentative":  SqlProcs.spACTIVITIES_UpdateStatus(gID, Security.USER_ID, "Tentative");  break;

                case "Activity.Decline":  SqlProcs.spACTIVITIES_UpdateStatus(gID, Security.USER_ID, "Decline");  break;
                }
                // 08/31/2006 Paul.  Instead of redirecting, which we prefer, we are going to bind again
                // so that the THROUGH dropdown will not get reset.
                Bind();
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
예제 #27
0
 protected void Page_Command(object sender, CommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Clear")
         {
             ctlSearch.ClearForm();
             Server.Transfer("default.aspx?Advanced=" + nAdvanced.ToString());
         }
         else if (e.CommandName == "Search")
         {
             // 10/13/2005 Paul.  Make sure to clear the page index prior to applying search.
             grdMain.CurrentPageIndex = 0;
             grdMain.ApplySort();
             grdMain.DataBind();
         }
         else if (e.CommandName == "MassDelete")
         {
             string[] arrID = Request.Form.GetValues("chkMain");
             if (arrID != null)
             {
                 string sIDs = Utils.ValidateIDs(arrID);
                 sIDs = Utils.FilterByACL(m_sMODULE, "delete", arrID, "EMAIL_TEMPLATES");
                 if (!Sql.IsEmptyString(sIDs))
                 {
                     SqlProcs.spEMAIL_TEMPLATES_MassDelete(sIDs);
                     Response.Redirect("default.aspx");
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
         lblError.Text = ex.Message;
     }
 }
 /// <summary>
 /// spWORKFLOW_EVENTS_Delete
 /// </summary>
 public static void spWORKFLOW_EVENTS_Delete(HttpApplicationState Application, Guid gID)
 {
     if (HttpContext.Current != null && HttpContext.Current.Application != null)
     {
         // 12/22/2007 Paul.  By calling the SqlProcs version, we will ensure a compile-time error if the parameters change.
         SqlProcs.spWORKFLOW_EVENTS_Delete(gID);
     }
     else
     {
         DbProviderFactory dbf = DbProviderFactories.GetFactory(Application);
         using (IDbConnection con = dbf.CreateConnection())
         {
             con.Open();
             using (IDbTransaction trn = con.BeginTransaction())
             {
                 try
                 {
                     using (IDbCommand cmd = con.CreateCommand())
                     {
                         cmd.Transaction = trn;
                         cmd.CommandType = CommandType.StoredProcedure;
                         cmd.CommandText = "spWORKFLOW_EVENTS_Delete";
                         IDbDataParameter parID = Sql.AddParameter(cmd, "@ID", gID);
                         IDbDataParameter parMODIFIED_USER_ID = Sql.AddParameter(cmd, "@MODIFIED_USER_ID", Guid.Empty);
                         cmd.ExecuteNonQuery();
                     }
                     trn.Commit();
                 }
                 catch (Exception ex)
                 {
                     trn.Rollback();
                     throw(new Exception(ex.Message, ex.InnerException));
                 }
             }
         }
     }
 }
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Payments.Create":
                    Response.Redirect("~/Payments/edit.aspx?PARENT_ID=" + gID.ToString());
                    break;

                case "Payments.Edit":
                {
                    Guid gPAYMENT_ID = Sql.ToGuid(e.CommandArgument);
                    Response.Redirect("~/Payments/edit.aspx?ID=" + gPAYMENT_ID.ToString());
                    break;
                }

                case "Payments.Remove":
                {
                    // 05/26/2007 Paul.  Allow an invoice to be removed from a payment.
                    // The payment is not deleted.
                    Guid gINVOICE_PAYMENT_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spINVOICES_PAYMENTS_Delete(gINVOICE_PAYMENT_ID);
                    Response.Redirect("~/Invoices/view.aspx?ID=" + gID.ToString());
                    break;
                }

                default:
                    throw(new Exception("Unknown command: " + e.CommandName));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }
예제 #30
0
        protected void Page_Command(object sender, CommandEventArgs e)
        {
            try
            {
                switch (e.CommandName)
                {
                case "Users.Remove":
                {
                    Guid gUSER_ID = Sql.ToGuid(e.CommandArgument);
                    SqlProcs.spACL_ROLES_USERS_Delete(gID, gUSER_ID);
                    Response.Redirect("view.aspx?ID=" + gID.ToString());
                    break;
                }

                default:
                    throw(new Exception("Unknown command: " + e.CommandName));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                lblError.Text = ex.Message;
            }
        }