private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    lstSTATUS.DataSource = SplendidCache.List("test_plan_status_dom");
                    lstSTATUS.DataBind();
                    lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstTEST_PLAN_TYPE.DataSource = SplendidCache.List("test_plan_type_dom");
                    lstTEST_PLAN_TYPE.DataBind();
                    lstTEST_PLAN_TYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
                    lstASSIGNED_USER_ID.DataBind();
                    lstASSIGNED_USER_ID.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    lstPAYMENT_TERMS.DataSource = SplendidCache.List("payment_terms_dom");
                    lstPAYMENT_TERMS.DataBind();
                    lstPAYMENT_TERMS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstINVOICE_STAGE.DataSource = SplendidCache.List("invoice_stage_dom");
                    lstINVOICE_STAGE.DataBind();
                    lstINVOICE_STAGE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
        }
Beispiel #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 09/09/2006 Paul.  Visibility is already controlled by the ASPX page,
            // but since this control is used on the home page, we need to apply the module specific rules.
            // 11/05/2007 Paul.  Don't show panel if it was manually hidden.
            this.Visible = this.Visible && (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0);
            // 09/09/2007 Paul.  We are having trouble dynamically adding user controls to the WebPartZone.
            // Instead, control visibility manually here.  This approach as the added benefit of hiding the
            // control even if the WebPartManager has moved it to an alternate zone.
            if (this.Visible && !Sql.IsEmptyString(sDetailView))
            {
                // 01/17/2008 Paul.  We need to use the sDetailView property and not the hard-coded view name.
                DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView));
                vwFields.RowFilter = "CONTROL_NAME = '~/Activities/MyActivities'";
                this.Visible       = vwFields.Count > 0;
            }
            if (!this.Visible)
            {
                return;
            }

            if (!IsPostBack)
            {
                lstTHROUGH.DataSource = SplendidCache.List("appointment_filter_dom");
                lstTHROUGH.DataBind();
            }
            Bind();
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    // 05/01/2007 Paul.  Fix list name for OPPORTUNITY_TYPE.
                    lstOPPORTUNITY_TYPE.DataSource = SplendidCache.List("opportunity_type_dom");
                    lstOPPORTUNITY_TYPE.DataBind();
                    lstOPPORTUNITY_TYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstLEAD_SOURCE.DataSource = SplendidCache.List("lead_source_dom");
                    lstLEAD_SOURCE.DataBind();
                    lstLEAD_SOURCE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstSALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom");
                    lstSALES_STAGE.DataBind();
                    lstSALES_STAGE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
        }
Beispiel #5
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 06/04/2006 Paul.  NewRecord should not be displayed if the user does not have edit rights.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!this.Visible)
            {
                return;
            }

            // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
            //this.DataBind();  // Need to bind so that Text of the Button gets updated.
            // 03/04/2006 Paul.  LBL_LIST_CAMPAIGN_NAME does not have a colon at the end.
            reqNAME.ErrorMessage     = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Campaigns.LBL_LIST_CAMPAIGN_NAME") + "<br>";
            reqEND_DATE.ErrorMessage = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Campaigns.LBL_LIST_END_DATE") + "<br>";
            // 08/31/2006 Paul.  Need to bind the text.
            valEND_DATE.ErrorMessage = L10n.Term(".ERR_INVALID_DATE") + "<br>";

            if (!this.IsPostBack)
            {
                lstSTATUS.DataSource = SplendidCache.List("campaign_status_dom");
                lstSTATUS.DataBind();
                lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                lstCAMPAIGN_TYPE.DataSource = SplendidCache.List("campaign_type_dom");
                lstCAMPAIGN_TYPE.DataBind();
                lstCAMPAIGN_TYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
            }
        }
Beispiel #6
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstSALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom");
         lstSALES_STAGE.DataBind();
         lstUSERS.DataSource = SplendidCache.ActiveUsers();
         lstUSERS.DataBind();
         // 09/14/2005 Paul.  Default to today, and all sales stages.
         foreach (ListItem item in lstSALES_STAGE.Items)
         {
             item.Selected = true;
         }
         foreach (ListItem item in lstUSERS.Items)
         {
             item.Selected = true;
         }
         // 07/09/2006 Paul.  The date is passed as TimeZone time, so convert from server time.
         ctlDATE_START.Value = T10n.FromServerTime(DateTime.Today);
         ctlDATE_END.Value   = T10n.FromServerTime(new DateTime(2100, 1, 1));
         // 09/15/2005 Paul.  Maintain the pipeline query string separately so that we can respond to specific submit requests
         // and ignore all other control events on the page.
         ViewState["PipelineBySalesStageQueryString"] = PipelineQueryString();
     }
 }
Beispiel #7
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                lstRESOLUTION.DataSource = SplendidCache.List("bug_resolution_dom");
                lstRESOLUTION.DataBind();
                lstRESOLUTION.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));

                lstRELEASE.DataSource = SplendidCache.Release();
                lstRELEASE.DataBind();
                lstRELEASE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));

                lstSTATUS.DataSource = SplendidCache.List("bug_status_dom");
                lstSTATUS.DataBind();
                lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));

                lstTYPE.DataSource = SplendidCache.List("bug_type_dom");
                lstTYPE.DataBind();
                lstTYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));

                lstPRIORITY.DataSource = SplendidCache.List("bug_priority_dom");
                lstPRIORITY.DataBind();
                lstPRIORITY.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
                lstASSIGNED_USER_ID.DataBind();
                // 06/03/2004 Paul.  A Multiple-line ListBox does not need a NULL entry.
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    lstSTATUS.DataSource = SplendidCache.List("product_status_dom");
                    lstSTATUS.DataBind();
                    lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstTAX_CLASS.DataSource = SplendidCache.List("tax_class_dom");
                    lstTAX_CLASS.DataBind();
                    lstTAX_CLASS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstSUPPORT_TERM.DataSource = SplendidCache.List("support_term_dom");
                    lstSUPPORT_TERM.DataBind();
                    lstSUPPORT_TERM.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 06/04/2006 Paul.  NewRecord should not be displayed if the user does not have edit rights.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!this.Visible)
            {
                return;
            }

            // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
            //this.DataBind();  // Bind so that the text of the validators get updated.
            reqNAME.ErrorMessage        = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Opportunities.LBL_LIST_OPPORTUNITY_NAME") + "<br>";
            reqDATE_CLOSED.ErrorMessage = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Opportunities.LBL_LIST_DATE_CLOSED") + "<br>";
            reqAMOUNT.ErrorMessage      = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Opportunities.LBL_LIST_AMOUNT") + "<br>";
            reqACCOUNT_ID.ErrorMessage  = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Opportunities.LBL_LIST_ACCOUNT_NAME") + "<br>";
            // 08/31/2006 Paul.  Need to bind the text.
            valDATE_CLOSED.ErrorMessage = L10n.Term(".ERR_INVALID_DATE") + "<br>";
            if (!IsPostBack)
            {
                lblDATEFORMAT.Text = "(" + Session["USER_SETTINGS/DATEFORMAT"] + ")";

                lstSALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom");
                lstSALES_STAGE.DataBind();
            }
        }
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstTHROUGH.DataSource = SplendidCache.List("appointment_filter_dom");
         lstTHROUGH.DataBind();
     }
     Bind();
 }
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstSTATUS.DataSource = SplendidCache.List("user_status_dom");
         lstSTATUS.DataBind();
         lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
     }
 }
Beispiel #12
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstLEAD_SOURCE.DataSource = SplendidCache.List("lead_source_dom");
         lstLEAD_SOURCE.DataBind();
         lstLEAD_SOURCE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
     }
 }
 protected void grdMain_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         DropDownList lstTAX_CLASS = e.Row.FindControl("TAX_CLASS") as DropDownList;
         if (lstTAX_CLASS != null)
         {
             lstTAX_CLASS.DataSource = SplendidCache.List("tax_class_dom");
         }
     }
 }
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstCATEGORY_ID.DataSource = SplendidCache.List("document_category_dom");
         lstCATEGORY_ID.DataBind();
         lstCATEGORY_ID.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstSUBCATEGORY_ID.DataSource = SplendidCache.List("document_subcategory_dom");
         lstSUBCATEGORY_ID.DataBind();
         lstSUBCATEGORY_ID.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
     }
 }
Beispiel #15
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstLEAD_SOURCE.DataSource = SplendidCache.List("lead_source_dom");
         lstLEAD_SOURCE.DataBind();
         lstLEAD_SOURCE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
         lstASSIGNED_USER_ID.DataBind();
         // 06/03/2004 Paul.  A Multiple-line ListBox does not need a NULL entry.
     }
 }
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstSTATUS.DataSource = SplendidCache.List("campaign_status_dom");
         lstSTATUS.DataBind();
         lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstCAMPAIGN_TYPE.DataSource = SplendidCache.List("campaign_type_dom");
         lstCAMPAIGN_TYPE.DataBind();
         lstCAMPAIGN_TYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
         lstASSIGNED_USER_ID.DataBind();
     }
 }
Beispiel #17
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstINDUSTRY.DataSource = SplendidCache.List("industry_dom");
         lstINDUSTRY.DataBind();
         lstINDUSTRY.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstACCOUNT_TYPE.DataSource = SplendidCache.List("account_type_dom");
         lstACCOUNT_TYPE.DataBind();
         lstACCOUNT_TYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
         lstASSIGNED_USER_ID.DataBind();
         // 06/03/2004 Paul.  A Multiple-line ListBox does not need a NULL entry.
     }
 }
 private void Page_Load(object sender, System.EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             lstSTATUS.DataSource = SplendidCache.List("release_status_dom");
             lstSTATUS.DataBind();
             lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         }
     }
     catch (Exception ex)
     {
         SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
     }
 }
Beispiel #19
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 06/04/2006 Paul.  NewRecord should not be displayed if the user does not have edit rights.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!this.Visible)
            {
                return;
            }

            // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
            //this.DataBind();  // Need to bind so that Text of the Button gets updated.
            reqNAME.ErrorMessage = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Bugs.LBL_LIST_SUBJECT") + "<br>";
            if (!IsPostBack)
            {
                lstPRIORITY.DataSource = SplendidCache.List("bug_priority_dom");
                // 03/30/2006 Paul.  IBM DB2 is having a problem returning lists.
                // This is causing a Page.DataBind() error, so only bind if the list is not null.
                if (lstPRIORITY.DataSource != null)
                {
                    lstPRIORITY.DataBind();
                    try
                    {
                        // Set default value for priority.
                        // 07/16/2005 Paul.  Setting the default value is not working.
                        lstPRIORITY.SelectedValue = "Medium";
                    }
                    catch (Exception ex)
                    {
                        SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), ex);
                    }
                }
                lstTYPE.DataSource = SplendidCache.List("bug_type_dom");
                lstTYPE.DataBind();
                // 07/16/2005 Paul.  Items.Insert is not working (but not failing).  Use manually if table is empty.
                DataTable dtRelease = SplendidCache.Release();
                if (dtRelease.Rows.Count > 0)
                {
                    lstRELEASE.DataSource = dtRelease;
                    lstRELEASE.DataBind();
                }
                else
                {
                    lstRELEASE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
        }
Beispiel #20
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstSTATUS.DataSource = SplendidCache.List("contract_status_dom");
         lstSTATUS.DataBind();
         lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstTAX_CLASS.DataSource = SplendidCache.List("tax_class_dom");
         lstTAX_CLASS.DataBind();
         lstTAX_CLASS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstMANUFACTURER.DataSource = SplendidCache.Manufacturers();
         lstMANUFACTURER.DataBind();
         lstMANUFACTURER.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstTYPE.DataSource = SplendidCache.ProductTypes();
         lstTYPE.DataBind();
         lstTYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
     }
 }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 06/04/2006 Paul.  NewRecord should not be displayed if the user does not have edit rights.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!this.Visible)
            {
                return;
            }

            // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
            //this.DataBind();  // Bind so that the text of the validators get updated.
            reqNAME.ErrorMessage       = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Quotes.LBL_LIST_NAME") + "<br>";
            reqACCOUNT_ID.ErrorMessage = L10n.Term(".ERR_MISSING_REQUIRED_FIELDS") + " " + L10n.Term("Quotes.LBL_LIST_ACCOUNT_NAME") + "<br>";
            if (!IsPostBack)
            {
                lstQUOTE_STAGE.DataSource = SplendidCache.List("quote_stage_dom");
                lstQUOTE_STAGE.DataBind();
            }
        }
Beispiel #22
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SetPageTitle(L10n.Term(m_sMODULE + ".LBL_LIST_FORM_TITLE"));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0);
            if (!this.Visible)
            {
                return;
            }

            reqNAME.DataBind();
            reqFILENAME.DataBind();
            try
            {
                if (!IsPostBack)
                {
                    txtASSIGNED_TO.Text           = Security.USER_NAME;
                    txtASSIGNED_USER_ID.Value     = Security.USER_ID.ToString();
                    ViewState["ASSIGNED_USER_ID"] = txtASSIGNED_USER_ID.Value;
                    lstMODULE.DataSource          = SplendidCache.ReportingModules();
                    lstMODULE.DataBind();
                    lstREPORT_TYPE.DataSource = SplendidCache.List("dom_report_types");
                    lstREPORT_TYPE.DataBind();
                    try
                    {
                        lstREPORT_TYPE.SelectedValue = "Freeform";
                    }
                    catch
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                ctlImportButtons.ErrorText = ex.Message;
            }
            if (!IsPostBack)
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();
            }
        }
Beispiel #23
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    lstPARENT_TYPE.DataSource = SplendidCache.List("record_type_display");
                    lstPARENT_TYPE.DataBind();
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            // 11/05/2007 Paul.  Don't show panel if it was manually hidden.
            this.Visible = this.Visible && (SplendidCRM.Security.GetUserAccess(m_sMODULE, "list") >= 0);
            // 09/09/2007 Paul.  We are having trouble dynamically adding user controls to the WebPartZone.
            // Instead, control visibility manually here.  This approach as the added benefit of hiding the
            // control even if the WebPartManager has moved it to an alternate zone.
            if (this.Visible && this.Visible && !Sql.IsEmptyString(sDetailView))
            {
                // 01/17/2008 Paul.  We need to use the sDetailView property and not the hard-coded view name.
                DataView vwFields = new DataView(SplendidCache.DetailViewRelationships(sDetailView));
                vwFields.RowFilter = "CONTROL_NAME = '~/Opportunities/MyPipeline'";
                this.Visible       = vwFields.Count > 0;
            }
            if (!this.Visible)
            {
                return;
            }

            valDATE_START.ErrorMessage = L10n.Term(".ERR_INVALID_DATE");
            valDATE_END.ErrorMessage   = L10n.Term(".ERR_INVALID_DATE");
            if (!IsPostBack)
            {
                lstSALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom");
                lstSALES_STAGE.DataBind();
                // 09/14/2005 Paul.  Default to today, and all sales stages.
                foreach (ListItem item in lstSALES_STAGE.Items)
                {
                    item.Selected = true;
                }
                // 07/09/2006 Paul.  The date is passed in TimeZone time, so convert from server time.
                ctlDATE_START.Value = T10n.FromServerTime(DateTime.Today);
                ctlDATE_END.Value   = T10n.FromServerTime(new DateTime(2100, 1, 1));
                // 09/15/2005 Paul.  Maintain the pipeline query string separately so that we can respond to specific submit requests
                // and ignore all other control events on the page.
                ViewState["MyPipelineQueryString"] = PipelineQueryString();
            }
        }
Beispiel #25
0
 private void Page_Load(object sender, System.EventArgs e)
 {
     if (!IsPostBack)
     {
         lstLEAD_SOURCE.DataSource = SplendidCache.List("lead_source_dom");
         lstLEAD_SOURCE.DataBind();
         lstLEAD_SOURCE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
         lstUSERS.DataSource = SplendidCache.ActiveUsers();
         lstUSERS.DataBind();
         // 09/14/2005 Paul.  Default to today, and all leads.
         foreach (ListItem item in lstLEAD_SOURCE.Items)
         {
             item.Selected = true;
         }
         foreach (ListItem item in lstUSERS.Items)
         {
             item.Selected = true;
         }
         // 09/15/2005 Paul.  Maintain the pipeline query string separately so that we can respond to specific submit requests
         // and ignore all other control events on the page.
         ViewState["OppByLeadSourceByOutcomeQueryString"] = PipelineQueryString();
     }
 }
Beispiel #26
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    // 06/02/2006 Paul.  Buttons should be hidden if the user does not have access.
                    int nACLACCESS_Delete = Security.GetUserAccess(m_sMODULE, "delete");
                    int nACLACCESS_Edit   = Security.GetUserAccess(m_sMODULE, "edit");
                    btnDelete.Visible = (nACLACCESS_Delete >= 0);
                    btnUpdate.Visible = (nACLACCESS_Edit >= 0);

                    lstSTATUS.DataSource = SplendidCache.List("bug_status_dom");
                    lstSTATUS.DataBind();
                    lstSTATUS.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstPRIORITY.DataSource = SplendidCache.List("bug_priority_dom");
                    lstPRIORITY.DataBind();
                    lstPRIORITY.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstRESOLUTION.DataSource = SplendidCache.List("bug_resolution_dom");
                    lstRESOLUTION.DataBind();
                    lstRESOLUTION.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstTYPE.DataSource = SplendidCache.List("bug_type_dom");
                    lstTYPE.DataBind();
                    lstTYPE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstSOURCE.DataSource = SplendidCache.List("source_dom");
                    lstSOURCE.DataBind();
                    lstSOURCE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstPRODUCT_CATEGORY.DataSource = SplendidCache.List("product_category_dom");
                    lstPRODUCT_CATEGORY.DataBind();
                    lstPRODUCT_CATEGORY.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = (SplendidCRM.Security.GetUserAccess(m_sMODULE, "edit") >= 0);
            if (!this.Visible)
            {
                return;
            }

            try
            {
                // 01/21/2006 Paul.  If there is an error sending the email, we want to make sure to reuse the ID,
                // otherwise multiple emails get created as the user tries to resend.
                gID = Sql.ToGuid(ViewState["ID"]);
                if (Sql.IsEmptyGuid(gID))
                {
                    gID = Sql.ToGuid(Request["ID"]);
                }
                if (!IsPostBack)
                {
                    sEMAIL_TYPE = Sql.ToString(Request["TYPE"]).ToLower();
                    if (sEMAIL_TYPE != "archived")
                    {
                        sEMAIL_TYPE = "draft";
                    }
                    ctlEditButtons.Visible  = !PrintView && (sEMAIL_TYPE != "draft");
                    ctlEmailButtons.Visible = !PrintView && (sEMAIL_TYPE == "draft");

                    if (Sql.IsEmptyGuid(gID))
                    {
                        ctlModuleHeader.EnableModuleLabel = false;
                        if (sEMAIL_TYPE == "archived")
                        {
                            ctlModuleHeader.Title = L10n.Term("Emails.LBL_ARCHIVED_MODULE_NAME") + ":";
                        }
                        else
                        {
                            ctlModuleHeader.Title = L10n.Term("Emails.LBL_COMPOSE_MODULE_NAME") + ":";
                        }
                        // 04/16/2006 Paul.  The subject is not required.
                        //lblNAME_REQUIRED .Visible = (sEMAIL_TYPE == "archived");
                        //reqNAME.Enabled          =  lblNAME_REQUIRED.Visible;
                        ctlDATE_START.Visible              = (sEMAIL_TYPE == "archived");
                        spnDATE_START.Visible              = ctlDATE_START.Visible;
                        spnTEMPLATE_LABEL.Visible          = (sEMAIL_TYPE == "draft");
                        lstEMAIL_TEMPLATE.Visible          = spnTEMPLATE_LABEL.Visible;
                        trNOTE_SEMICOLON.Visible           = (sEMAIL_TYPE == "draft");
                        trFROM.Visible                     = !trNOTE_SEMICOLON.Visible;
                        ViewState["TYPE"]                  = sEMAIL_TYPE;
                        ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;
                    }

                    lstASSIGNED_USER_ID.DataSource = SplendidCache.AssignedUser();
                    lstASSIGNED_USER_ID.DataBind();
                    lstASSIGNED_USER_ID.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    lstPARENT_TYPE.DataSource = SplendidCache.List("record_type_display");
                    lstPARENT_TYPE.DataBind();
                    if (lstEMAIL_TEMPLATE.Visible)
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            sSQL = "select *                     " + ControlChars.CrLf
                                   + "  from vwEMAIL_TEMPLATES_List" + ControlChars.CrLf
                                   + " order by NAME               " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                using (DbDataAdapter da = dbf.CreateDataAdapter())
                                {
                                    ((IDbDataAdapter)da).SelectCommand = cmd;
                                    using (DataTable dt = new DataTable())
                                    {
                                        da.Fill(dt);
                                        lstEMAIL_TEMPLATE.DataSource = dt.DefaultView;
                                        lstEMAIL_TEMPLATE.DataBind();
                                        lstEMAIL_TEMPLATE.Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                                    }
                                }
                            }
                        }
                    }
                    // 07/29/2005 Paul.  SugarCRM 3.0 does not allow the NONE option.
                    //lstPARENT_TYPE     .Items.Insert(0, new ListItem(L10n.Term(".LBL_NONE"), ""));
                    Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]);
                    if (!Sql.IsEmptyGuid(gID) || !Sql.IsEmptyGuid(gDuplicateID))
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            sSQL = "select *            " + ControlChars.CrLf
                                   + "  from vwEMAILS_Edit" + ControlChars.CrLf
                                   + " where ID = @ID     " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                if (!Sql.IsEmptyGuid(gDuplicateID))
                                {
                                    Sql.AddParameter(cmd, "@ID", gDuplicateID);
                                    gID = Guid.Empty;
                                }
                                else
                                {
                                    Sql.AddParameter(cmd, "@ID", gID);
                                }
                                con.Open();
#if DEBUG
                                Page.RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
#endif
                                using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                                {
                                    if (rdr.Read())
                                    {
                                        ctlModuleHeader.Title += Sql.ToString(rdr["NAME"]);
                                        Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                                        Utils.UpdateTracker(Page, m_sMODULE, gID, ctlModuleHeader.Title);
                                        ViewState["ctlModuleHeader.Title"] = ctlModuleHeader.Title;
                                        ViewState["ID"] = gID;

                                        txtNAME.Text        = Sql.ToString(rdr["NAME"]);
                                        ctlDATE_START.Value = T10n.FromServerTime(rdr["DATE_START"]);
                                        txtPARENT_ID.Value  = Sql.ToString(rdr["PARENT_ID"]);
                                        txtPARENT_NAME.Text = Sql.ToString(rdr["PARENT_NAME"]);
                                        txtFROM_NAME.Value  = Sql.ToString(rdr["FROM_NAME"]);
                                        txtFROM_ADDR.Text   = Sql.ToString(rdr["FROM_ADDR"]);

                                        txtTO_ADDRS.Text          = Sql.ToString(rdr["TO_ADDRS"]);
                                        txtCC_ADDRS.Text          = Sql.ToString(rdr["CC_ADDRS"]);
                                        txtBCC_ADDRS.Text         = Sql.ToString(rdr["BCC_ADDRS"]);
                                        txtTO_ADDRS_IDS.Value     = Sql.ToString(rdr["TO_ADDRS_IDS"]);
                                        txtTO_ADDRS_NAMES.Value   = Sql.ToString(rdr["TO_ADDRS_NAMES"]);
                                        txtTO_ADDRS_EMAILS.Value  = Sql.ToString(rdr["TO_ADDRS_EMAILS"]);
                                        txtCC_ADDRS_IDS.Value     = Sql.ToString(rdr["CC_ADDRS_IDS"]);
                                        txtCC_ADDRS_NAMES.Value   = Sql.ToString(rdr["CC_ADDRS_NAMES"]);
                                        txtCC_ADDRS_EMAILS.Value  = Sql.ToString(rdr["CC_ADDRS_EMAILS"]);
                                        txtBCC_ADDRS_IDS.Value    = Sql.ToString(rdr["BCC_ADDRS_IDS"]);
                                        txtBCC_ADDRS_NAMES.Value  = Sql.ToString(rdr["BCC_ADDRS_NAMES"]);
                                        txtBCC_ADDRS_EMAILS.Value = Sql.ToString(rdr["BCC_ADDRS_EMAILS"]);

                                        // 04/16/2006 Paul.  Since the Plug-in saves body in DESCRIPTION, we need to continue to use it as the primary source of data.
                                        txtDESCRIPTION.Value = Sql.ToString(rdr["DESCRIPTION"]);
                                        try
                                        {
                                            lstPARENT_TYPE.SelectedValue = Sql.ToString(rdr["PARENT_TYPE"]);
                                        }
                                        catch (Exception ex)
                                        {
                                            SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), ex.Message);
                                        }
                                        try
                                        {
                                            lstASSIGNED_USER_ID.SelectedValue = Sql.ToString(rdr["ASSIGNED_USER_ID"]);
                                        }
                                        catch (Exception ex)
                                        {
                                            SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), ex.Message);
                                        }
                                        // 11/17/2005 Paul.  Archived emails allow editing of the Date & Time Sent.
                                        sEMAIL_TYPE = Sql.ToString(rdr["TYPE"]).ToLower();
                                        switch (sEMAIL_TYPE)
                                        {
                                        case "archived":
                                            ctlModuleHeader.Title = L10n.Term("Emails.LBL_ARCHIVED_MODULE_NAME") + ":" + txtNAME.Text;
                                            break;

                                        case "out":
                                            ctlModuleHeader.Title = L10n.Term("Emails.LBL_LIST_FORM_SENT_TITLE") + ":" + txtNAME.Text;
                                            break;

                                        default:
                                            sEMAIL_TYPE           = "draft";
                                            ctlModuleHeader.Title = L10n.Term("Emails.LBL_COMPOSE_MODULE_NAME") + ":" + txtNAME.Text;
                                            break;
                                        }
                                        if (sEMAIL_TYPE == "out")
                                        {
                                            // 01/21/2006 Paul.  Editing is not allowed for sent emails.
                                            Response.Redirect("view.aspx?ID=" + gID.ToString());
                                            return;
                                        }
                                        // 04/16/2006 Paul.  The subject is not required.
                                        //lblNAME_REQUIRED .Visible = (sEMAIL_TYPE == "archived");
                                        //reqNAME.Enabled = lblNAME_REQUIRED.Visible;
                                        ctlDATE_START.Visible             = (sEMAIL_TYPE == "archived");
                                        spnDATE_START.Visible             = ctlDATE_START.Visible;
                                        spnTEMPLATE_LABEL.Visible         = (sEMAIL_TYPE == "draft");
                                        lstEMAIL_TEMPLATE.Visible         = spnTEMPLATE_LABEL.Visible;
                                        trNOTE_SEMICOLON.Visible          = (sEMAIL_TYPE == "draft");
                                        trFROM.Visible                    = !trNOTE_SEMICOLON.Visible;
                                        ctlModuleHeader.EnableModuleLabel = false;

                                        ctlEditButtons.Visible  = !PrintView && (sEMAIL_TYPE != "draft");
                                        ctlEmailButtons.Visible = !PrintView && (sEMAIL_TYPE == "draft");
                                        ViewState["TYPE"]       = sEMAIL_TYPE;
                                    }
                                }
                            }
                            sSQL = "select *                   " + ControlChars.CrLf
                                   + "  from vwEMAILS_Attachments" + ControlChars.CrLf
                                   + " where EMAIL_ID = @EMAIL_ID" + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                Sql.AddParameter(cmd, "@EMAIL_ID", gID);
#if DEBUG
                                Page.RegisterClientScriptBlock("vwEMAILS_Attachments", Sql.ClientScriptBlock(cmd));
#endif
                                using (DbDataAdapter da = dbf.CreateDataAdapter())
                                {
                                    ((IDbDataAdapter)da).SelectCommand = cmd;
                                    using (DataTable dt = new DataTable())
                                    {
                                        da.Fill(dt);
                                        ctlAttachments.DataSource = dt.DefaultView;
                                        ctlAttachments.DataBind();
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Guid gPARENT_ID = Sql.ToGuid(Request["PARENT_ID"]);
                        if (!Sql.IsEmptyGuid(gPARENT_ID))
                        {
                            string sMODULE      = String.Empty;
                            string sPARENT_TYPE = String.Empty;
                            string sPARENT_NAME = String.Empty;
                            SqlProcs.spPARENT_Get(ref gPARENT_ID, ref sMODULE, ref sPARENT_TYPE, ref sPARENT_NAME);
                            if (!Sql.IsEmptyGuid(gPARENT_ID))
                            {
                                txtPARENT_ID.Value  = gPARENT_ID.ToString();
                                txtPARENT_NAME.Text = sPARENT_NAME;
                                try
                                {
                                    lstPARENT_TYPE.SelectedValue = sPARENT_TYPE;
                                }
                                catch (Exception ex)
                                {
                                    SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), ex.Message);
                                }
                                // 08/05/2006 Paul.  When an email is composed from a Lead, automatically set the To address.
                                DbProviderFactory dbf = DbProviderFactories.GetFactory();
                                using (IDbConnection con = dbf.CreateConnection())
                                {
                                    string sSQL;
                                    sSQL = "select EMAIL1      " + ControlChars.CrLf
                                           + "  from vwLEADS_Edit" + ControlChars.CrLf
                                           + " where ID = @ID    " + ControlChars.CrLf;
                                    using (IDbCommand cmd = con.CreateCommand())
                                    {
                                        cmd.CommandText = sSQL;
                                        Sql.AddParameter(cmd, "@ID", gPARENT_ID);
                                        con.Open();
#if DEBUG
                                        Page.RegisterClientScriptBlock("vwLEADS_Edit", Sql.ClientScriptBlock(cmd));
#endif
                                        using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                                        {
                                            if (rdr.Read())
                                            {
                                                txtTO_ADDRS.Text = Sql.ToString(rdr["EMAIL1"]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        try
                        {
                            lstASSIGNED_USER_ID.SelectedValue = Security.USER_ID.ToString();
                        }
                        catch (Exception ex)
                        {
                            SplendidError.SystemWarning(new StackTrace(true).GetFrame(0), ex.Message);
                        }
                    }
                }
                else
                {
                    // 12/02/2005 Paul.  When validation fails, the header title does not retain its value.  Update manually.
                    ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]);
                    Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                    sEMAIL_TYPE = Sql.ToString(ViewState["TYPE"]);
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                ctlEditButtons.ErrorText  = ex.Message;
                ctlEmailButtons.ErrorText = ex.Message;
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                gID = Sql.ToGuid(Request["ID"]);
                Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE));
                if (!IsPostBack)
                {
                    lblDATEFORMAT.Text = "(" + Session["USER_SETTINGS/DATEFORMAT"] + ")";
                    lstOPPORTUNITY_SALES_STAGE.DataSource = SplendidCache.List("sales_stage_dom");
                    lstOPPORTUNITY_SALES_STAGE.DataBind();

                    chkCreateAccount.Attributes.Add("onclick", "return ToggleCreateAccount();");
                    chkCreateOpportunity.Attributes.Add("onclick", "return toggleDisplay('divCreateOpportunity');");
                    chkCreateAppointment.Attributes.Add("onclick", "return toggleDisplay('divCreateAppointment');");

                    Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]);
                    if (!Sql.IsEmptyGuid(gID) || !Sql.IsEmptyGuid(gDuplicateID))
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            sSQL = "select *              " + ControlChars.CrLf
                                   + "  from vwLEADS_Convert" + ControlChars.CrLf
                                   + " where ID = @ID       " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                if (!Sql.IsEmptyGuid(gDuplicateID))
                                {
                                    Sql.AddParameter(cmd, "@ID", gDuplicateID);
                                    gID = Guid.Empty;
                                }
                                else
                                {
                                    Sql.AddParameter(cmd, "@ID", gID);
                                }
                                con.Open();
#if DEBUG
                                Page.RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
#endif
                                using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                                {
                                    if (rdr.Read())
                                    {
                                        ctlModuleHeader.Title = L10n.Term("Leads.LBL_CONVERTLEAD");
                                        Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);

                                        txtACCOUNT_NAME.Text       = Sql.ToString(rdr["ACCOUNT_NAME"]);
                                        txtACCOUNT_PHONE_WORK.Text = Sql.ToString(rdr["PHONE_WORK"]);
                                        // 01/31/2006 Paul.  Default start date and time is now.
                                        ctlAPPOINTMENT_DATE_START.Value = T10n.FromServerTime(DateTime.Now);
                                        txtAPPOINTMENT_TIME_START.Text  = T10n.FromServerTime(DateTime.Now).ToShortTimeString();

                                        this.AppendEditViewFields(m_sMODULE + ".ConvertView", tblMain, rdr);
                                        // 01/31/2006 Paul.  Save all data to be used later.
                                        for (int i = 0; i < rdr.FieldCount; i++)
                                        {
                                            ViewState[rdr.GetName(i)] = rdr.GetValue(i);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        this.AppendEditViewFields(m_sMODULE + ".ConvertView", tblMain, null);
                    }
                }
                else
                {
                    // 12/02/2005 Paul.  When validation fails, the header title does not retain its value.  Update manually.
                    ctlModuleHeader.Title = L10n.Term("Leads.LBL_CONVERTLEAD");
                    Utils.SetPageTitle(Page, L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                ctlEditButtons.ErrorText = ex.Message;
            }
        }
Beispiel #29
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utils.SetPageTitle(Page, L10n.Term("Shippers.LBL_NAME"));
            // 06/04/2006 Paul.  Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load.
            this.Visible = SplendidCRM.Security.IS_ADMIN;
            if (!this.Visible)
            {
                return;
            }

            try
            {
                // 06/09/2006 Paul.  Remove data binding in the user controls.  Binding is required, but only do so in the ASPX pages.
                //Page.DataBind();  // 09/03/2005 Paul. DataBind is required in order for the RequiredFieldValidators to work.
                // 07/02/2006 Paul.  The required fields need to be bound manually.
                reqNAME.DataBind();
                reqLIST_ORDER.DataBind();
                gID = Sql.ToGuid(Request["ID"]);
                if (!IsPostBack)
                {
                    lstSTATUS.DataSource = SplendidCache.List("shipper_status_dom");
                    lstSTATUS.DataBind();
                    Guid gDuplicateID = Sql.ToGuid(Request["DuplicateID"]);
                    if (!Sql.IsEmptyGuid(gID))
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            sSQL = "select *         " + ControlChars.CrLf
                                   + "  from vwSHIPPERS" + ControlChars.CrLf
                                   + " where ID = @ID  " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                Sql.AddParameter(cmd, "@ID", gID);
                                con.Open();
#if DEBUG
                                Page.RegisterClientScriptBlock("SQLCode", Sql.ClientScriptBlock(cmd));
#endif
                                using (IDataReader rdr = cmd.ExecuteReader(CommandBehavior.SingleRow))
                                {
                                    if (rdr.Read())
                                    {
                                        txtNAME.Text        = Sql.ToString(rdr["NAME"]);
                                        ctlListHeader.Title = L10n.Term("Shippers.LBL_NAME") + " " + txtNAME.Text;
                                        txtLIST_ORDER.Text  = Sql.ToString(rdr["LIST_ORDER"]);
                                        try
                                        {
                                            lstSTATUS.SelectedValue = Sql.ToString(rdr["STATUS"]);
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex.Message);
                lblError.Text = ex.Message;
            }
        }
Beispiel #30
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            XmlDocument xml = new XmlDocument();

            try
            {
                Guid gID = Sql.ToGuid(Request["ID"]);
                xml.LoadXml(SplendidCache.XmlFile(Server.MapPath(Session["themeURL"] + "BarChart.xml")));
                XmlNode nodeRoot        = xml.SelectSingleNode("graphData");
                XmlNode nodeXData       = xml.CreateElement("xData");
                XmlNode nodeYData       = xml.CreateElement("yData");
                XmlNode nodeColorLegend = xml.CreateElement("colorLegend");
                XmlNode nodeGraphInfo   = xml.CreateElement("graphInfo");
                XmlNode nodeChartColors = nodeRoot.SelectSingleNode("chartColors");

                nodeRoot.InsertBefore(nodeGraphInfo, nodeChartColors);
                nodeRoot.InsertBefore(nodeColorLegend, nodeGraphInfo);
                nodeRoot.InsertBefore(nodeXData, nodeColorLegend);
                nodeRoot.InsertBefore(nodeYData, nodeXData);

                XmlUtil.SetSingleNodeAttribute(xml, nodeYData, "defaultAltText", L10n.Term("Campaigns.LBL_ROLLOVER_VIEW"));
                XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "min", "0");
                XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "max", "100");
                XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "length", "10");
                XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "prefix", "");
                XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "suffix", "");

                Hashtable         hashTARGET = new Hashtable();
                DbProviderFactory dbf        = DbProviderFactories.GetFactory();
                using (IDbConnection con = dbf.CreateConnection())
                {
                    con.Open();
                    string sSQL;
                    // 12/25/2007 Paul.  Prepopulate the activity type rows so that empty rows will appear.  The SQL query will not return empty rows.
                    DataTable dtActivityTypes     = SplendidCache.List("campainglog_activity_type_dom").Copy();
                    DataRow   rowActivityTypeNone = dtActivityTypes.NewRow();
                    dtActivityTypes.Rows.InsertAt(rowActivityTypeNone, 0);
                    rowActivityTypeNone["NAME"]         = "";
                    rowActivityTypeNone["DISPLAY_NAME"] = L10n.Term("Campaigns.NTC_NO_LEGENDS");
                    foreach (DataRow row in dtActivityTypes.Rows)
                    {
                        XmlNode nodeRow = xml.CreateElement("dataRow");
                        nodeYData.AppendChild(nodeRow);
                        XmlUtil.SetSingleNodeAttribute(xml, nodeRow, "title", Sql.ToString(row["DISPLAY_NAME"]));
                        XmlUtil.SetSingleNodeAttribute(xml, nodeRow, "endLabel", "0");
                    }

                    // 12/25/2007 Paul.  Prepopulate the targets.
                    DataTable dtLegend = SplendidCache.List("campainglog_target_type_dom");
                    XmlUtil.SetSingleNodeAttribute(xml, nodeColorLegend, "status", "on");
                    for (int i = 0; i < dtLegend.Rows.Count; i++)
                    {
                        DataRow row     = dtLegend.Rows[i];
                        string  sTARGET = Sql.ToString(row["NAME"]);
                        if (!hashTARGET.ContainsKey(sTARGET))
                        {
                            XmlNode nodeMapping = xml.CreateElement("mapping");
                            nodeColorLegend.AppendChild(nodeMapping);
                            XmlUtil.SetSingleNodeAttribute(xml, nodeMapping, "id", Sql.ToString(row["NAME"]));
                            XmlUtil.SetSingleNodeAttribute(xml, nodeMapping, "name", Sql.ToString(row["DISPLAY_NAME"]));
                            XmlUtil.SetSingleNodeAttribute(xml, nodeMapping, "color", SplendidDefaults.generate_graphcolor(String.Empty, hashTARGET.Count));
                            hashTARGET.Add(sTARGET, sTARGET);
                        }
                    }

                    sSQL = "select ACTIVITY_TYPE                         " + ControlChars.CrLf
                           + "     , TARGET_TYPE                           " + ControlChars.CrLf
                           + "     , LIST_ORDER                            " + ControlChars.CrLf
                           + "     , count(*)                  as HIT_COUNT" + ControlChars.CrLf
                           + "  from vwCAMPAIGNS_Activity                  " + ControlChars.CrLf;
                    using (IDbCommand cmd = con.CreateCommand())
                    {
                        cmd.CommandText = sSQL;
                        Security.Filter(cmd, "Campaigns", "view");
                        Sql.AppendParameter(cmd, gID, "ID", false);
                        cmd.CommandText += ""
                                           + " group by ACTIVITY_TYPE                      " + ControlChars.CrLf
                                           + "        , LIST_ORDER                         " + ControlChars.CrLf
                                           + "        , TARGET_TYPE                        " + ControlChars.CrLf
                                           + " order by LIST_ORDER                         " + ControlChars.CrLf
                                           + "        , TARGET_TYPE                        " + ControlChars.CrLf;
                        using (IDataReader rdr = cmd.ExecuteReader())
                        {
                            int nMAX_COUNT = 0;
                            while (rdr.Read())
                            {
                                string sACTIVITY_TYPE = Sql.ToString(rdr["ACTIVITY_TYPE"]);
                                string sTARGET_TYPE   = Sql.ToString(rdr["TARGET_TYPE"]);
                                int    nHIT_COUNT     = Sql.ToInteger(rdr["HIT_COUNT"]);

                                if (nHIT_COUNT > nMAX_COUNT)
                                {
                                    nMAX_COUNT = nHIT_COUNT;
                                }
                                string sACTIVITY_TYPE_TERM = String.Empty;
                                if (sACTIVITY_TYPE == String.Empty)
                                {
                                    sACTIVITY_TYPE_TERM = L10n.Term("Campaigns.NTC_NO_LEGENDS");
                                }
                                else
                                {
                                    sACTIVITY_TYPE_TERM = Sql.ToString(L10n.Term(".campainglog_activity_type_dom.", sACTIVITY_TYPE));
                                }

                                int nEND_LABEL = nHIT_COUNT;

                                XmlNode nodeRow = nodeYData.SelectSingleNode("dataRow[@title=\'" + sACTIVITY_TYPE_TERM.Replace("'", "\'") + "\']");
                                if (nodeRow == null)
                                {
                                    nodeRow = xml.CreateElement("dataRow");
                                    nodeYData.AppendChild(nodeRow);
                                    XmlUtil.SetSingleNodeAttribute(xml, nodeRow, "title", sACTIVITY_TYPE_TERM);
                                    XmlUtil.SetSingleNodeAttribute(xml, nodeRow, "endLabel", nEND_LABEL.ToString());
                                }
                                else
                                {
                                    if (nodeRow.Attributes.GetNamedItem("endLabel") != null)
                                    {
                                        nEND_LABEL  = Sql.ToInteger(nodeRow.Attributes.GetNamedItem("endLabel").Value);
                                        nEND_LABEL += nHIT_COUNT;
                                        if (nEND_LABEL > nMAX_COUNT)
                                        {
                                            nMAX_COUNT = nEND_LABEL;
                                        }
                                        XmlUtil.SetSingleNodeAttribute(xml, nodeRow, "endLabel", nEND_LABEL.ToString());
                                    }
                                }
                                XmlNode nodeBar = xml.CreateElement("bar");
                                nodeRow.AppendChild(nodeBar);

                                XmlUtil.SetSingleNodeAttribute(xml, nodeBar, "id", sTARGET_TYPE);
                                XmlUtil.SetSingleNodeAttribute(xml, nodeBar, "totalSize", nHIT_COUNT.ToString());

                                if (sACTIVITY_TYPE == "targeted")
                                {
                                    XmlUtil.SetSingleNodeAttribute(xml, nodeBar, "altText", L10n.Term("Campaigns.LBL_TARGETED") + nHIT_COUNT.ToString() + ", " + L10n.Term("Campaigns.LBL_TOTAL_TARGETED") + " " + nEND_LABEL.ToString() + ".");
                                }
                                else
                                {
                                    XmlUtil.SetSingleNodeAttribute(xml, nodeBar, "altText", nHIT_COUNT.ToString() + " " + Sql.ToString(L10n.Term(".campainglog_target_type_dom.", sTARGET_TYPE)));
                                }
                                XmlUtil.SetSingleNodeAttribute(xml, nodeBar, "url", "#ACTIVITY_TYPE=" + Server.UrlEncode(sACTIVITY_TYPE) + "&TARGET_TYPE=" + Server.UrlEncode(sTARGET_TYPE));
                            }
                            if (nMAX_COUNT < 10)
                            {
                                nMAX_COUNT = 10;
                            }
                            XmlUtil.SetSingleNodeAttribute(xml, nodeXData, "max", nMAX_COUNT.ToString());
                            XmlUtil.SetSingleNodeAttribute(xml, nodeRoot, "title", L10n.Term("Campaigns.LBL_CAMPAIGN_RESPONSE_BY_RECIPIENT_ACTIVITY"));
                        }
                    }
                }
                Response.ContentType = "text/xml";
                Response.Write(xml.OuterXml);
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                Response.Write(ex.Message);
            }
        }