예제 #1
0
        //[Conditional("DEBUG_SERVICE")]
        //private  void DebugMode()
        //{
        //    Servicelog();
        //    Debugger.Break();
        //}
        public void Servicelog()
        {
            DML_Utility objDML = new DML_Utility();

            try
            {
                //objDML.Add_Exception_Log("Service Start", "");
                ExecuteProcess   obj    = new ExecuteProcess();
                Get_Data_Utility objGet = new Get_Data_Utility();
                string           error  = obj.Write_JSON_TO_Download();
                //objDML.Add_Exception_Log("Download Complete", "");

                System.Threading.Thread.Sleep(2000);

                CaseCreationProcessor obj1 = new CaseCreationProcessor();
                string output1             = obj.Execute_Excel_YetToStart_Process_Download();
                //objDML.Add_Exception_Log("FreshCase Request Sent", "");

                System.Threading.Thread.Sleep(2000);
                obj.Read_Response();
                string output = obj1.Create_Case_Creation_Json_For_FreshCase();
                //objDML.Add_Exception_Log("Service End", "");
            }
            catch (Exception ex)
            {
                objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "");
                Console.WriteLine(ex.Message.ToString());
                throw ex;
            }
        }
        public string ConvertToXLSX(string filePath)
        {
            // logger.Info("Convert to XLSX started.");
            DML_Utility objDML = new DML_Utility();

            try
            {
                string   directoryName = Path.GetDirectoryName(filePath);
                string   fileName      = Path.GetFileNameWithoutExtension(filePath);
                string[] files         = new string[1];
                string[] newFile       = new string[1];
                files = Directory.GetFiles(directoryName, fileName + ".xls");
                var app = new Microsoft.Office.Interop.Excel.Application();
                //foreach (string file in files)
                //{
                var wb = app.Workbooks.Open(files[0].ToString());
                wb.SaveAs(Filename: files[0].ToString() + "x", FileFormat: Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook);
                wb.Close();
                app.Quit();
                File.Delete(filePath);
                newFile  = Directory.GetFiles(directoryName, fileName + ".xlsx");
                filePath = Path.GetFullPath(newFile[0]).ToString();
                // }
                //logger.Info("Convert to XLSX completed.");
                return(filePath);
            }
            catch (Exception ex)
            {
                objDML.Add_Exception_Log("Before conversion", "");
                //logger.Error("Error occured while converting xls to xslx. Error message: " + ex.Message.ToString());
                throw ex;
                //return null;
            }
        }
예제 #3
0
        public async Task <string> PostSuspect1(PackageRequestModel request)
        {
            string      apiPath = "";// "Suspect/PostSuspect";
            DML_Utility objDML  = new DML_Utility();

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri(apiBaseUri);
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                client.Timeout = TimeSpan.FromMinutes(100);

                client.DefaultRequestHeaders.Add("TokenID", TokenID);
                // client.DefaultRequestHeaders.Add("Authorization", "Bearer " + request.Token);
                string json          = JsonConvert.SerializeObject(request);
                var    stringContent = new StringContent(json, UnicodeEncoding.UTF8, "application/json");
                //var client1 = new HttpClient();
                //client1.Timeout = TimeSpan.FromMinutes(100);
                var response = await client.PostAsync(apiBaseUri + apiPath, stringContent).ConfigureAwait(false);

                objDML.Add_Exception_Log(json, "");
                var responseString = await response.Content.ReadAsStringAsync();

                return(responseString);
            }
        }
예제 #4
0
        public void Servicelog()
        {
            DML_Utility objDML = new DML_Utility();

            try
            {
                ExecuteProcess   obj    = new ExecuteProcess();
                Get_Data_Utility objGet = new Get_Data_Utility();
                string           error  = obj.Write_JSON_TO_Download();
                System.Threading.Thread.Sleep(2000);

                CaseCreationProcessor obj1 = new CaseCreationProcessor();
                string output1             = obj.Execute_Excel_YetToStart_Process_Download();
                System.Threading.Thread.Sleep(2000);
                obj.Read_Response();
                string output = obj1.Create_Case_Creation_Json_For_FreshCase();

                //ExecuteProcess obj2 = new ExecuteProcess();
                //clsState state = new clsState();
                //List<tbl_request_state_instance> OpenStates = objGet.GetAllOpenState();
                //foreach (var item in OpenStates)
                //{
                //    state.SwitchAllOpenStates(item);
                //}
            }
            catch (Exception ex)
            {
                objDML.Add_Exception_Log(ex.Message, "");
                Console.WriteLine("Wipro exception : " + ex.Message.ToString());
                throw ex;
            }
        }
예제 #5
0
        static void Execute()
        {
            DML_Utility objDML = new DML_Utility();

            ExecuteProcess        obj  = new ExecuteProcess();
            CaseCreationProcessor obj1 = new CaseCreationProcessor();

            //objDML.Insert_Json_in_requesStateInstanse(Convert.ToInt64(338200), 1, "REQ-0002", 165, "Case Creation by Touchless", 1, 5, 0);
            //long NewRequestID = 23548;
            //string fileupload = "C:\\Users\\Grid\\Downloads\\My Received Files\\My Received Files";
            //string destinationPath = fileupload + "\\" + NewRequestID;
            //List<string> copiedFiles = FileUtility.FileUpload(fileupload, destinationPath);
            //objDML.Insert_FilePathIndocument_upload(copiedFiles, Convert.ToInt64(NewRequestID));


            string error = obj.Write_JSON_TO_Download();

            System.Threading.Thread.Sleep(2000);

            string output1 = obj.Execute_Excel_YetToStart_Process_Download();

            System.Threading.Thread.Sleep(2000);
            obj.Read_Response();
            //string output = obj1.Create_Case_Creation_Json_For_FreshCase();
        }
예제 #6
0
        public Dictionary <string, string> getPackageName(string Account, string vbgType, string bu, string vbgSubType, string outputParametr, string labelName, string CustomerRequestID, string accountGroup, string dataScrappedValue)
        {
            DML_Utility objDML = new DML_Utility();

            try
            {
                //Find PackageName
                string engineID        = ConfigurationManager.AppSettings["engineID"];
                string engineLicenseId = ConfigurationManager.AppSettings["engineLicenseId"];

                PackageRequestModel PkgObj = new PackageRequestModel();
                metadata            newobj = new metadata();
                newobj.engineName      = "Package Identification Engine";
                newobj.engineID        = engineID;          //"999286bf-c25b-4120-bbfa-5d34dda6994a";
                newobj.engineLicenseId = engineLicenseId;   // "8565b92f-fba5-48d5-94ca-1e864ef98787";
                newobj.engineType      = "1";
                newobj.requestId       = CustomerRequestID; // Guid.NewGuid().ToString();
                newobj.requestDate     = DateTime.Now.ToString();
                newobj.sourceApp       = "Touchless";
                newobj.sourceAppModule = "Package Manager";
                newobj.requestLabel    = labelName;
                PkgObj.metadata        = newobj;
                List <Data> lstdata = new List <Data>();
                Data        data    = new Data();
                data.account           = Account;
                data.accountgroup      = accountGroup;
                data.bgvtype           = vbgType;
                data.datascrappedvalue = dataScrappedValue;
                //data.bgvsubtype = vbgSubType;
                data.bu = bu;
                lstdata.Add(data);
                PkgObj.data = lstdata;

                APIManeger manager = new APIManeger();

                string response = manager.PostSuspect(PkgObj);
                //objDML.Add_Exception_Log(response, "");
                string[] para = outputParametr.Split(',');
                Dictionary <string, string> returnvalues = new Dictionary <string, string>();
                foreach (var item in para)
                {
                    string paravalue = Read_Json_PackageName(response, "response", "data", item);
                    returnvalues.Add(item, paravalue);
                }
                return(returnvalues);
            }
            catch (Exception ex)
            {
                int iException = objDML.Add_Exception_Log("Wipro exception : " + ex.InnerException.Message, "");

                throw;
            }
        }
        public string addData_YetToStart(DataTable dt, string strDateKey)
        {
            string      Msg    = "";
            DML_Utility objDML = new DML_Utility();

            fadv_touchlessEntities        entit = new fadv_touchlessEntities();
            tbl_input_request_data        tbl   = new tbl_input_request_data();
            List <tbl_input_request_data> lst   = new List <tbl_input_request_data>();

            try
            {
                foreach (DataRow dr in dt.Rows)
                {
                    tbl                           = new tbl_input_request_data();
                    tbl.Account                   = dr["Account"].ToString().Trim();
                    tbl.Account_Group             = dr["Account Group"].ToString().Trim();
                    tbl.Additional_Payment_Status = dr["Additional Payment Status"].ToString().Trim();
                    tbl.Associate_Id              = dr["AssociateId"].ToString().Trim();
                    tbl.BGV_Type                  = dr["BGV Type"].ToString().Trim();
                    tbl.BU                        = dr["BU"].ToString().Trim();
                    tbl.Candidate_ID              = dr["CandidateId"].ToString().Trim();
                    tbl.CE_Available              = dr["CE Available(Yes/No)"].ToString().Trim();
                    tbl.CE_BGV_Initiated_Date     = dr["CE-BGV Initiated date"].ToString().Trim();
                    tbl.Components                = dr["Components"].ToString().Trim();
                    tbl.Department                = dr["Department"].ToString().Trim();
                    tbl.DOJ                       = dr["DOJ"].ToString().Trim();
                    tbl.HR_POC                    = dr["HR POC"].ToString().Trim();
                    tbl.Last_Updated_On           = dr["Last Updated On"].ToString().Trim();
                    tbl.Name                      = dr["Name"].ToString().Trim();
                    tbl.Pre_BGV_Initiated_Date    = dr["Pre-BGV Initiated Date"].ToString().Trim();
                    tbl.Project                   = dr["Project"].ToString().Trim();
                    tbl.Report_uploaded_date      = dr["Report uploaded date"].ToString().Trim();
                    //tbl.Request_Date = dr["Date1"].ToString().Trim();
                    tbl.Request_ID    = dr["RequestId"].ToString().Trim();
                    tbl.Vendor_Status = dr["Vendor Status"].ToString().Trim();
                    tbl.Work_Location = dr["Work Location"].ToString().Trim();
                    tbl.ImportKey     = Convert.ToInt64(strDateKey.ToString());

                    lst.Add(tbl);
                }
                entit.tbl_input_request_data.AddRange(lst);
                entit.SaveChanges();
                Msg = "OK";
            }
            catch (Exception ex)
            {
                Msg = "ex";
                objDML.Add_Exception_Log(ex.Message, "");
                throw ex;
            }
            return(Msg);
        }
        public string Create_Case_Creation_JsonOld(long reqId, long resId)
        {
            string      output = "";
            DML_Utility objDML = new DML_Utility();

            try
            {
                string strRequest_Id   = "";
                string strCandidate_Id = "";
                string strAssociate_Id = "";
                // Get Data
                ExecuteProcess         objExe = new ExecuteProcess();
                fadv_touchlessEntities entit  = new fadv_touchlessEntities();
                //tbl_yettostart_casecreation_data tbl = new tbl_yettostart_casecreation_data();
                List <tbl_yettostart_casecreation_data> lstFreshCase = entit.tbl_yettostart_casecreation_data.Where(x => x.responseId == resId && x.queue_request_id == reqId).ToList <tbl_yettostart_casecreation_data>();
                List <tbl_college_details> lstCollege = entit.tbl_college_details.Where(x => x.active == 1 && x.resid == resId && x.reqid == reqId).ToList <tbl_college_details>();
                foreach (var obj in lstFreshCase)
                {
                    strRequest_Id   = obj.request_id;
                    strAssociate_Id = obj.associate_id;
                    strCandidate_Id = obj.candidate_id;
                }
                List <tbl_input_request_data> lstYet2StartData = entit.tbl_input_request_data.Where(x => x.Request_ID == strRequest_Id && x.Associate_Id == strAssociate_Id && x.Candidate_ID == strCandidate_Id).ToList <tbl_input_request_data>();
                List <tbl_initiation_tracker> lstMISLog        = entit.tbl_initiation_tracker.Where(x => x.request_id == strRequest_Id && x.associate_id == strAssociate_Id && x.candidate_id == strCandidate_Id).ToList <tbl_initiation_tracker>();

                JsonCreater objFinal  = new JsonCreater();
                string      MessageId = Guid.NewGuid().ToString();
                string      ServiceId = FilePath_Container.CaseCreation;
                string      jsonFinal = objFinal.Final_Create_Case_Json(MessageId, lstFreshCase, lstCollege, lstYet2StartData, lstMISLog, ServiceId, "", "", "");

                /////////////////////////// Add Json request into database //////////////

                int iDML = objDML.Add_Request_Json_Detail(MessageId, "CaseCreation", jsonFinal);
                if (iDML == 1)
                {
                    bool ret = objExe.Write_JSON_TO_RABBIT_MQ(jsonFinal);
                    output = ret ? "Success" : "Failed";
                }

                //bool ret = objExe.Write_JSON_TO_RABBIT_MQ(jsonFinal);
                //output = ret ? "Success" : "Failed";
            }
            catch (Exception ex)
            {
                output = "ex";
                //throw ex;
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }

            return(output);
        }
예제 #9
0
        public List <string> FileUpload(string SourcePath, string DestinationPath)
        {
            List <string> CopiedFiles = new List <string>();
            DML_Utility   objDML      = new DML_Utility();

            try
            {
                //Now Create all of the directories
                if (!Directory.Exists(DestinationPath))
                {
                    Directory.CreateDirectory(DestinationPath);
                }
                if (!Directory.Exists(DestinationPath + "\\RPA"))
                {
                    Directory.CreateDirectory(DestinationPath + "\\RPA");
                }
                //Copy all the files & Replaces any files with the same name
                foreach (string newPath in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories))
                {
                    //System.Threading.Thread.Sleep(2000);
                    string fileName = newPath.Replace(SourcePath, DestinationPath);
                    File.Copy(newPath, fileName, true);
                    //System.Threading.Thread.Sleep(2000);
                    fileName = newPath.Replace(SourcePath, DestinationPath + "\\RPA");
                    File.Copy(newPath, fileName, true);
                    CopiedFiles.Add(fileName);
                }
                //SourcePath = Path.GetFullPath(Path.Combine(SourcePath, @"..\")) + "\\ScreenShot";
                //objDML.Add_Exception_Log(SourcePath, "ScreenshotPath");
                //foreach (string newPath in Directory.GetFiles(SourcePath, "*.*", SearchOption.AllDirectories))
                //{
                //    //System.Threading.Thread.Sleep(2000);
                //    string fileName = newPath.Replace(SourcePath, DestinationPath);
                //    File.Copy(newPath, fileName, true);
                //    fileName = newPath.Replace(SourcePath, DestinationPath + "\\RPA");
                //    File.Copy(newPath, fileName, true);
                //    //System.Threading.Thread.Sleep(2000);
                //    CopiedFiles.Add(fileName);
                //}
                return(CopiedFiles);
            }
            catch (Exception ex)
            {
                objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "FileUpload");
                return(CopiedFiles);
            }
        }
        //private void InitTimer()
        //{
        //    timer = new System.Timers.Timer();
        //    //wire up the timer event
        //    timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
        //    //set timer interval
        //    //var timeInSeconds = Convert.ToInt32(ConfigurationManager.AppSettings["TimerIntervalInSeconds"]);
        //    double timeInSeconds = 3.0;
        //    timer.Interval = (timeInSeconds * 1000);
        //    // timer.Interval is in milliseconds, so times above by 1000
        //    timer.Enabled = true;
        //}

        //protected void timer_Elapsed(object sender, ElapsedEventArgs e)
        //{
        //    int timer_fired = 0;
        //    Servicelog();
        //    timer.Enabled = false;
        //    timer.Close();
        //    timer.Dispose();

        //    ServiceController service = new ServiceController("CallServiceFADVInitialTracker");

        //    if ((service.Status.Equals(ServiceControllerStatus.Stopped)) ||

        //        (service.Status.Equals(ServiceControllerStatus.StopPending)))

        //        service.Start();

        //    else service.Stop();

        //}
        public void Servicelog()
        {
            DML_Utility objDML = new DML_Utility();

            try
            {
                ExecuteProcess obj   = new ExecuteProcess();
                int            Value = obj.Execute_Excel_InitialTracker();
            }
            catch (Exception ex)
            {
                int iException = objDML.Add_Exception_Log(ex.Message, "");

                Console.WriteLine("Wipro exception : " + ex.Message.ToString());
                throw ex;
            }
        }
        public int Execute_Excel_InitialTracker()
        {
            int         Value  = 0;
            DML_Utility objDML = new DML_Utility();

            try
            {
                string strFilePath = "";
                string strFileName = "";
                // Get HostName //
                Get_Data_Utility        objGet    = new Get_Data_Utility();
                List <tbl_config_value> lstConfig = objGet.Get_Cofig_Details("MISDATA");
                foreach (var ob in lstConfig)
                {
                    strFilePath = ob.configstring;
                    strFileName = ob.FileName;
                }

                string path = strFilePath + strFileName; //
                //FilePath_Container.FilePath + FilePath_Container.FileName_InitationTracker;
                if (File.Exists(path))
                {
                    DataTable dt = Read_Excel("Sheet1", path);
                    if (dt.Rows.Count > 0)
                    {
                        // Add Rows Count into table //
                        long rowcount = dt.Rows.Count;
                        objDML.Add_Rows_Count_Data(path, rowcount);
                        Value = addData(dt);
                    }
                    else
                    {
                        Value = 9; // No data exist
                    }
                }
            }
            catch (Exception ex)
            {
                Value = -1;
                ////// Exception Log ///
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }
            return(Value);
        }
        public string Read_Response()
        {
            DML_Utility objDML = new DML_Utility();
            string      output = "";
            // Read RABITMQ for Response //
            string Response_Data  = "";
            string Response_Error = "";

            try
            {
                RabbitMQ_Utility objQueue    = new RabbitMQ_Utility();
                bool             retResponse = objQueue.Receive(RabbitMQ_Utility.RabbitMQResponseQueue, out Response_Data, out Response_Error);
                //objDML.Add_Exception_Log(Response_Data, "");

                //objDML.Add_Exception_Log(Response_Data, "");
                if (!string.IsNullOrEmpty(Response_Data))
                {
                    string responce_MessageId = "";
                    string responce_ServiceId = "";

                    responce_MessageId = Read_Json_TagWise(Response_Data, "Header", "MessageID");
                    responce_ServiceId = Read_Json_TagWise(Response_Data, "Header", "ServiceId");
                    // Add Response into Database //
                    Get_Data_Utility obj = new Get_Data_Utility();
                    //DML_Utility objDML = new DML_Utility();
                    long reqId = obj.Get_Request_Id(responce_MessageId, responce_ServiceId);
                    //objDML.Add_Exception_Log("select * from tbl_request_details where messageid='" + responce_MessageId + "'", "");
                    //objDML.Add_Exception_Log(reqId.ToString(), "");

                    if (reqId > 0)
                    {
                        objDML.Add_Response_Json(reqId, Response_Data, responce_MessageId, responce_ServiceId);
                    }
                }
            }
            catch (Exception ex)
            {
                output = "exception : " + ex.Message.ToString();
                ////// Exception Log ///

                int iException = objDML.Add_Exception_Log(ex.Message, "Read_Response");
            }
            return(output);
        }
        public string Process_Excel_File()
        {
            string output = "";

            Get_Data_Utility obj         = new Get_Data_Utility();
            DML_Utility      objDML      = new DML_Utility();
            JsonCreater      JsonCreater = new Read_File_Processor.JsonCreater();

            try
            {
            }
            catch (Exception ex)
            {
                output = "exception : " + ex.Message.ToString();
                ////// Exception Log ///
                //DML_Utility objDML = new DML_Utility();
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }
            return(output);
        }
예제 #14
0
        static void Test_DownloadResponse()
        {
            //Get_Data_Utility objGet = new Get_Data_Utility();
            DML_Utility      objDML      = new DML_Utility();
            ExecuteProcess   obj         = new ExecuteProcess();
            JsonCreater      JsonCreater = new Read_File_Processor.JsonCreater();
            RabbitMQ_Utility objQueue    = new RabbitMQ_Utility();

            try
            {
                string output       = "";
                string error        = "";
                string MessageId    = "2eb1d289-f9e5-4d80-9834-3550fcc0da48";
                string jsonDownload = JsonCreater.getDownload_Response(MessageId, "Y");
                bool   ret          = objQueue.Rabbit_Send_Response_Queue(jsonDownload, "Response", "localhost", out error);
            }
            catch (Exception ex)
            {
                int iException = objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "");
                iException = objDML.Add_Exception_Log(ex.Message, "Main Function");
            }
        }
예제 #15
0
        public string PostSuspect(PackageRequestModel request)
        {
            DML_Utility objDML  = new DML_Utility();
            var         client1 = new RestSharp.RestClient(apiBaseUri);

            client1.Timeout = 100000000;
            var request1 = new RestRequest(Method.POST);

            request1.AddHeader("TokenID", TokenID);
            request1.AddHeader("Accept", "*/*");
            request1.AddHeader("Content-Type", "application/json");
            string json = JsonConvert.SerializeObject(request);

            objDML.Add_Exception_Log(json, "Package Request");
            request1.AddParameter("undefined", json, RestSharp.ParameterType.RequestBody);
            IRestResponse response1      = client1.Execute(request1);
            var           Outputresponse = response1.Content;

            objDML.Add_Exception_Log(Outputresponse, "Package Response");

            return(Outputresponse);
        }
예제 #16
0
        static void Test_DownloadResponse()
        {
            //Get_Data_Utility objGet = new Get_Data_Utility();
            DML_Utility      objDML      = new DML_Utility();
            ExecuteProcess   obj         = new ExecuteProcess();
            JsonCreater      JsonCreater = new Read_File_Processor.JsonCreater();
            RabbitMQ_Utility objQueue    = new RabbitMQ_Utility();

            try
            {
                string output       = "";
                string error        = "";
                string MessageId    = "a7520c5f-7245-4f91-aefc-6063785ccabe";
                string ServiceId    = "DOWNLOAD";
                string jsonDownload = JsonCreater.getDownload_Response(MessageId, ServiceId, "Y");
                bool   ret          = objQueue.Rabbit_Send_Response_Queue(jsonDownload, "Response", "localhost", out error);
            }
            catch (Exception ex)
            {
                int iException = objDML.Add_Exception_Log(ex.Message, "");
                iException = objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "Main Function");
            }
        }
        public string Create_Case_Creation_Json(long reqId, long resId, string fileupload, string clientID, string SBUID, string clientName)
        {
            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
                ExecuteProcess         objExe = new ExecuteProcess();
                fadv_touchlessEntities entit  = new fadv_touchlessEntities();
                //tbl_yettostart_casecreation_data tbl = new tbl_yettostart_casecreation_data();
                List <tbl_yettostart_casecreation_data> lstFreshCase = entit.tbl_yettostart_casecreation_data.Where(x => x.responseId == resId && x.queue_request_id == reqId).ToList <tbl_yettostart_casecreation_data>();
                List <tbl_college_details> lstCollege = entit.tbl_college_details.Where(x => x.active == 1 && x.resid == resId && x.reqid == reqId).ToList <tbl_college_details>();
                foreach (var obj in lstFreshCase)
                {
                    strRequest_Id   = obj.request_id;
                    strAssociate_Id = obj.associate_id;
                    strCandidate_Id = obj.candidate_id;
                }
                //Code Commented as we need only till download documents
                List <tbl_input_request_data> lstYet2StartData = entit.tbl_input_request_data.Where(x => x.Request_ID == strRequest_Id && x.Associate_Id == strAssociate_Id && x.Candidate_ID == strCandidate_Id).ToList <tbl_input_request_data>();
                List <tbl_initiation_tracker> lstMISLog        = entit.tbl_initiation_tracker.Where(x => x.request_id == strRequest_Id && x.associate_id == strAssociate_Id && x.candidate_id == strCandidate_Id).ToList <tbl_initiation_tracker>();

                JsonCreater objFinal  = new JsonCreater();
                string      MessageId = Guid.NewGuid().ToString();
                string      ServiceId = FilePath_Container.CaseCreation;
                string      jsonFinal = objFinal.Final_Create_Case_Json(MessageId, lstFreshCase, lstCollege, lstYet2StartData, lstMISLog, fileupload, clientID, SBUID, clientName, ServiceId);
                objDML.Add_Exception_Log(jsonFinal, "Json_Data");
                string JsonDatRequests = Read_Json_DataForCaseCreation(jsonFinal, "Data", "CaseCreation", "clientSpecificFields");
                objDML.Add_Exception_Log(JsonDatRequests, "Json_Data");
                /////////////////////////// Add Json request into database //////////////
                //objDML.Add_Exception_Log(lstFreshCase.Count().ToString(), Convert.ToString(NewRequestID));
                //int ADDRequests = objDML.Insert_data_in_requests(Convert.ToString(NewRequestID), lstFreshCase, JsonDatRequests, clientID, SBUID);
                jsonFinal = objFinal.Final_Create_Case_Json(MessageId, lstFreshCase, lstCollege, lstYet2StartData, lstMISLog, fileupload, clientID, SBUID, clientName, ServiceId, Convert.ToString(NewRequestID));
                objDML.Insert_Json_in_requestracker(Convert.ToString(NewRequestID), jsonFinal);
                int iDML = objDML.Add_Request_Json_Detail(MessageId, "CaseCreation", jsonFinal);
                if (iDML == 1)
                {
                    bool ret = objExe.Write_JSON_TO_ServerRABBIT_MQ(jsonFinal);
                    output = ret ? "Success" : "Failed";
                    objDML.Add_Exception_Log(output, "");
                }

                //bool ret = objExe.Write_JSON_TO_RABBIT_MQ(jsonFinal);
                //output = ret ? "Success" : "Failed";
            }
            catch (Exception ex)
            {
                output = "ex";
                //throw ex;
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }

            return(output);
        }
        public DataTable Import(String path)
        {
            DML_Utility objDML = new DML_Utility();

            try
            {
                Microsoft.Office.Interop.Excel.Application app      = new Microsoft.Office.Interop.Excel.Application();
                Microsoft.Office.Interop.Excel.Workbook    workBook = app.Workbooks.Open(path, 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);

                Microsoft.Office.Interop.Excel.Worksheet workSheet = (Microsoft.Office.Interop.Excel.Worksheet)workBook.ActiveSheet;

                int    index    = 0;
                object rowIndex = 2;
                int    colindex = 1;

                DataTable dt = new DataTable();
                //dt.Columns.Add("FirstName");
                //dt.Columns.Add("LastName");
                //dt.Columns.Add("Mobile");
                //dt.Columns.Add("Landline");
                //dt.Columns.Add("Email");
                //dt.Columns.Add("ID");

                DataRow row;
                while (((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[1, colindex]).Value2 != null)
                {
                    ++colindex;
                }
                for (int i = 1; i < colindex; i++)
                {
                    dt.Columns.Add(Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[1, i]).Value2));
                    //dt.Columns.Add();
                }

                while (((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 1]).Value2 != null)
                {
                    rowIndex = 2 + index;
                    row      = dt.NewRow();
                    for (int i = 1; i < colindex; i++)
                    {
                        row[i - 1] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, i]).Value2);
                    }


                    //row[0] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 1]).Value2);
                    //row[1] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 2]).Value2);
                    //row[2] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 3]).Value2);
                    //row[3] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 4]).Value2);
                    //row[4] = Convert.ToString(((Microsoft.Office.Interop.Excel.Range)workSheet.Cells[rowIndex, 5]).Value2);
                    index++;
                    dt.Rows.Add(row);
                }
                app.Workbooks.Close();
                return(dt);
            }
            catch (Exception ex)
            {
                objDML.Add_Exception_Log(ex.Message, "");
                throw ex;
            }
        }
        public string Execute_Case_Creation()
        {
            string      output = "";
            DML_Utility objDML = new DML_Utility();

            try
            {
                // Read RABITMQ for Response //
                string           Response_Data  = "";
                string           Response_Error = "";
                RabbitMQ_Utility objQueue       = new RabbitMQ_Utility();
                //bool retResponse = objQueue.Receive("Response", out Response_Data, out Response_Error);
                bool retResponse = objQueue.Receive(RabbitMQ_Utility.RabbitMQResponseQueue, out Response_Data, out Response_Error);

                if (!string.IsNullOrEmpty(Response_Data))
                {
                    List <tbl_yettostart_casecreation_data> lst = new List <tbl_yettostart_casecreation_data>();
                    tbl_yettostart_casecreation_data        tbl = new tbl_yettostart_casecreation_data();
                    string responce_MessageId = "";
                    string responce_ServiceId = "";
                    string path = Read_Json_Case_Creation(Response_Data, out responce_MessageId, out responce_ServiceId);
                    if (responce_ServiceId.ToLower() == "freshcase")
                    {
                        string College_CVT = "";
                        string College_UT  = "";
                        string Degree_CVT  = "";
                        string Degree_UT   = "";

                        // get RequestId column from table //
                        Get_Data_Utility obj   = new Get_Data_Utility();
                        long             reqId = obj.Get_Request_Id_new(responce_MessageId, "YET2START");
                        if (reqId > 0)
                        {
                            tbl.queue_request_id        = reqId;
                            tbl.cognizent_tech_solution = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "cognizent_tech_solution");
                            tbl.clientcode           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "clientcode");
                            tbl.candidate_name       = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "candidate_name");
                            tbl.client_ref_no        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "client_ref_no");
                            tbl.bvg_type             = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "bvg_type");
                            tbl.package              = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "package");
                            tbl.specification        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "specification");
                            tbl.project_id           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "project_id");
                            tbl.project_name         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "project_name");
                            tbl.doj                  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "doj");
                            tbl.request_id           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "request_id");
                            tbl.associate_id         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "associate_id");
                            tbl.candidate_id         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "candidate_id");
                            tbl.employee_id          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "employee_id");
                            tbl.account_name         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "account_name");
                            tbl.tensse               = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "tensse");
                            tbl.actual_case_created  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "actual_case_created");
                            tbl.first_name           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "First_Name");
                            tbl.last_name            = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Last_Name");
                            tbl.date_of_birth        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Date_Of_Birth");
                            tbl.father_name          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Father_Name");
                            tbl.nationality          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Nationality");
                            tbl.mobile_number        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Mobile_Number");
                            tbl.current_address      = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Current_Address");
                            tbl.permanent_address    = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Permanent_Address");
                            tbl.longest_stay_address = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Longest_Stay_Address");
                            tbl.LOA_Status           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "LOA_Status");

                            College_CVT         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_CVT_UG");
                            College_UT          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_UT_UG");
                            Degree_CVT          = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Degree_Type_CVT");
                            Degree_UT           = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Degree_Type_UT");
                            tbl.college_cvt     = College_CVT;
                            tbl.college_ut      = College_UT;
                            tbl.degree_type_cvt = Degree_CVT;
                            tbl.degree_type_ut  = Degree_UT;

                            tbl.reference_type_cvt = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Reference_Type_CVT");
                            tbl.reference_type_ut  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Reference_Type_UT");
                            tbl.company_name_cvt   = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_CVT_Previous");
                            tbl.company_name_ut    = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_UT_Previous");
                            tbl.id_cvt             = "";  // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "ID_CVT");
                            tbl.id_ut = "";               //Read_Json_Case_Creation_TagValue(Response_Data, "Data", "ID_UT");
                            tbl.employment_type_cvt = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Employment_Type_CVT");
                            tbl.employment_type_ut  = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Employment_Type_UT");

                            string College_UT_PG            = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_UT_PG");
                            string College_CVT_PG           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_CVT_PG");
                            string BU                       = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "BU");
                            string Company_Name_UT_Current  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_UT_Current");
                            string Company_Name_CVT_Current = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_CVT_Current");
                            string FilePath                 = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "FilePath");
                            string LOA_Present              = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "LOA_Present");


                            lst.Add(tbl);
                            int intValue = objDML.Add_Response_Json(reqId, lst, Response_Data);
                            if (intValue > 0)
                            {
                                // Update college detail //
                                List <Yet2Start_College> lstCollege = new List <Yet2Start_College>();
                                Yet2Start_College        objCollege = new Yet2Start_College();

                                string[] strCollegeCVT = College_CVT.Split(new char[] { '+' });
                                string[] strCollegeUT  = College_UT.Split(new char[] { '+' });
                                string[] strDegreeCVT  = Degree_CVT.Split(new char[] { '+' });
                                string[] strDegreeUT   = Degree_UT.Split(new char[] { '+' });

                                for (int i = 0; i < strCollegeCVT.Length; i++)
                                {
                                    objCollege              = new Yet2Start_College();
                                    objCollege.college      = strCollegeCVT[i].ToString().Trim();
                                    objCollege.degree       = strDegreeCVT[i].ToString().Trim();
                                    objCollege.field_source = "CVT";
                                    lstCollege.Add(objCollege);
                                }
                                for (int i = 0; i < strCollegeCVT.Length; i++)
                                {
                                    objCollege              = new Yet2Start_College();
                                    objCollege.college      = strCollegeUT[i].ToString().Trim();
                                    objCollege.degree       = strDegreeUT[i].ToString().Trim();
                                    objCollege.field_source = "UT";
                                    lstCollege.Add(objCollege);
                                }

                                // Add this into database Table //
                                long resId = obj.Get_FreshCase_Response_Id(reqId.ToString());
                                if (resId > 0)
                                {
                                    intValue = objDML.Add_Response_Json(reqId, resId, lstCollege);
                                    if (intValue > 0)
                                    {
                                        //////////////////////////////// CASE CREATION JSON FINAL ////////////////////
                                        Create_Case_Creation_Json(reqId, resId, "", "", "", "");
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                output = "ex";
                int iException = objDML.Add_Exception_Log(ex.Message, "");
            }
            return(output);
        }
        public string Create_Case_Creation_Json_For_FreshCase()
        {
            string           output = "";
            long             ResId  = 0;
            long             ReqId  = 0;
            DML_Utility      objDML = new DML_Utility();
            Get_Data_Utility obj    = new Get_Data_Utility();

            try
            {
                List <tbl_response_detail> lstResponse = obj.Get_Response_Data_ToBe_Process(FilePath_Container.FreshCase);
                if (lstResponse.Count > 0)
                {
                    //objDML.Add_Exception_Log(lstResponse.Count.ToString(), "");

                    string MessageId = "";
                    //MessageId.Split('a').Distinct;
                    string ServiceId = "";

                    string ResJson = "";
                    foreach (var res in lstResponse)
                    {
                        MessageId = res.message_id;
                        ServiceId = res.service_id;
                        ResId     = res.id;
                        ReqId     = (long)res.request_id;
                        ResJson   = res.response_json;
                    }
                    // objDML.Add_Exception_Log("Before API Call", "");

                    string responce_MessageId = "";
                    string responce_ServiceId = "";
                    string Response_Data      = "";
                    string path = Read_Json_Case_Creation(ResJson, out responce_MessageId, out responce_ServiceId);
                    //objDML.Add_Exception_Log(responce_MessageId, responce_ServiceId);

                    string status = Read_Json_Case_Creation_TagValue(ResJson, "Status", "Value");
                    //objDML.Add_Exception_Log(responce_MessageId, responce_ServiceId);

                    //objDML.Add_Exception_Log(status, "");
                    //objDML.Add_Exception_Log(responce_ServiceId, "");
                    fadv_touchlessEntities entit = new fadv_touchlessEntities();


                    if (status == "0000")
                    {
                        if (responce_ServiceId.ToLower() == "freshcase")
                        {
                            //objDML.Add_Exception_Log("Before API Call", ResJson);

                            string reqID = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "request_id");
                            List <tbl_input_request_data> InputData = entit.tbl_input_request_data.Where(x => x.Request_ID == reqID).ToList <tbl_input_request_data>();
                            //List<tbl_input_request_data> InputData = entit.tbl_input_request_data.Where(x => x.Request_ID == reqID).ToList<tbl_input_request_data>();



                            List <tbl_yettostart_casecreation_data> lst = new List <tbl_yettostart_casecreation_data>();
                            tbl_yettostart_casecreation_data        tbl = new tbl_yettostart_casecreation_data();
                            string College_CVT = "";
                            string College_UT  = "";
                            string Degree_CVT  = "";
                            string Degree_UT   = "";
                            Response_Data = ResJson;

                            //objDML.Add_Exception_Log("Before API Call", InputData.Count.ToString());

                            string Account         = (Read_Json_Case_Creation_TagValue(Response_Data, "Data", "account_name") == "") ? InputData[0].Account : Read_Json_Case_Creation_TagValue(Response_Data, "Data", "account_name");
                            string AccountGroup    = InputData[0].Account_Group;
                            string vbgType         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "bvg_type");
                            string bvgsubtype      = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "bvg_sub_type");
                            string bu              = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "BU");
                            string labelName       = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "candidate_name");
                            string sbu             = "";
                            string outputParametrs = ConfigurationManager.AppSettings["outputParametrs"];
                            Dictionary <string, string> paravalues = getPackageName(Account, vbgType, bu, bvgsubtype, outputParametrs, labelName);
                            string PackageName = (paravalues.Keys.Contains("package")) ? paravalues["package"] : "";
                            sbu = (paravalues.Keys.Contains("sbu")) ? paravalues["sbu"] : "";
                            objDML.Add_Exception_Log(PackageName, "");

                            tbl.queue_request_id        = ReqId;
                            tbl.responseId              = ResId;
                            tbl.cognizent_tech_solution = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "cognizent_tech_solution");
                            tbl.clientcode              = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "clientcode");
                            tbl.candidate_name          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "candidate_name");
                            tbl.client_ref_no           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "client_ref_no");
                            tbl.bvg_type             = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "bvg_type");
                            tbl.package              = PackageName;// Read_Json_Case_Creation_TagValue(Response_Data, "Data", "package");
                            tbl.specification        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "specification");
                            tbl.project_id           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "project_id");
                            tbl.project_name         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "project_name");
                            tbl.doj                  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "doj");
                            tbl.request_id           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "request_id");
                            tbl.associate_id         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "associate_id");
                            tbl.candidate_id         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "candidate_id");
                            tbl.employee_id          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "employee_id");
                            tbl.account_name         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "account_name");
                            tbl.tensse               = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "tensse");
                            tbl.actual_case_created  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "actual_case_created");
                            tbl.first_name           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "First_Name");
                            tbl.last_name            = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Last_Name");
                            tbl.date_of_birth        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Date_Of_Birth");
                            tbl.father_name          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Father_Name");
                            tbl.nationality          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Nationality");
                            tbl.mobile_number        = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Mobile_Number");
                            tbl.current_address      = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Current_Address");
                            tbl.permanent_address    = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Permanent_Address");
                            tbl.longest_stay_address = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Longest_Stay_Address");
                            tbl.LOA_Status           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "LOA_Status");

                            College_CVT         = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_CVT_UG");
                            College_UT          = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_UT_UG");
                            Degree_CVT          = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Degree_Type_CVT");
                            Degree_UT           = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Degree_Type_UT");
                            tbl.college_cvt     = College_CVT;
                            tbl.college_ut      = College_UT;
                            tbl.degree_type_cvt = Degree_CVT;
                            tbl.degree_type_ut  = Degree_UT;

                            tbl.reference_type_cvt = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Reference_Type_CVT");
                            tbl.reference_type_ut  = ""; //Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Reference_Type_UT");
                            tbl.company_name_cvt   = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_CVT_Previous");
                            tbl.company_name_ut    = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_UT_Previous");
                            tbl.id_cvt             = "";  // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "ID_CVT");
                            tbl.id_ut = "";               //Read_Json_Case_Creation_TagValue(Response_Data, "Data", "ID_UT");
                            tbl.employment_type_cvt = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Employment_Type_CVT");
                            tbl.employment_type_ut  = ""; // Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Employment_Type_UT");

                            string College_UT_PG            = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_UT_PG");
                            string College_CVT_PG           = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "College_CVT_PG");
                            string BU                       = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "BU");
                            string Company_Name_UT_Current  = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_UT_Current");
                            string Company_Name_CVT_Current = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Company_Name_CVT_Current");
                            string FilePath                 = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "FilePath").Replace(@"\", @"\\");
                            string LOA_Present              = Read_Json_Case_Creation_TagValue(Response_Data, "Data", "LOA_Present");
                            string clientID                 = (Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Client_ID") == "") ? "1400000003" : Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Client_ID");
                            string clientName               = (Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Client_Name") == "") ? "Cognizant Technology Solutions (IT)" : Read_Json_Case_Creation_TagValue(Response_Data, "Data", "Client_Name");

                            string SBUIID = (Read_Json_Case_Creation_TagValue(Response_Data, "Data", "SBU_ID") == "") ? "Cognizant Technology Solutions (IT)" : Read_Json_Case_Creation_TagValue(Response_Data, "Data", "SBU_ID");;
                            tbl.active = 1;
                            lst.Add(tbl);

                            int intValue = objDML.Add_Response_Json_FreshCase_Update(ReqId, ResId, lst, Response_Data);
                            //objDML.Add_Exception_Log("After Yet", "");
                            if (intValue > 0)
                            {
                                // Update college detail //
                                List <Yet2Start_College> lstCollege = new List <Yet2Start_College>();
                                Yet2Start_College        objCollege = new Yet2Start_College();

                                string[] strCollegeCVT = College_CVT.Split(new char[] { '+' });
                                string[] strCollegeUT  = College_UT.Split(new char[] { '+' });
                                string[] strDegreeCVT  = Degree_CVT.Split(new char[] { '+' });
                                string[] strDegreeUT   = Degree_UT.Split(new char[] { '+' });

                                for (int i = 0; i < strCollegeCVT.Length; i++)
                                {
                                    objCollege              = new Yet2Start_College();
                                    objCollege.college      = strCollegeCVT[i].ToString().Trim();
                                    objCollege.degree       = strDegreeCVT[i].ToString().Trim();
                                    objCollege.field_source = "CVT";
                                    lstCollege.Add(objCollege);
                                }
                                //objDML.Add_Exception_Log("After strCollegeCVT", "");

                                for (int i = 0; i < strCollegeUT.Length; i++)
                                {
                                    objCollege              = new Yet2Start_College();
                                    objCollege.college      = strCollegeUT[i].ToString().Trim();
                                    objCollege.degree       = strDegreeUT[i].ToString().Trim();
                                    objCollege.field_source = "UT";
                                    lstCollege.Add(objCollege);
                                }
                                //objDML.Add_Exception_Log("After strCollegeUT", "");

                                // Add this into database Table //
                                intValue = objDML.Add_Response_Json(ReqId, ResId, lstCollege);
                                if (intValue > 0)
                                {
                                    //////////////////////////////// CASE CREATION JSON FINAL ////////////////////
                                    output = Create_Case_Creation_Json(ReqId, ResId, FilePath, clientID, SBUIID, clientName);
                                    if (output.ToLower() == "success")
                                    {
                                        // Update Status in Response Table //
                                        objDML.Update_Response_Status(ResId);
                                    }
                                }
                                //objDML.Add_Exception_Log("After success", "");
                            }
                        }
                    }
                    else if (status == "0001")
                    {
                        using (fadv_touchlessEntities entities = new fadv_touchlessEntities())
                        {
                            string ReqMsg = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Request_Id");
                            //objDML.Add_Exception_Log(ReqMsg, "");

                            tbl_initiation_tracker processData = entities.tbl_initiation_tracker.Where(x => x.request_id == ReqMsg.Trim()).First();
                            processData.active = 0;
                            entities.SaveChanges();
                            //objDML.Add_Exception_Log("After FailedJson", "");
                        }
                    }
                    objDML.Update_Response_Status(ResId);
                }
            }
            catch (Exception ex)
            {
                output = "ex";
                objDML.Update_Response_Status(ResId);
                //throw ex;
                int iException = objDML.Add_Exception_Log(ex.Message, "Create_Case_Creation_Json_For_FreshCase");
            }

            return(output);
        }
        public string Write_JSON_TO_Download()
        {
            bool             ret    = false;
            string           output = "";
            string           error  = "";
            DML_Utility      objDML = new DML_Utility();
            Get_Data_Utility objGet = new Get_Data_Utility();

            try
            {
                //objDML.Add_Exception_Log(ts.TotalMinutes.ToString(), "");
                // Check Last Request //
                int Flag = 1;
                List <tbl_request_details> lstObj = new List <tbl_request_details>();
                lstObj = objGet.Get_Last_Request();

                if (lstObj.Count > 0)
                {
                    double   timeMinutes = 0;
                    DateTime dtReq       = (DateTime)lstObj[0].createdOn;
                    //DateTime dt = System.DateTime.Now;
                    DateTime dt = System.DateTime.Now.AddMinutes(0);
                    TimeSpan ts = dt - dtReq;
                    List <tbl_config_value> lstConfig = objGet.Get_Cofig_Details("DOWNLOADREQUEST");
                    foreach (var ob in lstConfig)
                    {
                        double.TryParse(ob.configstring, out timeMinutes);
                    }
                    timeMinutes = timeMinutes <= 0 ? 59 : timeMinutes;
                    //int iException1 = objDML.Add_Exception_Log(ts.TotalMinutes.ToString(), dt.ToString());
                    if (ts.TotalMinutes > timeMinutes)
                    {
                        Flag = 1;
                    }
                    else
                    {
                        Flag = 0;
                    }
                }

                if (Flag > 0)
                {
                    string MessageId = Guid.NewGuid().ToString();
                    string ServiceId = FilePath_Container.ServiceId_Download.ToString();// "DOWNLOAD";// Guid.NewGuid().ToString();
                    ///////////////////////// Add Json request into database //////////////
                    JsonCreater JsonCreater = new Read_File_Processor.JsonCreater();
                    string      json        = JsonCreater.getDownload(MessageId, ServiceId);
                    int         iDML        = objDML.Add_Request_Json_Detail(MessageId, ServiceId, json); // Add_Request_Json(MessageId, "DOWNLOAD", json);
                    ///////////////////////// Add Json request into Rabbit MQ //////////////
                    if (iDML == 1)
                    {
                        ret    = Write_JSON_TO_RABBIT_MQ(json);
                        output = ret ? "Success" : "Failed";
                    }
                }
                else
                {
                    // READ RESPONSE QUEUE //
                    Read_Response();
                }
            }
            catch (Exception ex)
            {
                output = "exception : " + ex.Message.ToString();
                ////// Exception Log ///
                //DML_Utility objDML = new DML_Utility();
                //int iException = objDML.Add_Exception_Log(ex.Message, "Write_JSON_TO_Download");
            }
            return(output);
        }
        public string Execute_Excel_YetToStart_Process_Download()
        {
            string output = "";

            Get_Data_Utility obj    = new Get_Data_Utility();
            DML_Utility      objDML = new DML_Utility();
            //objDML.Add_Exception_Log("", "Execute_Excel_YetToStart_Process_Download");
            JsonCreater JsonCreater = new Read_File_Processor.JsonCreater();
            long        ResId       = 0;

            try
            {
                string strDateKey = System.DateTime.Now.ToString("yyyyMMddHHmmss");
                // GET RESONSE JSON TO BE PROCESSED
                List <tbl_response_detail> lstResponse = obj.Get_Response_Data_ToBe_Process(FilePath_Container.ServiceId_Download);
                if (lstResponse.Count > 0)
                {
                    string MessageId = "";
                    string ServiceId = "";
                    long   ReqId     = 0;
                    string ResJson   = "";
                    foreach (var res in lstResponse)
                    {
                        MessageId = res.message_id;
                        ServiceId = res.service_id;
                        ResId     = res.id;
                        ReqId     = (long)res.request_id;
                        ResJson   = res.response_json;
                    }
                    //int iException1 = objDML.Add_Exception_Log(ResJson, "");

                    if (ResId > 0 && !string.IsNullOrEmpty(ResJson))
                    {
                        // Read Json and Excel Process
                        string responce_MessageId = "";
                        string responce_Status    = "";
                        string responce_Module    = "";
                        //string RequestType = "DOWNLOAD";
                        string path = Read_Json(ResJson, out responce_MessageId, out responce_Status, out responce_Module);
                        //objDML.Add_Exception_Log(path, "");
                        //objDML.Add_Exception_Log(responce_Status, "");

                        //objDML.Add_Exception_Log(ResJson, "");
                        if (responce_Status.ToLower() == "y" || responce_Status.ToLower() == "yes")
                        {
                            //objDML.Add_Exception_Log(path, "");
                            if (File.Exists(path))
                            {
                                //string path = FilePath_Container.FilePath + FilePath_Container.FileName_YetToStart;
                                //objDML.Add_Exception_Log("Before conversion", "");
                                //string newpath = ConvertToXLSX(path);
                                //objDML.Add_Exception_Log("afetr conversion", "newpath"+ newpath);

                                //DataTable dt = Read_Excel(Path.GetFileNameWithoutExtension(path), path);
                                DataTable dt = ConvertToCSV(path);
                                //objDML.Add_Exception_Log("Before", "");
                                //DataTable dt = Import(path);
                                //objDML.Add_Exception_Log(dt.Rows.Count.ToString(), "");
                                if (dt.Rows.Count > 0)
                                {
                                    output = addData_YetToStart(dt, strDateKey);
                                    if (output == "OK")
                                    {
                                        // Get Data after compare for New Request Id
                                        List <tbl_input_request_data> lst     = new List <tbl_input_request_data>();
                                        List <YetToStart>             lstJson = new List <YetToStart>();
                                        YetToStart objJson = new YetToStart();
                                        lst = obj.Get_New_Request_Id_List(strDateKey);
                                        int iCount = 0;

                                        foreach (var objList in lst)
                                        {
                                            string queueMessageId = Guid.NewGuid().ToString();
                                            string queueServiceId = FilePath_Container.FreshCase;
                                            output = JsonCreater.getDetails_FreshCase(objList.Request_ID, objList.Associate_Id, objList.Candidate_ID, objList.DOJ, queueMessageId, Path.GetFileNameWithoutExtension(path), queueServiceId);
                                            /////////////////////////// Add Json request into database //////////////
                                            int iDML = objDML.Add_Request_Json_Detail(queueMessageId, queueServiceId, output);
                                            if (iDML == 1)
                                            {
                                                bool ret = Write_JSON_TO_RABBIT_MQ(output);
                                                output = ret ? "Success" : "Failed";
                                            }
                                            iCount++;
                                        }
                                        if (iCount == lst.Count)
                                        {
                                            // Update Status of Response //
                                            objDML.Update_Response_Status(ResId);
                                        }
                                    }
                                }
                                else
                                {
                                    output = "not exist";
                                }
                                //objDML.Add_Exception_Log(output, "");
                            }
                        }
                        objDML.Update_Response_Status(ResId);
                    }
                }
            }
            catch (Exception ex)
            {
                output = "exception : " + ex.Message.ToString();
                ////// Exception Log ///
                //DML_Utility objDML = new DML_Utility();
                objDML.Update_Response_Status(ResId);

                int iException = objDML.Add_Exception_Log(ex.Message, "Execute_Excel_YetToStart_Process_Download");
            }
            return(output);
        }
예제 #23
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);
        }
        public bool Receive(string queue, out string data, out string error)
        {
            error = string.Empty;
            try
            {
                string strRabbitMQUrl           = "";
                string strRabbitMQRequestQueue  = "";
                string strRabbitMQResponseQueue = "";
                data = string.Empty;
                // Get HostName //
                Get_Data_Utility objGet = new Get_Data_Utility();
                DML_Utility      objDML = new DML_Utility();

                List <tbl_config_value> lstConfig = objGet.Get_Cofig_Details("RABITMQWipro");
                foreach (var ob in lstConfig)
                {
                    strRabbitMQUrl           = ob.configstring;
                    strRabbitMQRequestQueue  = ob.RequestQueue;
                    strRabbitMQResponseQueue = ob.ResponseQueue;
                }
                if (!string.IsNullOrEmpty(strRabbitMQUrl))
                {
                    //queue = queue.ToLower() == "response" ? strRabbitMQResponseQueue : strRabbitMQRequestQueue;
                    queue = strRabbitMQResponseQueue;// strRabbitMQRequestQueue;
                    //hostname = strRabbitMQUrl;
                    var factory = new ConnectionFactory()
                    {
                        HostName = strRabbitMQUrl
                    };
                    string UserName = ConfigurationManager.AppSettings["r_username"];
                    string Password = ConfigurationManager.AppSettings["r_password"];
                    factory.UserName = UserName;
                    factory.Password = Password;
                    //objDML.Add_Exception_Log(strRabbitMQUrl, "");

                    using (var connection = factory.CreateConnection())

                        using (var channel = connection.CreateModel())
                        {
                            //channel.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: null);
                            //var body = Encoding.UTF8.GetBytes(message);
                            //channel.BasicPublish(exchange: "", routingKey: queue, basicProperties: null, body: body);
                            // objDML.Add_Exception_Log(queue, "");
                            channel.QueueDeclare(queue, true, false, false, null);
                            var            consumer = new EventingBasicConsumer(channel);
                            BasicGetResult result   = channel.BasicGet(queue, true);
                            // objDML.Add_Exception_Log(result.Body.ToString(), "");

                            if (result != null)
                            {
                                data =
                                    Encoding.UTF8.GetString(result.Body);
                                //Console.WriteLine(data);
                            }
                        }
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                error = ex.Message.ToString();
                //return false;
                throw ex;
            }
        }
예제 #25
0
        public string Create_Case_Creation_Json_For_FreshCase()
        {
            string           output = "";
            long             ResId  = 0;
            long             ReqId  = 0;
            DML_Utility      objDML = new DML_Utility();
            Get_Data_Utility obj    = new Get_Data_Utility();

            try
            {
                List <tbl_response_detail> lstResponse = obj.Get_Response_Data_ToBe_Process(FilePath_Container.FreshCase);
                if (lstResponse.Count > 0)
                {
                    //objDML.Add_Exception_Log(lstResponse.Count.ToString(), "");

                    string MessageId = "";
                    //MessageId.Split('a').Distinct;
                    string ServiceId = "";

                    string ResJson = "";
                    foreach (var res in lstResponse)
                    {
                        MessageId = res.message_id;
                        ServiceId = res.service_id;
                        ResId     = res.id;
                        ReqId     = (long)res.request_id;
                        ResJson   = res.response_json;
                    }
                    // objDML.Add_Exception_Log("Before API Call", "");

                    string responce_MessageId = "";
                    string responce_ServiceId = "";
                    string Response_Data      = "";
                    //string path = Read_Json_Case_Creation(ResJson, out responce_MessageId, out responce_ServiceId);
                    //objDML.Add_Exception_Log(responce_MessageId, responce_ServiceId);

                    string result    = Read_Json_DataForCaseCreation(ResJson, "metadata", "status", "success");
                    string requestId = Read_Json_TagWise(ResJson, "metadata", "requestId");
                    //string details = Read_Json_TagWise(result, "success" );
                    //string status = Read_Json_Case_Creation_TagValue(ResJson, "Status", "Value");
                    //objDML.Add_Exception_Log(responce_MessageId, responce_ServiceId);

                    //objDML.Add_Exception_Log(status, "");
                    //objDML.Add_Exception_Log(responce_ServiceId, "");
                    fadv_touchlessEntities entit = new fadv_touchlessEntities();


                    if (result.ToLower() == "true")
                    {
                        //if (responce_ServiceId.ToLower() == "Wiprofreshcase")
                        //{

                        //    string Candidte_Id = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Candidte_Id");
                        //    string Check_Initiated = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Check_Initiated");

                        //    tbl_Wipro_Details CandidateDetails = obj.Get_WiproCandiateDetails(Candidte_Id, Check_Initiated);
                        //    string outputParametrs = ConfigurationManager.AppSettings["outputParametrs"];
                        //    Dictionary<string, string> paravalues = getWiproPackageName(Check_Initiated, Candidte_Id, CandidateDetails.Employee_Name, outputParametrs);
                        //    string PackageName = (paravalues.Keys.Contains("package")) ? paravalues["package"] : "";
                        //    string sbu = (paravalues.Keys.Contains("sbu")) ? paravalues["sbu"] : "";

                        //    string clientID = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Client_ID");
                        //    string clientName = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Client_Name");
                        //    string FilePath = Read_Json_Case_Creation_TagValue(ResJson, "Data", "FilePath").Replace("\\", "\\\\")+"\\\\";
                        //    string PONumber = Read_Json_Case_Creation_TagValue(ResJson, "Data", "PO_Number");
                        //    string Database_Sent = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Database_Sent");
                        //    long longClID = Convert.ToInt32(clientID);
                        //    List<tbl_sbu_master> SBUList = entit.tbl_sbu_master.Where(x => x.SBU_Name == sbu && x.ClientID == longClID).ToList<tbl_sbu_master>();
                        //    string SBUIID = "0";
                        //    if (SBUList.Count > 0)
                        //        SBUIID = SBUList[0].SBUID.ToString();
                        //    if (Convert.ToInt64(SBUIID) > 0)
                        //        output = Create_Case_Creation_Json(ReqId, ResId, CandidateDetails, PackageName, Database_Sent, PONumber, FilePath, clientID, SBUIID, clientName, sbuName: sbu, PackageName: PackageName);
                        // }
                    }
                    else
                    {
                        using (fadv_touchlessEntities entities = new fadv_touchlessEntities())
                        {
                            //string ReqMsg = Read_Json_Case_Creation_TagValue(ResJson, "Data", "Request_Id");
                            ////objDML.Add_Exception_Log(ReqMsg, "");

                            tbl_request_details processData = entities.tbl_request_details.Where(x => x.json_text.Contains(requestId)).First();
                            string json    = processData.json_text;
                            string attempt = Read_Json_TagWise(json, "metadata", "attempt");
                            if (attempt == "1")
                            {
                                JObject rss            = JObject.Parse(json);
                                string  queueMessageId = Guid.NewGuid().ToString();
                                rss["metadata"]["attempt"]   = "2";
                                rss["metadata"]["requestId"] = queueMessageId;
                                string updatedJson    = rss.ToString();
                                string queueServiceId = FilePath_Container.FreshCase;
                                output = updatedJson;
                                int iDML = objDML.Add_Request_Json_Detail(queueMessageId, queueServiceId, output);
                                if (iDML == 1)
                                {
                                    string           resumeno = (string)rss["data"][0]["taskSpecs"]["downloadData"]["resumeNumber"];
                                    string           sublogin = (string)rss["data"][0]["taskSpecs"]["downloadData"]["subLogin"];
                                    RabbitMQ_Utility objQueue = new RabbitMQ_Utility();
                                    string           error;
                                    //ret = objQueue.Rabbit_Send(json, "Request", "localhost", out error);
                                    objDML.Add_Exception_Log("Wipro: 2st attempt for Resume No : : " + resumeno + " Sub- Login : "******" has been sent to rabbitMQ ", resumeno);
                                    objQueue.Rabbit_Send(updatedJson, RabbitMQ_Utility.RabbitMQRequestQueue, RabbitMQ_Utility.RabbitMQUrl, out error);
                                }
                            }
                            //processData.active = 0;
                            //entities.SaveChanges();
                            //objDML.Add_Exception_Log("After FailedJson", "");
                        }
                    }
                    objDML.Update_Response_Status(ResId);
                }
            }
            catch (Exception ex)
            {
                output = "ex";
                objDML.Update_Response_Status(ResId);
                //throw ex;
                int iException = objDML.Add_Exception_Log("Wipro exception : " + ex.Message, "Create_Case_Creation_Json_For_FreshCase");
            }

            return(output);
        }