public void Begin(UD19Model objUD19) { // assign which company BO to fire configCompany = objUD19.Company; EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(objUD19.Company, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(configPlant); if (sessionId != Guid.Empty) { UD19Add(epicorUserID, epiorUserPassword, builder, sessionId, objUD19); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void Begin(IEnumerable <PODetailSchedular> poDetail) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; //string epicorUserID = userName; //string epiorUserPassword = password; string epicorUserID = Conn.epicorUserID; string epiorUserPassword = Conn.epiorUserPassword; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; //Set company and plant string comp = "", plant = ""; var pd = poDetail.First(); comp = string.IsNullOrEmpty(pd.company) ? Conn.Company : pd.company; plant = string.IsNullOrEmpty(pd.plant) ? Conn.Plant : pd.plant; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); //UriBuilder builder = new UriBuilder(scheme, "mytp-eptstsrv01.spritzer.local"); UriBuilder builder = new UriBuilder(scheme, Conn.hostName); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; //??? try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //var pd = poDetail.First(); sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); //sessionModClient.SetPlant(pd.plant); //sessionModClient.SetPlant(configPlant); sessionModClient.SetPlant(plant); if (sessionId != Guid.Empty) { bool successFlg = true; if (pd.LANotExist && pd.LAPresent) { successFlg = CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); } if (successFlg) { ReceiptUpdate(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); } } else { LogErrorDetails("Begin", 0, "", "Sessionid is Empty!"); } } catch (Exception ex) { LogErrorDetails("Begin", 0, ex.Message.ToString(), "POReceipt->Begin"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void Begin(string Company, string DPNo, List <CustShipment> customerShipment, int custNum, int existingPackNum) { //configCompany = Conn.Company; EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = Conn.epicorUserID; string epiorUserPassword = Conn.epiorUserPassword; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string comp = "", plant = ""; comp = string.IsNullOrEmpty(customerShipment.First().Company) ? Conn.Company : customerShipment.First().Company; //plant = string.IsNullOrEmpty(customerShipment.First().Plant) ? Conn.Plant : customerShipment.First().Plant; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(Conn.Plant); if (sessionId != Guid.Empty) { // ##### TEST DATA ##### // performCustShipment(epicorUserID, epiorUserPassword, builder, sessionId, customerShipment, DPNo, custNum, existingPackNum); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
public void getSession(out string epicorUserID, out string epiorUserPassword, string comp, string plant, out UriBuilder builder, ref svcSessionMod.SessionModSvcContractClient sessionModClient) { comp = string.IsNullOrEmpty(comp) ? configCompany : comp; plant = string.IsNullOrEmpty(plant) ? configPlant : plant; EndpointBindingType bindingType = EndpointBindingType.BasicHttp; epicorUserID = userName; epiorUserPassword = password; Guid sessionId = Guid.Empty; sessionModClient = null; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(plant); if (sessionId == Guid.Empty) { throw new Exception($"Epicor Error : Sessionid is Empty!"); } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } }
public void Begin(NonConf objNonConformance) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; //AMIN Start string comp = "", plant = ""; comp = string.IsNullOrEmpty(objNonConformance.Company) ? Conn.Company : objNonConformance.Company; plant = string.IsNullOrEmpty(objNonConformance.Plant) ? Conn.Plant : objNonConformance.Plant; //AMIN End string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } UriBuilder builder = new UriBuilder(scheme, Conn.hostName); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); //** CHANGE configCompany & configPlant to read from input **// sessionModClient.SetCompany(comp, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); sessionModClient.SetPlant(plant); if (sessionId != Guid.Empty) { List <NonConf> nonConfs = new List <NonConf>(); nonConfs.Add(objNonConformance); // ##### TEST DATA ##### // //List<InvTransfer> invTransfers = new List<InvTransfer>(); //invTransfers.Add(objInvTransfer); //invTransfers.Add(new InvTransfer //{ // company = configCompany, // plant = configPlant, // id = 1, // partNum = "1-BAG-GEN-000000-002", // qty = 1, // uom = "KG", // frmWarehouse = "L05", // frmBinNum = "RS_BTL", // frmLotNum = "Lot 04", // All from details i can get from PartBin - LotNum // toWarehouse = "L09", // Default boolean value in Warehse // toBinNum = "L09", // Default boolean value in WarehseBin // toLotNum = "Lot 01" // Same as fromLotNum //}); NonConformance(epicorUserID, epiorUserPassword, builder, sessionId, nonConfs); } else { //Sessionid is Empty! } } catch (Exception ex) { throw new Exception($"Epicor Error : {ex.Message.ToString()}"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }
//public void Begin(IEnumerable<PODetail> poDetail) //{ // EndpointBindingType bindingType = EndpointBindingType.BasicHttp; // //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; // string epicorUserID = userName; // string epiorUserPassword = password; // Guid sessionId = Guid.Empty; // svcSessionMod.SessionModSvcContractClient sessionModClient = null; // string scheme = "https"; // if (bindingType == EndpointBindingType.SOAPHttp) // { // scheme = "http"; // } // //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); // UriBuilder builder = new UriBuilder(scheme, "mytp-eptstsrv01.spritzer.local"); // //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; // builder.Path = "E101Test/Ice/Lib/SessionMod.svc"; // try // { // sessionModClient = GetClient<svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> // ( // builder.Uri.ToString(), // epicorUserID, // epiorUserPassword, // bindingType // ); // string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; // string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; // sessionId = sessionModClient.Login(); // //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; // builder.Path = "E101Test/Ice/Lib/SessionMod.svc"; // sessionModClient = GetClient<svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); // sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); // var pd = poDetail.First(); // sessionModClient.SetCompany(pd.company, out siteID, out siteName, out workstationID, // out workstationDesc, out employeeID, out countryGroupCode, // out countryCode, out tenantID); // //sessionModClient.SetPlant(pd.plant); // sessionModClient.SetPlant(configPlant); // if (sessionId != Guid.Empty) // { // CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, poDetail); // } // else // { // throw new Exception("Begin | Sessionid is Empty!"); // } // } // catch (Exception ex) // { // throw new Exception("Begin | " + ex.Message.ToString() + " | LotCreation->Begin"); // } // finally // { // if (sessionId != Guid.Empty) // { // sessionModClient.Logout(); // } // } //} public void Begin(string LotNum, string Company, string Plant, string PartNum) { EndpointBindingType bindingType = EndpointBindingType.BasicHttp; //EndpointBindingType bindingType = EndpointBindingType.SOAPHttp; string epicorUserID = userName; string epiorUserPassword = password; Guid sessionId = Guid.Empty; svcSessionMod.SessionModSvcContractClient sessionModClient = null; string scheme = "https"; if (bindingType == EndpointBindingType.SOAPHttp) { scheme = "http"; } //UriBuilder builder = new UriBuilder(scheme, "serverdemo"); UriBuilder builder = new UriBuilder(scheme, Conn.hostName); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; try { sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract> ( builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType ); string siteID = "", siteName = "", workstationID = "", workstationDesc = ""; string employeeID = "", countryGroupCode = "", countryCode = "", tenantID = ""; sessionId = sessionModClient.Login(); //builder.Path = "DEMODB/Ice/Lib/SessionMod.svc"; builder.Path = $"{Conn.environment}/Ice/Lib/SessionMod.svc"; sessionModClient = GetClient <svcSessionMod.SessionModSvcContractClient, svcSessionMod.SessionModSvcContract>(builder.Uri.ToString(), epicorUserID, epiorUserPassword, bindingType); sessionModClient.Endpoint.EndpointBehaviors.Add(new HookServiceBehavior(sessionId, epicorUserID)); sessionModClient.SetCompany(Company, out siteID, out siteName, out workstationID, out workstationDesc, out employeeID, out countryGroupCode, out countryCode, out tenantID); //sessionModClient.SetPlant(Plant); sessionModClient.SetPlant(configPlant); if (sessionId != Guid.Empty) { //CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, LotNum, Company, Plant, PartNum); CreateLotAttribute(epicorUserID, epiorUserPassword, builder, sessionId, LotNum, Company, configPlant, PartNum); } else { throw new Exception("Begin | Sessionid is Empty!"); } } catch (Exception ex) { throw new Exception("Begin | " + ex.Message.ToString() + " | LotCreation->Begin"); } finally { if (sessionId != Guid.Empty) { sessionModClient.Logout(); } } }