Exemplo n.º 1
0
        protected void btnCreate_Click(object sender, EventArgs e)
        {
            try
              {
            if (!Page.IsValid)
            {
              return;
            }

            string orgId = Request["orgid"];
            Guid organisationGuid = new Guid(orgId);
            Guid programGuid = Guid.NewGuid();

            Program program = new Program(programGuid);
            program.Name = txtName.Text;
            program.ProgramCategoryRef = cmbProgramCategory.SelectedValue;
            program.ProgramStatus = cmbProgramStatus.SelectedValue;
            program.StartDate = txtStartDate.Text;
            program.FinishDate = txtFinishDate.Text;
            program.Description = txtDescription.Text;
            program.OrganisationRef = organisationGuid;
            program.NonregisteredPartners = txtNonRegisteredPartners.Text;

            //Megyék
            ProgramRegionContainer programRegions = new ProgramRegionContainer();
            string allRegion = txtSelectedRegion.Text.IndexOf(';') > 0
                             ? txtSelectedRegion.Text.TrimEnd(';')
                             : txtSelectedRegion.Text;
            string[] regions = allRegion.Split(';');
            for (int n = 0; n < regions.Length; n++)
            {
              ProgramRegion region = new ProgramRegion(programGuid, regions[n]);
              if (!programRegions.All.Items.Contains(region))
              {
            programRegions.Add(region);
              }
            }
            program.Regions = programRegions;
            IProgramService srv = ServiceFactory.GetProgramService();
            program.LastModifiedDate = DateTime.Now;
            srv.ProgramInsert(program);
            Response.Redirect("ProgramData.aspx?progId=" + programGuid);
              }
              catch (Exception ex)
              {
            errorPanel.Exception = ex;
              }
        }
Exemplo n.º 2
0
 public virtual ProgramRegionContainer SelectChildrenByRegionOfProgram(DBGuid IDVal)
 {
     TraceCallEnterEvent.Raise();
       try
       {
     ProgramRegionContainer result;
     DataSet entitySet = m_DataContext.ndihdRegionOfProgramSelectBy(IDVal);
     result = new ProgramRegionContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }
 public virtual ProgramRegionContainer ProgramRegionSelectAll()
 {
     TraceCallEnterEvent.Raise();
       try
       {
     ProgramRegionContainer result;
     DataSet entitySet = m_DataContext.ndihdProgramRegionSelectAll();
     result = new ProgramRegionContainer(entitySet.Tables[0]);
     TraceCallReturnEvent.Raise();
     return result;
       }
       catch (Exception ex)
       {
     ExceptionManager.Publish(ex);
     TraceCallReturnEvent.Raise(false);
     throw;
       }
 }