public DataSet SaveFileDetails(LeadBatchFile objFiles_Info, ref Int64 lngReturn, string sVehicleTypeiD) { bool returnValue = false; DataSet ds = new DataSet(); string spNameString = string.Empty; //Connect to the database Database dbDatabase = DatabaseFactory.CreateDatabase(Global.INSTANCE_NAME4); spNameString = "[USP_Lead_BatchUpload]"; DbCommand dbCommand = null; try { //Assign stored procedure to the command object dbCommand = dbDatabase.GetStoredProcCommand(spNameString); //Assign stored procedure parameters dbDatabase.AddInParameter(dbCommand, "@Leaddate", DbType.String, objFiles_Info.Leaddate); dbDatabase.AddInParameter(dbCommand, "@LeadFile", DbType.String, objFiles_Info.LeadFile); dbDatabase.AddInParameter(dbCommand, "@LeadCount", DbType.String, objFiles_Info.RecordCount); dbDatabase.AddInParameter(dbCommand, "@Leadsource", DbType.String, objFiles_Info.Leadsource); dbDatabase.AddInParameter(dbCommand, "@LeadUploadedBy", DbType.String, objFiles_Info.LeadUploadedBy); dbDatabase.AddInParameter(dbCommand, "@VehicleTypeID", DbType.String, sVehicleTypeiD); //Executing stored procedure ds = dbDatabase.ExecuteDataSet(dbCommand); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { lngReturn = Convert.ToInt64(ds.Tables[0].Rows[0][0].ToString()); } } } returnValue = true; } catch (Exception ex) { bool rethrow = ExceptionPolicy.HandleException(ex, Global.EXCEPTION_POLICY); if (rethrow) throw; } finally { dbDatabase = null; } return ds; }
private void SalesfilesUpload(int RecordCount, string sFileName) { try { Int64 Return = 0; LeadBatchFile objLeadBatchFile = new LeadBatchFile(); LeadsBL objLeadsBL = new LeadsBL(); objLeadBatchFile.Leaddate = System.DateTime.Now.ToString(); objLeadBatchFile.LeadFile = sFileName; objLeadBatchFile.RecordCount = RecordCount.ToString(); objLeadBatchFile.LeadUploadedBy = (Session[Constants.USER_ID]).ToString(); objLeadBatchFile.Leadsource = "1"; DataSet ds = new DataSet(); ds = objLeadsBL.SaveFileDetails(objLeadBatchFile, ref Return, ddlVehicleType.SelectedItem.Value); Session["FileId"] = ds.Tables[0].Rows[0][0].ToString(); } catch (Exception ex) { //bool rethrow = ExceptionPolicy.HandleException(ex, ConstantClass.StrCRMUIPolicy); throw ex; //if (rethrow) // throw; //Redirecting to error message page //Server.Transfer(ConstantClass.StrErrorPageURL); } }