コード例 #1
0
        protected void Save(int letterOfIntentId, string strDiseaseState)
        {
            ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            biz.Get(letterOfIntentId);
            // Only want to save fields that are visible, as non visible fields don't retain their original set values
            List <ICaisisInputControl> cicList = CICHelper.GetCaisisInputControls(this.FindControl("MainTable"));

            foreach (ICaisisInputControl cic in cicList)
            {
                if (cic.Visible)
                {
                    if (cic is CaisisCheckBox)
                    {
                        if ((cic as CaisisCheckBox).Checked)
                        {
                            biz[cic.Field] = "1";
                        }
                        else
                        {
                            biz[cic.Field] = "0";
                        }
                    }
                    else
                    {
                        biz[cic.Field] = cic.Value;
                    }
                }
            }

            biz[ProjectLetterOfIntent.PopulationDiseaseState] = strDiseaseState;

            biz.Save();
        }
コード例 #2
0
 private void SaveLargeFields()
 {
     // Verify that projectid and loi id exist
     if (!string.IsNullOrEmpty(LetterOfIntentId) && !string.IsNullOrEmpty(ProjectId))
     {
         int projectId = int.Parse(ProjectId);
         // Load LOI Record
         ProjectLetterOfIntent biz = new ProjectLetterOfIntent();
         biz.Get(int.Parse(LetterOfIntentId));
         // Save Updated Details
         CICHelper.SetBOValues(this.Controls, biz, projectId);
         biz.Save();
     }
 }
コード例 #3
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();
                }
            }
        }
コード例 #4
0
        private void SaveLOI()
        {
            // Verify that projectid and loi id exist
            if (!string.IsNullOrEmpty(ProjectApprovalId) && !string.IsNullOrEmpty(ProjectId))
            {
                int projectId = int.Parse(ProjectId);
                // Load LOI Record
                ProjectLetterOfIntent biz = new ProjectLetterOfIntent();
                biz.Get(int.Parse(ProjectApprovalId));
                // Save Updated Details
                CICHelper.SetBOValues(this.Controls, biz, projectId);

                DiseaseState disState = (DiseaseState)this.FindControl("DiseaseStateEditor");
                if (disState != null)
                {
                    biz[ProjectLetterOfIntent.PopulationDiseaseState] = disState.GetAllCheckedDiseaseStates();
                }

                biz.Save();
            }
        }
コード例 #5
0
        protected void BtnSave_Click(object sender, ImageClickEventArgs e)
        {
            if (LOIField.Text.Length > MAX_FIELD_LENGTH)
            {
                labelErrMsg.Visible = true;
                labelErrMsg.Text    = "The field length is limited to " + MAX_FIELD_LENGTH + ". Current field length is " + LOIField.Text.Length.ToString();
                return;
            }
            else
            {
                labelErrMsg.Visible = false;
            }

            //ProjectLetterOfIntent biz = new ProjectLetterOfIntent();

            if (projectId == -1 && !string.IsNullOrEmpty(strLOIField))
            {
                return;
            }

            //biz.GetByParent(projectId);

            ProjectLetterOfIntent biz = BusinessObject.GetByParent <ProjectLetterOfIntent>(projectId).First();

            biz[strLOIField] = LOIField.Text;

            biz.Save();

            if (addFormControl != null)
            {
                int loiId = int.Parse(biz[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString());
                addFormControl.Save(loiId);
            }

            RefreshMainList();
        }
コード例 #6
0
        protected void OnCreateNewProjectClick(object sender, EventArgs e)
        {
            // Create New Biz Object
            Project biz = new Project();
            // Verify required fields
            bool fieldsValid = !string.IsNullOrEmpty(ProjectTitle.Value) && !string.IsNullOrEmpty(ProjectType.Value);

            // If fields are valid, proceed with update/insert
            if (fieldsValid)
            {
                bool isInsert = true;
                // Load Project records if working with existing projectid
                if (!string.IsNullOrEmpty(ProjectId))
                {
                    biz.Get(int.Parse(ProjectId));
                    isInsert = false;
                }

                // Populate and Save Biz
                CICHelper.SetBOValues(this.Controls, biz, 0);

                if (String.IsNullOrEmpty(biz[Project.ProjectNum].ToString()))
                {
                    ProjectManagementDa projDA = new ProjectManagementDa();
                    biz[Project.ProjectNum] = projDA.GetIDForProject();
                }

                biz[Project.AdditionalFormNames] = IncludeFormRadioList.SelectedValue;

                biz.Save();

                // Create child records if needed
                string projId = biz[Project.ProjectId].ToString();
                int    priKey = int.Parse(projId);
                if (isInsert)
                {
                    //ProjectMgmtUtil.CreateProjectChildRecords(priKey);
                }
                // Load/Create LOI Record if needed
                string loiId = string.Empty;
                //if (LetterOfIntent.Checked)
                if (IncludeFormRadioList.SelectedValue == "Letter Of Intent")
                {
                    //ProjectLetterOfIntent letter = new ProjectLetterOfIntent();
                    //letter.GetByParent(priKey);
                    //if (letter.RecordCount == 0)
                    //{
                    //    letter[ProjectLetterOfIntent.ProjectId] = projId;
                    //    letter[ProjectLetterOfIntent.CreationDate] = DateTime.Now;

                    //    ProjectManagementDa projDA = new ProjectManagementDa();
                    //    letter[ProjectLetterOfIntent.LOINumber] = projDA.GetIDForLOI();
                    //    letter.Save();
                    //}
                    //loiId = letter[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();

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

                    if (!BusinessObject.Exists <ProjectLetterOfIntent>(criteria))
                    {
                        ProjectLetterOfIntent letter = new ProjectLetterOfIntent();
                        letter[ProjectLetterOfIntent.ProjectId]    = projId;
                        letter[ProjectLetterOfIntent.CreationDate] = DateTime.Now;

                        ProjectManagementDa projDA = new ProjectManagementDa();
                        letter[ProjectLetterOfIntent.LOINumber] = projDA.GetIDForLOI();
                        letter.Save();

                        loiId = letter[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();
                    }
                    else
                    {
                        var letters = BusinessObject.GetByParent <ProjectLetterOfIntent>(priKey);
                        loiId = letters.First()[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();
                    }
                }

                // Load/Create ProjectApproval Record if needed
                string projectApprovalId = string.Empty;
                //if (FormNeedsApprovalStep(ProjectType.Value))
                if (IncludeFormRadioList.SelectedValue == "Project Proposal")
                {
                    //ProjectLetterOfIntent letter = new ProjectLetterOfIntent();
                    //letter.GetByParent(priKey);
                    //if (letter.RecordCount == 0)
                    //{
                    //    letter[ProjectLetterOfIntent.ProjectId] = projId;
                    //    letter[ProjectLetterOfIntent.CreationDate] = DateTime.Now;
                    //    letter.Save();
                    //}
                    //projectApprovalId = letter[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();

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

                    if (!BusinessObject.Exists <ProjectLetterOfIntent>(criteria))
                    {
                        ProjectLetterOfIntent letter = new ProjectLetterOfIntent();
                        letter[ProjectLetterOfIntent.ProjectId]    = projId;
                        letter[ProjectLetterOfIntent.CreationDate] = DateTime.Now;
                        letter.Save();

                        projectApprovalId = letter[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();
                    }
                    else
                    {
                        var letters = BusinessObject.GetByParent <ProjectLetterOfIntent>(priKey);
                        projectApprovalId = letters.First()[ProjectLetterOfIntent.ProjectLetterOfIntentId].ToString();
                    }
                }
                TransferToNextStep(projId, loiId, projectApprovalId);
            }
        }