Exemplo n.º 1
0
    protected void UpdateControls(clsEDIRecipReq qEDIRecipReq)
    {
        comboBxFileFormat214.SelectedValue      = qEDIRecipReq.idFileType.ToString();
        comboxCommunicationMethod.SelectedValue = (qEDIRecipReq.idCommunicationMethod == 0)? "1" : qEDIRecipReq.idCommunicationMethod.ToString();
        comboxTriggerMechanism.SelectedValue    = qEDIRecipReq.idTriggerMechanism.ToString();
        comboxTiming.SelectedValue = qEDIRecipReq.idTiming.ToString();

        if (Params.ct == UserControlParams.CourierType.CourierEDI)
        {
            List <clsStatusCodeAll> qStatusCode = SrvStatusCodeAll.GetStatusCodesAllByID(qEDIRecipReq.idEDIRecipReqs, SHIPMENT_STATUS_COURIER_EDI);
            foreach (RadComboBoxItem rad in comboxStatusCodes.Items)
            {
                var q = qStatusCode.Where(p => p.idStatusCodes == int.Parse(rad.Value)).FirstOrDefault();
                if (q != null)
                {
                    rad.Checked = true;
                }
                else
                {
                    rad.Checked = false;
                }
            }
        }
        else if (Params.ct == UserControlParams.CourierType.NonCourierEDI)
        {
            List <clsStatusCodeAll> qStatusCode = SrvStatusCodeAll.GetStatusCodesAllByID(qEDIRecipReq.idEDIRecipReqs, SHIPMENT_STATUS_NON_COURIER_EDI);
            foreach (RadComboBoxItem rad in comboxStatusCodes.Items)
            {
                var q = qStatusCode.Where(p => p.idStatusCodes == int.Parse(rad.Value)).FirstOrDefault();
                if (q != null)
                {
                    rad.Checked = true;
                }
                else
                {
                    rad.Checked = false;
                }
            }
        }

        txtBoxISA.Text         = qEDIRecipReq.X12_ISA;
        txtBoxGS.Text          = qEDIRecipReq.X12_GS;
        txtBoxQualifier.Text   = qEDIRecipReq.X12_Qualifier;
        textBoxFTPAddress.Text = qEDIRecipReq.FTPAddress;
        textBoxUserName.Text   = qEDIRecipReq.UserName;
        textBoxPassword.Text   = qEDIRecipReq.Password;
        textBoxFolderPath.Text = qEDIRecipReq.FolderPath;
        textBoxEmail.Text      = qEDIRecipReq.Email;
        TimeSpan?ts = new TimeSpan(qEDIRecipReq.TimeOfFile.Value.Hour, qEDIRecipReq.TimeOfFile.Value.Minute, 0);

        timeTimeofFile.SelectedTime = ts;

        if (bool.Parse(ConfigurationManager.AppSettings["debug"]))
        {
            txtBoxMultiDebug2.Text +=
                "UpdateControls- " +
                RadPanelBar1.Items[0].Text + ": " +
                comboxCommunicationMethod.SelectedText.ToString() + ": " +
                comboxCommunicationMethod.SelectedValue.ToString() + "\r\n";
        }
        return;
    }
Exemplo n.º 2
0
    private void Save()
    {
        int iFileformat  = int.Parse(comboBxFileFormat214.SelectedValue);
        int iCommMethod  = int.Parse(comboxCommunicationMethod.SelectedValue);
        int iTriggerMech = int.Parse(comboxTriggerMechanism.SelectedValue);
        int iTiming      = int.Parse(comboxTiming.SelectedValue);

        clsEDIRecipReq qEDIRecipReq = SrvEDIRecipReq.GetEDIRecipReqsByID(Params.idEDIRecipReqs);

        qEDIRecipReq.idFileType            = iFileformat;
        qEDIRecipReq.X12_ISA               = txtBoxISA.Text;
        qEDIRecipReq.X12_GS                = txtBoxGS.Text;
        qEDIRecipReq.X12_Qualifier         = txtBoxQualifier.Text;
        qEDIRecipReq.idCommunicationMethod = iCommMethod;
        qEDIRecipReq.FTPAddress            = textBoxFTPAddress.Text;
        qEDIRecipReq.UserName              = textBoxUserName.Text;
        qEDIRecipReq.Password              = textBoxPassword.Text;
        qEDIRecipReq.FolderPath            = textBoxFolderPath.Text;
        qEDIRecipReq.Email = textBoxEmail.Text;
        qEDIRecipReq.idTriggerMechanism = iTriggerMech;
        qEDIRecipReq.idTiming           = iTiming;

        TimeSpan?ts = timeTimeofFile.SelectedTime;

        qEDIRecipReq.TimeOfFile    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, ts.Value.Hours, ts.Value.Minutes, 0);
        qEDIRecipReq.PanelTitle    = textBoxPanelTitle.Text;
        RadPanelBar1.Items[0].Text = qEDIRecipReq.PanelTitle;
        qEDIRecipReq.UpdatedBy     = Session["userName"].ToString();
        qEDIRecipReq.UpdatedOn     = DateTime.Now;
        SrvEDIRecipReq.Insert(qEDIRecipReq);
        int idStatusCodesAll = 0;

        if (Params.ct == UserControlParams.CourierType.CourierEDI)
        {
            foreach (RadComboBoxItem rad in comboxStatusCodes.Items)
            {
                clsStatusCodeCourierEDI cEDI = SrvStatusCodeCourierEDI.GetStatusCodes().Where(p => p.idStatusCodesCourierEDI == int.Parse(rad.Value.ToString())).FirstOrDefault();
                if (rad.Checked)
                {
                    SrvStatusCodeAll.UpdatetatusCodeAll(new clsStatusCodeAll()
                    {
                        idStatusCodesAll = idStatusCodesAll, idEDIRecipReqs = qEDIRecipReq.idEDIRecipReqs, idStatusCodes = int.Parse(rad.Value.ToString()), StatusCode = cEDI.StatusCode, idEDITranscationType = SHIPMENT_STATUS_COURIER_EDI, CreatedBy = qEDIRecipReq.UpdatedBy, CreatedOn = DateTime.Now
                    });
                }
                else
                {
                    SrvStatusCodeAll.Remove(qEDIRecipReq.idEDIRecipReqs, SHIPMENT_STATUS_COURIER_EDI, cEDI.idStatusCodesCourierEDI);
                }
            }
        }
        else if (Params.ct == UserControlParams.CourierType.NonCourierEDI)
        {
            foreach (RadComboBoxItem rad in comboxStatusCodes.Items)
            {
                clsStatusCodeNonCourierEDI cEDI = SrvStatusCodeNonCourierEDI.GetStatusCodes().Where(p => p.idStatusCodesNonCourierEDI == int.Parse(rad.Value)).FirstOrDefault();
                if (rad.Checked)
                {
                    SrvStatusCodeAll.UpdatetatusCodeAll(new clsStatusCodeAll()
                    {
                        idStatusCodesAll = idStatusCodesAll, idEDIRecipReqs = qEDIRecipReq.idEDIRecipReqs, idStatusCodes = int.Parse(rad.Value.ToString()), StatusCode = cEDI.StatusCode, idEDITranscationType = SHIPMENT_STATUS_NON_COURIER_EDI, CreatedBy = qEDIRecipReq.UpdatedBy, CreatedOn = DateTime.Now
                    });
                }
                else
                {
                    SrvStatusCodeAll.Remove(qEDIRecipReq.idEDIRecipReqs, SHIPMENT_STATUS_NON_COURIER_EDI, cEDI.idStatusCodesNonCourierEDI);
                }
            }
        }
    }