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); }
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); }