/// --------------------------------------------------------
        public void LoadRefData()
        {
            BizContactType contactType = new BizContactType();

            contactType.List();
            selContactTypeID.DataValueField = "ContactTypeID";
            selContactTypeID.DataTextField  = "ContactTypeID";
            selContactTypeID.DataSource     = contactType;
            selContactTypeID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selContactTypeID.Items);

            BizContactStatus contactStatus = new BizContactStatus();

            contactStatus.List();
            selContactStatusID.DataValueField = "ContactStatusID";
            selContactStatusID.DataTextField  = "ContactStatusID";
            selContactStatusID.DataSource     = contactStatus;
            selContactStatusID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selContactStatusID.Items);

            BizCompany company = new BizCompany();

            company.List();
            selCompanyID.DataValueField = "CompanyID";
            selCompanyID.DataTextField  = "CompanyID";
            selCompanyID.DataSource     = company;
            selCompanyID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selCompanyID.Items);
        }
        //========================================================
        //Page event handlers
        //========================================================

        /// --------------------------------------------------------
        private void Page_Load(object sender, System.EventArgs e)
        {
            // do site security
            DoSecurity();

            // get id from querystring
            _selectedCompanyID = DesignedNet.Framework.Web.Common.GetID(Request.QueryString, "CompanyID");
            if (_selectedCompanyID < 1)
            {
                _selectedCompanyID = DesignedNet.Framework.Web.Common.GetID(ViewState, "CompanyID");
            }

            // populate list control
            _companyList = new BizCompany();
            _companyList.List();
            list.DataSource = _companyList;

            // decide page mode
            _company       = new BizCompany();
            _company.Table = _companyList.Table;
            if (_selectedCompanyID > 0)
            {
                // load selected
                if (_company.Find(_selectedCompanyID))
                {
                    edit.DataSource = _company;
                    view.DataSource = _company;
                    if (!Page.IsPostBack)
                    {
                        Render(Common.PageMode.View);
                    }
                }
                else                 // user not found
                {
                    Render(Common.PageMode.Error, "The item selected was not found in the database!");
                }
            }
            else
            {
                if (!Page.IsPostBack)
                {
                    Render(Common.PageMode.New);
                }
            }
        }
예제 #3
0
        /// --------------------------------------------------------
        public void LoadRefData()
        {
            BizCommentType commentType = new BizCommentType();

            commentType.List();
            selCommentTypeID.DataValueField = "CommentTypeID";
            selCommentTypeID.DataTextField  = "CommentTypeID";
            selCommentTypeID.DataSource     = commentType;
            selCommentTypeID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selCommentTypeID.Items);

            BizProject project = new BizProject();

            project.List();
            selProjectID.DataValueField = "ProjectID";
            selProjectID.DataTextField  = "ProjectID";
            selProjectID.DataSource     = project;
            selProjectID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selProjectID.Items);

            BizCompany company = new BizCompany();

            company.List();
            selCompanyID.DataValueField = "CompanyID";
            selCompanyID.DataTextField  = "CompanyID";
            selCompanyID.DataSource     = company;
            selCompanyID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selCompanyID.Items);

            BizContact contact = new BizContact();

            contact.List();
            selContactID.DataValueField = "ContactID";
            selContactID.DataTextField  = "ContactID";
            selContactID.DataSource     = contact;
            selContactID.DataBind();
            DesignedNet.Framework.Web.Common.CreateSelectOneItem(selContactID.Items);
        }