public int MoveRejectedRecordsFromTemp(int processId, UploadType uploadType, AssetGroupType assetGroupType, int createdBy) { //UploadDao uploadDao = new UploadDao(); UploadRejectsDao uploadRejectsDao = new UploadRejectsDao(); try { return(uploadRejectsDao.MoveRejectedRecordsFromTemp(processId, uploadType, assetGroupType, createdBy)); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("MoveRejectedRecordsFromTemp", "UploadRejectsBo.cs:MoveRejectedRecordsFromTemp()"); object[] objects = new object[4]; objects[0] = processId; objects[1] = uploadType; objects[2] = assetGroupType; objects[3] = createdBy; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public bool Reprocess(int processId, UploadType uploadType, AssetGroupType assetGroupType, int currentUser, out int updatedSnapshots, out int updatedHistory) { try { UploadRejectsDao rejectsDao = new UploadRejectsDao(); return(rejectsDao.Reprocess(processId, uploadType, assetGroupType, currentUser, out updatedSnapshots, out updatedHistory)); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Reprocess()", "UploadRejectsDao.cs:Reprocess()"); object[] objects = new object[1]; objects[0] = processId; objects[1] = uploadType; objects[2] = assetGroupType; objects[3] = currentUser; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
/// <summary> /// Iterate through specific dates and update the snapshot table. /// </summary> public void Upload(UploadType uploadType, AssetGroupType assetGroupType) { this.uploadType = uploadType; this.assetGroupType = assetGroupType; GetStartDateAndEndDate(); if (startDate == DateTime.MinValue) { StatusMessage.Append("Snapshot table contains no data.Please update the snapshot table."); return; } else if (endDate == DateTime.MinValue) { StatusMessage.Append("Download table does not contain data."); return; } StatusMessage.Append("<table class='tblMaroon'rules='All' style='font-size:12px;border:solid 1px black;' cellpadding='10'>"); StatusMessage.Append("<thead><tr style='background-image: url(../CSS/Images/PCGGridViewHeaderGlass2.jpg);color:White;'><th>Date</th><th>Xml Created</th><th>Snapshot Updated</th><th>History Upload</th><th>Rejected Records</th></tr></thead>"); if (endDate.CompareTo(startDate) < 0) { isLatestDataAvailable = true; return; } for (DateTime date = startDate; date <= endDate; date = date.AddDays(1)) { errorMessage = string.Empty; Upload(date); } StatusMessage.Append("</table>"); }
public DateTime GetPMTUploadStartDate(UploadType uploadType, AssetGroupType assetGroupType) { DateTime dtStartDate; Database db; DbCommand cmd; try { db = DatabaseFactory.CreateDatabase("wealtherp"); cmd = db.GetStoredProcCommand("SP_GetPMTUploadStartTime"); db.AddInParameter(cmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(cmd, "@AssetGroup", DbType.String, assetGroupType); db.AddOutParameter(cmd, "@OutMaxDate", DbType.DateTime, 50); db.ExecuteReader(cmd); Object maxDate = db.GetParameterValue(cmd, "@OutMaxDate"); if (maxDate != DBNull.Value) { dtStartDate = Convert.ToDateTime(maxDate); } else { dtStartDate = DateTime.MinValue; //This should be considered as invalid date in the calling method } return(dtStartDate); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "UploadBo.cs:GetStarDateAndEndDate()"); object[] objects = new object[3]; objects[0] = uploadType; objects[1] = assetGroupType; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
public bool SaveXmlValuesToTempTable(UploadType uploadType, AssetGroupType assetGroupType, DataTable dtData) { bool blResult = false; Database db; DbCommand deleteCmd; Dictionary <string, string> dicTbls = new Dictionary <string, string>(); dicTbls.Add("productAMCTemp", "dbo.ProductAMCDownloadTemp"); dicTbls.Add("productEQTemp", "dbo.ProductEQNSEDownloadTemp"); try { db = DatabaseFactory.CreateDatabase("wealtherp"); deleteCmd = db.GetStoredProcCommand("SP_TruncateTempTable"); db.AddInParameter(deleteCmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(deleteCmd, "@AssetGroup", DbType.String, assetGroupType); db.ExecuteNonQuery(deleteCmd); if (uploadType == UploadType.Price && assetGroupType == AssetGroupType.MF) { blResult = BulkCopy("dbo.ProductAMCDownloadTemp", dtData); } else if (uploadType == UploadType.Price && assetGroupType == AssetGroupType.Equity) { blResult = BulkCopy("dbo.ProductEQDownloadTemp", dtData); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "UploadDao.cs:SaveXmlValuesToTempTable()"); object[] objects = new object[2]; objects[0] = uploadType; objects[1] = assetGroupType; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(blResult); }
public bool UpdateTempTableWithWERPCode(UploadType uploadType, AssetGroupType assetGroupType) { Database db; DbCommand updateCmd; int affectedRows = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updateCmd = db.GetStoredProcCommand("SP_UpdateTempTableWithWERPCode"); db.AddInParameter(updateCmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(updateCmd, "@AssetGroup", DbType.String, assetGroupType); affectedRows = db.ExecuteNonQuery(updateCmd); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "UploadDao.cs:UpdateTempTableWithWERPCode()"); object[] objects = new object[2]; objects[0] = uploadType; objects[1] = assetGroupType; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } if (affectedRows > 0) { return(true); } else { return(false); } }
public int MoveRejectedRecordsFromTemp(int processId, UploadType uploadType, AssetGroupType assetGroupType, int createdBy) { Database db; DbCommand updateCmd; int affectedRows = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updateCmd = db.GetStoredProcCommand("SP_ProcessPMTUploadReject"); db.AddInParameter(updateCmd, "@ProcessId", DbType.Int32, processId); db.AddInParameter(updateCmd, "@UploadType", DbType.String, uploadType.ToString()); db.AddInParameter(updateCmd, "@AssetGroup", DbType.String, assetGroupType.ToString()); db.AddInParameter(updateCmd, "@CreatedBy", DbType.Int32, createdBy); db.AddOutParameter(updateCmd, "@TotalRejects", DbType.Int32, 10); db.ExecuteNonQuery(updateCmd); affectedRows = Convert.ToInt32(db.GetParameterValue(updateCmd, "@TotalRejects")); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("MoveRejectedRecordsFromTemp", "UploadRejectsDao.cs:MoveRejectedRecordsFromTemp()"); object[] objects = new object[4]; objects[0] = processId; objects[1] = uploadType; objects[2] = assetGroupType; objects[3] = createdBy; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(affectedRows); }
public int UpdateSnapshotTable(UploadType uploadType, AssetGroupType assetGroup, int modifiedBy) { Database db; DbCommand updateCmd; int affectedRows = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updateCmd = db.GetStoredProcCommand("SP_UpdateSnapshotTable"); db.AddInParameter(updateCmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(updateCmd, "@AssetGroup", DbType.String, assetGroup); db.AddInParameter(updateCmd, "@ModifiedBy", DbType.Int32, modifiedBy); db.AddOutParameter(updateCmd, "@ReturnValue", DbType.Int32, 10);//(updateCmd, "@ReturnValue", DbType.Int32, ParameterDirection.ReturnValue); db.ExecuteNonQuery(updateCmd); affectedRows = Convert.ToInt32(db.GetParameterValue(updateCmd, "@ReturnValue")); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "UploadDao.cs:UpdateSnapshotTable()"); object[] objects = new object[2]; objects[0] = uploadType; objects[1] = assetGroup; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(affectedRows); }
private void SetParameters() { if (Request.QueryString["assetGroup"] != null) { assetGroupStr = Request.QueryString["assetGroup"].Trim(); if (assetGroupStr == "MF") { assetGroupType = AssetGroupType.MF; } else if (assetGroupStr == "Equity") { assetGroupType = AssetGroupType.Equity; } lblHeader.Text = assetGroupStr + " " + "Price Rejects"; } if (Request.QueryString["processId"] != null) { processId = Convert.ToInt32(Request.QueryString["processId"]); } }
public DataSet GetDownloadsByDate(DateTime dt, UploadType uploadType, AssetGroupType assetGroup) { DataSet ds = new DataSet(); Database db; DbCommand cmd; try { db = DatabaseFactory.CreateDatabase("marketdb"); cmd = db.GetStoredProcCommand("SP_GetDownloadsByDate"); db.AddInParameter(cmd, "@Date", DbType.DateTime, dt); db.AddInParameter(cmd, "@AssetGroup", DbType.String, assetGroup); db.AddInParameter(cmd, "@UploadType", DbType.String, uploadType); ds = db.ExecuteDataSet(cmd); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "UploadDao.cs:GetDownloadsByDate()"); object[] objects = new object[1]; objects[0] = dt; objects[1] = uploadType; objects[2] = assetGroup; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(ds); }
public DataSet GetRejectedRecords(int processId, int page, out int count, UploadType uploadType, AssetGroupType assetGroupType) { UploadRejectsDao uploadRejectsDao = new UploadRejectsDao(); return(uploadRejectsDao.GetRejectedRecords(processId, page, out count, uploadType, assetGroupType)); }
public DataSet GetRejectedRecords(int processId, int page, out int count, UploadType uploadType, AssetGroupType assetGroupType) { Database db; DbCommand cmd; DataSet dsRejectedRecords = null; count = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); cmd = db.GetStoredProcCommand("SP_GetPMTPriceRejects"); db.AddInParameter(cmd, "@ProcessId", DbType.Int32, processId); db.AddInParameter(cmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(cmd, "@AssetGroup", DbType.String, assetGroupType); db.AddInParameter(cmd, "@CurrentPage", DbType.Int32, page); db.AddOutParameter(cmd, "@Count", DbType.Int32, 10); dsRejectedRecords = db.ExecuteDataSet(cmd); Object objCount = db.GetParameterValue(cmd, "@Count"); if (objCount != DBNull.Value) { count = Convert.ToInt32(objCount); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("GetRejectedRecords()", "UploadRejectsDao.cs:GetRejectedRecords()"); object[] objects = new object[3]; objects[0] = processId; objects[1] = processId; objects[2] = processId; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } return(dsRejectedRecords); }
public bool Reprocess(int processId, UploadType uploadType, AssetGroupType assetGroupType, int currentUser, out int updatedSnapshots, out int updatedHistory) { Database db; DbCommand updateCmd; int affectedRows = 0; updatedSnapshots = 0; updatedHistory = 0; try { db = DatabaseFactory.CreateDatabase("wealtherp"); updateCmd = db.GetStoredProcCommand("SP_ReProcessPMTUploadRejects"); db.AddInParameter(updateCmd, "@ProcessId", DbType.Int32, processId); db.AddInParameter(updateCmd, "@UploadType", DbType.String, uploadType); db.AddInParameter(updateCmd, "@AssetGroup", DbType.String, assetGroupType); db.AddInParameter(updateCmd, "@CurrentUser", DbType.Int32, currentUser); db.AddOutParameter(updateCmd, "@TotalSnapshotsUpdated", DbType.Int32, 10); db.AddOutParameter(updateCmd, "@TotalHistoryUpdated", DbType.Int32, 10); affectedRows = db.ExecuteNonQuery(updateCmd); Object objUpdatedSnapshots = db.GetParameterValue(updateCmd, "@TotalSnapshotsUpdated"); if (objUpdatedSnapshots != DBNull.Value) { updatedSnapshots = Convert.ToInt32(objUpdatedSnapshots); } Object objUpdatedHistory = db.GetParameterValue(updateCmd, "@TotalHistoryUpdated"); if (objUpdatedHistory != DBNull.Value) { updatedHistory = Convert.ToInt32(objUpdatedHistory); } } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Reprocess()", "UploadRejectsDao.cs:Reprocess()"); object[] objects = new object[4]; objects[0] = processId; objects[1] = uploadType; objects[2] = assetGroupType; objects[3] = currentUser; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } if (affectedRows > 0) { return(true); } else { return(false); } }