private clsStatusCodeCourierEDI populateObj(UserControl userControl)
    {
        clsStatusCodeCourierEDI oVend = new clsStatusCodeCourierEDI();

        oVend.StatusCode = (userControl.FindControl("txtVendorName") as RadTextBox).Text;
        oVend.ActiveFlag = (userControl.FindControl("ActiveFlag") as RadButton).Checked;
        oVend.CreatedBy  = (string)(Session["userName"]);
        oVend.CreatedOn  = Convert.ToDateTime(DateTime.Now);
        oVend.UpdatedBy  = (string)(Session["userName"]);
        oVend.UpdatedOn  = Convert.ToDateTime(DateTime.Now);
        return(oVend);
    }
 protected void rgGrid_UpdateCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         UserControl             userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
         Label                   errorMsg    = (Label)userControl.FindControl("lblErrorMessage");
         clsStatusCodeCourierEDI oVend       = populateObj(userControl);
         oVend.idStatusCodesCourierEDI = Convert.ToInt16((userControl.FindControl("lblShippingVendorID") as Label).Text);
         string updateMsg = "";
         if (IsValid)
         {
             if (oVend != null)
             {
                 updateMsg = SrvStatusCodeCourierEDI.UpdatetatusCode(oVend);
                 if (updateMsg == "")
                 {
                     pnlsuccess.Visible = true;
                     lblSuccess.Text    = "Successfully updated Status Code " + "'" + oVend.StatusCode + "'";
                 }
                 else
                 {
                     errorMsg.Visible = true;
                     errorMsg.Text    = updateMsg;
                     e.Canceled       = true;
                 }
             }
         }
         else
         {
             errorMsg.Visible = true;
             errorMsg.Text    = "Please enter Required fields";
             e.Canceled       = true;
         }
     }
     catch (Exception ex)
     {
         pnlDanger.Visible = true;
         lblDanger.Text    = ex.Message.ToString();
         e.Canceled        = true;
     }
 }
 protected void rgGrid_InsertCommand(object sender, GridCommandEventArgs e)
 {
     try
     {
         UserControl             userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
         Label                   errorMsg    = (Label)userControl.FindControl("lblErrorMessage");
         clsStatusCodeCourierEDI oVend       = populateObj(userControl);
         string                  insertMsg   = "";
         if (IsValid)
         {
             if (oVend != null)
             {
                 insertMsg = SrvStatusCodeCourierEDI.UpdatetatusCode(oVend);
                 if (insertMsg == "")
                 {
                     pnlsuccess.Visible = true;
                     lblSuccess.Text    = "Successfully Added New Status Code " + oVend.StatusCode;
                 }
                 else
                 {
                     errorMsg.Visible = true;
                     errorMsg.Text    = insertMsg;
                     e.Canceled       = true;
                 }
             }
         }
         else
         {
             errorMsg.Visible = true;
             errorMsg.Text    = "Please enter Required fields";
             e.Canceled       = true;
         }
     }
     catch (Exception ex)
     {
         pnlDanger.Visible = true;
         lblDanger.Text    = ex.Message.ToString();
         e.Canceled        = true;
     }
 }
Пример #4
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);
                }
            }
        }
    }