Exemplo n.º 1
0
        public string Create_Case_Creation_Json(long reqId, long resId, tbl_Wipro_Details CandidateDetails, string package, string Database_Sent, string PONumber, string fileupload, string clientID, string SBUID, string clientName, string sbuName, string PackageName)
        {
            string           output = "";
            DML_Utility      objDML = new DML_Utility();
            Get_Data_Utility objGet = new Get_Data_Utility();

            try
            {
                string strRequest_Id   = "";
                string strCandidate_Id = "";
                string strAssociate_Id = "";
                // List<tbl_requests> RequestID = objGet.Get_RequestID();
                //objDML.Add_Exception_Log("Before", "");

                //decimal NewRequestID = RequestID[0].RequestID + 1;
                //objDML.Add_Exception_Log("After", "");

                // Get Data

                JsonCreater objFinal  = new JsonCreater();
                string      MessageId = Guid.NewGuid().ToString();
                string      ServiceId = "CaseCreation";// FilePath_Container.CaseCreation;
                //fileupload = "";
                string jsonFinal            = objFinal.Final_Create_Case_Json(MessageId, CandidateDetails, package, Database_Sent, PONumber, fileupload, clientID, SBUID, clientName, ServiceId, sbuName: sbuName);
                string jsonFinalForRequests = objFinal.Final_Create_Case_JsonForRequests(MessageId, CandidateDetails, package, Database_Sent, PONumber, fileupload, clientID, SBUID, clientName, ServiceId, sbuName: sbuName);
                objDML.Add_Exception_Log("Wipro log : " + jsonFinal, "Json_Data");
                string JsonDatRequests = Read_Json_DataForCaseCreation(jsonFinalForRequests, "Data", "CaseCreation", "clientSpecificFields");
                objDML.Add_Exception_Log("Wipro log : " + JsonDatRequests, "Json_Data");
                /////////////////////////// Add Json request into database //////////////
                //objDML.Add_Exception_Log(lstFreshCase.Count().ToString(), Convert.ToString(NewRequestID));
                string NewRequestID = "0";
                int    ADDRequests  = objDML.Insert_data_in_requests(ref NewRequestID, CandidateDetails, JsonDatRequests, clientID, SBUID);
                jsonFinal = objFinal.Final_Create_Case_Json(MessageId, CandidateDetails, package, Database_Sent, PONumber, fileupload, clientID, SBUID, clientName, ServiceId, RequestID: NewRequestID, sbuName: sbuName);
                objDML.Insert_Json_in_requestracker(Convert.ToString(NewRequestID), jsonFinal);
                objDML.Insert_Json_in_requesStateInstanse(Convert.ToInt64(NewRequestID), 1, "REQ-0002", 165, "Case Created by Touchless", 1, 5, 0);



                //Uploading The downloaded files
                string        destinationPath = ConfigurationManager.AppSettings["destinationPath"] + "\\" + NewRequestID;
                FileUtility   fileUtility     = new FileUtility();
                List <string> copiedFiles     = fileUtility.FileUpload(fileupload, destinationPath);
                objDML.Add_Exception_Log("Wipro log : " + copiedFiles.Count + "Files Uploaded", "");
                objDML.Insert_FilePathIndocument_upload(copiedFiles, Convert.ToInt64(NewRequestID));
                objDML.Add_Exception_Log("Wipro log : " + "Files Path Inserted in database", NewRequestID.ToString());


                objDML.Add_Exception_Log("Wipro log : " + "RequestInstance Created", NewRequestID.ToString());
                objDML.updateWiproDetails(CandidateDetails.Candidte_Id, CandidateDetails.Check_Initiated, Convert.ToInt64(NewRequestID));

                string packageID = objGet.getPackageID(PackageName, SBUID);
                objDML.InsertPackageDetails(Convert.ToInt64(NewRequestID), packageID);



                int            iDML   = objDML.Add_Request_Json_Detail(MessageId, "CaseCreation", jsonFinal);
                ExecuteProcess objExe = new ExecuteProcess();
                if (iDML == 1)
                {
                    bool ret = objExe.Write_JSON_TO_ServerRABBIT_MQ(jsonFinal);
                    output = ret ? "Success" : "Failed";
                    objDML.Add_Exception_Log("Wipro log : " + output, "");
                }

                //bool ret = objExe.Write_JSON_TO_RABBIT_MQ(jsonFinal);
                //output = ret ? "Success" : "Failed";
            }
            catch (Exception ex)
            {
                output = "ex";
                //throw ex;
                while (ex != null)
                {
                    int iException = objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "Create_Case_Creation_Json");
                    ex = ex.InnerException;
                }
            }

            return(output);
        }