Ejemplo n.º 1
0
        public static async Task <WSCreateNAVProject.Read_Result> GetNavProject(string ProjectNo, NAVWSConfigurations WSConfigurations)
        {
            //Configure NAV Client
            EndpointAddress WS_URL = new EndpointAddress(WSConfigurations.WS_Job_URL.Replace("Company", WSConfigurations.WS_User_Company));

            WSCreateNAVProject.WSJob_PortClient WS_Client = new WSCreateNAVProject.WSJob_PortClient(navWSBinding, WS_URL);
            WS_Client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;
            WS_Client.ClientCredentials.Windows.ClientCredential          = new NetworkCredential(WSConfigurations.WS_User_Login, WSConfigurations.WS_User_Password, WSConfigurations.WS_User_Domain);

            try
            {
                WSCreateNAVProject.Read_Result result = await WS_Client.ReadAsync(ProjectNo);

                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        public static async Task <WSCreateNAVProject.Create_Result> CreateNavProject(ProjectDetailsViewModel ProjectToCreate, NAVWSConfigurations WSConfigurations)
        {
            WSCreateNAVProject.Create NAVCreate = new WSCreateNAVProject.Create()
            {
                WSJob = new WSCreateNAVProject.WSJob()
                {
                    No                         = ProjectToCreate.ProjectNo,
                    Description100             = ProjectToCreate.Description,
                    Bill_to_Customer_No        = ProjectToCreate.ClientNo,
                    Estado_eSUCH               = (Estado_eSUCH)((int)ProjectToCreate.Status),
                    Estado_eSUCHSpecified      = true,
                    RegionCode20               = ProjectToCreate.RegionCode,
                    FunctionAreaCode20         = ProjectToCreate.FunctionalAreaCode,
                    ResponsabilityCenterCode20 = ProjectToCreate.ResponsabilityCenterCode,
                    Job_Posting_Group          = "",
                    Visivel                    = ProjectToCreate.Visivel == null ? true : (bool)ProjectToCreate.Visivel,
                    Status                     = Status.Open
                                                 //Project_Manager = ProjectToCreate.ProjectLeader,
                                                 //Person_Responsible = ProjectToCreate.ProjectResponsible
                }
            };


            //Configure NAV Client
            EndpointAddress WS_URL = new EndpointAddress(WSConfigurations.WS_Job_URL.Replace("Company", WSConfigurations.WS_User_Company));

            WSCreateNAVProject.WSJob_PortClient WS_Client = new WSCreateNAVProject.WSJob_PortClient(navWSBinding, WS_URL);
            WS_Client.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Delegation;
            WS_Client.ClientCredentials.Windows.ClientCredential          = new NetworkCredential(WSConfigurations.WS_User_Login, WSConfigurations.WS_User_Password, WSConfigurations.WS_User_Domain);

            try
            {
                WSCreateNAVProject.Create_Result result = await WS_Client.CreateAsync(NAVCreate);

                return(result);
            }
            catch (Exception ex)
            {
                throw;
            }
        }