コード例 #1
0
 public void setEntity(SupplierSurveyContacts entity)
 {
     contact = entity;
     if (entity != null)
     {
         txtName.Text    = entity.Name;
         txtTitle.Text   = entity.Title;
         txtAddress.Text = entity.Address;
         txtPhone.Text   = entity.Phone;
         txtCell.Text    = entity.Cell;
         txtEmail.Text   = entity.Email;
     }
     else
     {
         contact = new SupplierSurveyContacts();
     }
     Session["SurveyQualityContact"] = contact;
 }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     contact = (SupplierSurveyContacts)Session["SurveyQualityContact"];
 }
コード例 #3
0
ファイル: surveyForm.ascx.cs プロジェクト: Capsonic/APQM
    public bool save()
    {
        SupplierSurvey survey = new SupplierSurvey();

        survey.SupplierMasterKey = supplier.Id;
        survey.StreetAddress     = txtAddress.Text;
        survey.City       = txtCity.Text;
        survey.State      = txtState.Text;
        survey.ZipCode    = txtZip.Text;
        survey.Website    = txtWebsite.Text;
        survey.LastSurvey = DateTime.Now;
        if (lblNDARec.Text.Trim() != "")
        {
            survey.NDARec = DateTime.Parse(lblNDARec.Text);
        }
        survey.PrimaryBusiness        = txtPrimaryBusiness.Text;
        survey.SecundaryBusiness      = txtSecundaryBusiness.Text;
        survey.UnionYN                = radUnion.Checked;
        survey.Local                  = txtLocal.Text;
        survey.ContractExpiration     = txtContractExpiration.Text;
        survey.CurrentCapacity        = txtCurrentCapacity.Text;
        survey.ManufacturingMetod     = txtManufacturingMethod.Text;
        survey.ToolingNewInHouseYN    = chkNewInHouseManufacture.Checked;
        survey.ToolingNewOutsourcedYN = chkNewOutsourced.Checked;
        survey.ToolingInHouseYN       = chkRepairInHouse.Checked;
        survey.ToolingOutsourcedYN    = chkRepairOutsource.Checked;
        survey.Notes                  = txtNotes.Text;

        ConnectionManager CM = new ConnectionManager();

        Data_Base_MNG.SQL DM = CM.getDataManager();

        /*Begin Transaction*/
        DM.Open_Connection("Survey Save");


        certification_CRUD.deleteByParentId(supplier.SupplierSurvey.Id, ref DM);
        foreach (SupplierSurveyCertification certification in supplier.SupplierSurvey.Certifications)
        {
            certification.SupplierSurveyKey = supplier.SupplierSurvey.Id;
            certification_CRUD.create(certification, ref DM);
        }
        industries_CRUD.deleteByParentId(supplier.SupplierSurvey.Id, ref DM);
        foreach (SupplierSurveyIndustriesSupplied industrie in supplier.SupplierSurvey.IndustriesSupplied)
        {
            industrie.SupplierSurveyKey = supplier.SupplierSurvey.Id;
            industries_CRUD.create(industrie, ref DM);
        }
        forecast_CRUD.deleteByParentId(supplier.SupplierSurvey.Id, ref DM);
        foreach (SupplierSurveyForecastSales forecastSale in supplier.SupplierSurvey.ForecastSales)
        {
            forecast_CRUD.create(forecastSale, ref DM);
        }
        SupplierSurveyContacts executive = uscContactExecutive.getEntity();

        executive.SupplierSurveyKey = supplier.SupplierSurvey.Id;
        if (supplier.SupplierSurvey.ContactExecutive != null)
        {
            contacts_CRUD.update(executive, ref DM);
        }
        else
        {
            contacts_CRUD.create(executive, ref DM);
        }
        SupplierSurveyContacts sales = uscContactSales.getEntity();

        sales.SupplierSurveyKey = supplier.SupplierSurvey.Id;
        if (supplier.SupplierSurvey.ContactSales != null)
        {
            contacts_CRUD.update(sales, ref DM);
        }
        else
        {
            contacts_CRUD.create(sales, ref DM);
        }
        SupplierSurveyContacts quality = uscContactQuality.getEntity();

        quality.SupplierSurveyKey = supplier.SupplierSurvey.Id;
        if (supplier.SupplierSurvey.ContactQuality != null)
        {
            contacts_CRUD.update(quality, ref DM);
        }
        else
        {
            contacts_CRUD.create(quality, ref DM);
        }
        SupplierSurveyContacts support = uscContactCustomerSupport.getEntity();

        support.SupplierSurveyKey = supplier.SupplierSurvey.Id;
        if (supplier.SupplierSurvey.ContactCustomerSupport != null)
        {
            contacts_CRUD.update(support, ref DM);
        }
        else
        {
            contacts_CRUD.create(support, ref DM);
        }
        SupplierSurveyContacts afterHours = uscContactAfterHours.getEntity();

        afterHours.SupplierSurveyKey = supplier.SupplierSurvey.Id;
        if (supplier.SupplierSurvey.ContactAfterHoursContact != null)
        {
            contacts_CRUD.update(afterHours, ref DM);
        }
        else
        {
            contacts_CRUD.create(afterHours, ref DM);
        }
        if (lblMode.Text == "New")
        {
            if (!survey_CRUD.create(survey, ref DM))
            {
                Navigator.goToPage("~/Error.aspx", "ERROR:" + survey_CRUD.ErrorMessage);
                return(false);
            }
            //else
            //{
            //    BOM bom = new BOM();
            //    bom.SifId = 21;
            //    bomCRUD bomCrud = new bomCRUD();
            //    if (!bomCrud.create(bom))
            //    {
            //        Navigator.goToPage("~/Error.aspx","");
            //    }
            //}
        }
        else if (lblMode.Text == "Update")
        {
            survey.Id = long.Parse(lblID.Text);
            if (!survey_CRUD.update(survey, ref DM))
            {
                Navigator.goToPage("~/Error.aspx", "ERROR:" + survey_CRUD.ErrorMessage);
                return(false);
            }
        }

        DM.CommitTransaction();
        DM.Close_Open_Connection();

        if (DM.ErrorOccur)
        {
            Navigator.goToPage("~/Error.aspx", "ERROR:" + DM.Error_Mjs);
            return(false);
        }

        return(true);
    }