Пример #1
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            this.EnableViewState = true;

            // Load additional form
            LoadAddFormControl();

            string field = Request.QueryString["field"];
            List <ICaisisInputControl> cicList = CICHelper.GetCaisisInputControls(addFormControl);
            bool isNotesField = false;

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic.Field == field)
                {
                    Page.ClientScript.RegisterStartupScript(typeof(Page), "FocusOnField", "document.getElementById('" + (cic as Control).ClientID + "').focus();", true);
                    if (cic is CaisisTextArea)
                    {
                        isNotesField = true;
                        break;
                    }
                }
            }
            // If editing a TextArea, only show that field
            // else show all non-textarea fields
            foreach (ICaisisInputControl cic in cicList)
            {
                if (isNotesField)
                {
                    cic.Visible = cic.Field == field;
                }
                else
                {
                    cic.Visible = !(cic is CaisisTextArea);
                }
            }

            // Only need to populate form is record exits
            if (!string.IsNullOrEmpty(ProjectId))
            {
                int projectId = int.Parse(ProjectId);
                //ProjectLetterOfIntent biz = new ProjectLetterOfIntent();
                //biz.GetByParent(projectId);
                //if (biz.RecordCount > 0)

                ProjectLetterOfIntent biz = BusinessObject.GetByParent <ProjectLetterOfIntent>(projectId).First();
                if (!biz.IsEmpty)
                {
                    loiId = int.Parse(biz[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString());
                    if (!Page.IsPostBack)
                    {
                        addFormControl.Populate(loiId);
                    }
                }
            }
        }
Пример #2
0
        protected override void Page_Load(object sender, EventArgs e)
        {
            base.Page_Load(sender, e);
            this.EnableViewState = true;
            if (!string.IsNullOrEmpty(ProjectId))
            {
                projectId = Int32.Parse(ProjectId);
                //ProjectLetterOfIntent biz = new ProjectLetterOfIntent();
                //biz.GetByParent(projectId);
                //if (biz.RecordCount <= 0)
                //    return;

                var lois = BusinessObject.GetByParent <ProjectLetterOfIntent>(projectId);

                if (lois.Count() == 0)
                {
                    return;
                }

                ProjectLetterOfIntent biz = lois.First();

                if (!string.IsNullOrEmpty(Request.QueryString["field"]))
                {
                    //LOIField.Field = Request.QueryString["field"];
                    strLOIField = Request.QueryString["field"];

                    if (!IsPostBack)
                    {
                        LOIField.Text = biz[strLOIField].ToString();
                    }
                }

                string strControlName = Request.QueryString["ControlName"];
                if (!String.IsNullOrEmpty(strControlName))
                {
                    addFormControl = (ProjectMgmtAddFormBaseControl)LoadControl(this.ResolveUrl("Controls//" + strControlName));

                    DynamicControlHolder.Controls.Add(addFormControl);

                    int loiId = Int32.Parse(biz[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString());

                    if (!IsPostBack)
                    {
                        addFormControl.Populate(loiId);
                    }
                }
            }
        }