Ejemplo n.º 1
0
        private bool PopulateLOINumber(ProjectLetterOfIntent biz)
        {
            if (IncludeFormRadioList.SelectedValue.CompareTo("Letter Of Intent") == 0 &&
                biz.HasField(ProjectLetterOfIntent.LOINumber) &&
                String.IsNullOrEmpty(biz[ProjectLetterOfIntent.LOINumber].ToString()))
            {
                ProjectManagementDa projDA = new ProjectManagementDa();
                biz[ProjectLetterOfIntent.LOINumber] = projDA.GetIDForLOI();

                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        private void AddNewLOIRecord()
        {
            if (IncludeFormRadioList.SelectedValue.CompareTo("None") != 0)
            {
                //ProjectLetterOfIntent biz = new ProjectLetterOfIntent();
                //biz.GetByParent(projectId);
                //if (biz.RecordCount == 0)
                //{
                //    biz.NewRow();
                //    biz[ProjectLetterOfIntent.ProjectId] = projectId;
                //    if (biz.HasColumn(ProjectLetterOfIntent.CreationDate))
                //        biz[ProjectLetterOfIntent.CreationDate] = DateTime.Now;

                //    PopulateLOINumber(biz);
                //    biz.Save();
                //}
                //else
                //{
                //    if (PopulateLOINumber(biz))
                //        biz.Save();
                //}

                var criteria = new Dictionary <string, object>()
                {
                    { ProjectLetterOfIntent.ProjectId, projectId }
                };

                ProjectLetterOfIntent biz;

                if (!BusinessObject.Exists <ProjectLetterOfIntent>(criteria))
                {
                    biz = new ProjectLetterOfIntent();
                    biz[ProjectLetterOfIntent.ProjectId] = projectId;
                    if (biz.HasField(ProjectLetterOfIntent.CreationDate))
                    {
                        biz[ProjectLetterOfIntent.CreationDate] = DateTime.Now;
                    }

                    PopulateLOINumber(biz);
                    biz.Save();
                }
                else
                {
                    biz = BusinessObject.GetByParent <ProjectLetterOfIntent>(projectId).First();
                }
            }
        }