本文整理汇总了C#中DataAccessLayer类的典型用法代码示例。如果您正苦于以下问题:C# DataAccessLayer类的具体用法?C# DataAccessLayer怎么用?C# DataAccessLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DataAccessLayer类属于命名空间,在下文中一共展示了DataAccessLayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Save
public int Save(PriviledgeDB objDB, SqlTransaction objTrans)
{
int PriviledgeID = 0;
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "usp_Priviledges";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@FormID", objDB.FormID);
objCmd.Parameters.AddWithValue("@RoleID", objDB.RoleID);
objCmd.Parameters.AddWithValue("@viewing", objDB.viewing);
objCmd.Parameters.AddWithValue("@PriviledgeID", SqlDbType.Int);
objCmd.Parameters["@PriviledgeID"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
PriviledgeID = Convert.ToInt32(objCmd.Parameters["@PriviledgeID"].Value);
return PriviledgeID;
}
catch (Exception ex)
{
throw ex;
}
}
示例2: getModelMapping
public int getModelMapping(Int64 TractorNo)
{
int ModelMappingID = 0;
bool flagTransation = true;
DataAccessLayer objDataAccess = new DataAccessLayer();
SqlTransaction objTrans = null;
try
{
if (objTrans == null)
{
flagTransation = false;
objDataAccess.GetConnection.Open();
SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction();
objTrans = objTransaction;
}
AcrManager objManager = new AcrManager();
ModelMappingID = objManager.getModelMapping(TractorNo, objTrans);
if (!flagTransation)
objTrans.Commit();
}
catch (Exception ex)
{
if (!flagTransation)
objTrans.Rollback();
throw ex;
}
finally
{
objDataAccess.GetConnection.Close();
}
return ModelMappingID;
}
示例3: ExecuteQuery
public DataTable ExecuteQuery(string Query)
{
bool flagTransation = true;
DataAccessLayer objDataAccess = new DataAccessLayer();
SqlTransaction objTrans = null;
try
{
if (objTrans == null)
{
flagTransation = false;
objDataAccess.GetConnection.Open();
SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction();
objTrans = objTransaction;
}
QueryManager objManager = new QueryManager();
DataTable dtQueryResult = objManager.ExecuteQuery(Query, objTrans);
if (!flagTransation)
objTrans.Commit();
return dtQueryResult;
}
catch (Exception ex)
{
if (!flagTransation)
objTrans.Rollback();
throw ex;
}
finally
{
objDataAccess.GetConnection.Close();
}
}
示例4: GetAllMessagesForUser
public List<Message> GetAllMessagesForUser(DataAccessLayer.User user, DateTime? syncTime)
{
DateTime now = DateTime.UtcNow;
DateTime nonNullSyncTime = syncTime ?? DateTime.UtcNow - new TimeSpan(7, 0, 0, 0);
List<SortCriteria> sorts = new List<SortCriteria>();
sorts.Add(new SortCriteria() { Column= MessageTable.LastUpdateTimeUtcTicksColumn, SortOrder = SortOrder.Descending });
// Create a filter to say Select * from MessageTable where (Sender = @userId OR Recipient = @userId OR Recipient = @groupThatUserIsAMemberOf) AND LastUpdateTime > @syncTime
QueryFilter filter = new SelectFilter(
MessageTable.Instance,
new AndFilter(
MessageStore.CreateUserFilter(user),
new ComparisonFilter(MessageTable.LastUpdateTimeUtcTicksColumn, nonNullSyncTime.Ticks, ComparisonOperator.Greater)),
sorts);
List<ITableRow> rows = MessageTable.Instance.QueryRows(filter);
List<Message> messages = new List<Message>();
if (rows != null)
{
for (int i = 0; i < rows.Count; i++)
{
messages.Add(DataContractToTableRowConverter.ConvertToMessage(MessageTable.Instance, rows[i]));
}
}
DataAccessLayer.UserService.UpdateUserLastSyncTime(user.Id, now);
return messages;
}
示例5: Button_Databases_Click
protected void Button_Databases_Click(object sender, EventArgs e)
{
DataAccessLayer dal = new DataAccessLayer();
resetPanelsAndLabels();
DataTable databases = dal.getDatabaseNames();
if (databases.Rows.Count > 0)
{
Panel_Databases.Visible = true;
GridView_Databases.DataSource = databases;
GridView_Databases.DataBind();
}
else
{
PanelErrorMessages.Visible = true;
Label_ErrorMessage.Visible = true;
Label_ErrorMessage.Text = String.Format("There is some error while connecting to the server " );
}
//foreach (DataRow database in databases.Rows)
//{
// String databaseName = database.Field<String>("database_name");
// short dbID = database.Field<short>("dbid");
// DateTime creationDate = database.Field<DateTime>("create_date");
//}
}
示例6: SysUserMasterDA
public SysUserMasterDA()
{
if (db == null)
{
db = new DataAccessLayer();
}
}
示例7: CheckMaterial
public int CheckMaterial(ModelDB objDB, SqlTransaction objTrans)
{
int flag = 0;
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "Usp_CheckMaterial";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@Material", objDB.Material);
objCmd.Parameters.AddWithValue("@flag", SqlDbType.Int);
objCmd.Parameters["@flag"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
flag = Convert.ToInt32(objCmd.Parameters["@flag"].Value);
return flag;
}
catch (Exception ex)
{
throw ex;
}
}
示例8: SaveModelDetail
public int SaveModelDetail(ModelDB objDB, SqlTransaction objTrans)
{
int MappingID = 0;
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "Usp_SaveModelMapping";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@Material", objDB.Material);
objCmd.Parameters.AddWithValue("@GroupID", objDB.GroupID);
objCmd.Parameters.AddWithValue("@ModelSpecialID", objDB.ModelSpecialID);
objCmd.Parameters.AddWithValue("@ClutchTypeID", objDB.ClutchTypeID);
objCmd.Parameters.AddWithValue("@ModelCategoryID", objDB.ModelCategoryID);
objCmd.Parameters.AddWithValue("@Description", objDB.Description);
objCmd.Parameters.AddWithValue("@MappingID", SqlDbType.Int);
objCmd.Parameters["@MappingID"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
MappingID = Convert.ToInt32(objCmd.Parameters["@MappingID"].Value);
return MappingID;
}
catch (Exception ex)
{
throw ex;
}
}
示例9: SaveReworkCost
public int SaveReworkCost(ReworkCostDB objDB, SqlTransaction objTrans)
{
int ID = 0;
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "usp_SaveReworkCost";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@MonthID", objDB.MonthID);
objCmd.Parameters.AddWithValue("@YearID", objDB.YearID);
objCmd.Parameters.AddWithValue("@ModelGroupID", objDB.GroupID);
objCmd.Parameters.AddWithValue("@ReworkCost_I_Year", objDB.ReworkCost_I_Year);
objCmd.Parameters.AddWithValue("@ReworkCost_II_Year", objDB.ReworkCost_II_Year);
objCmd.Parameters.AddWithValue("@ModelCategoryID", objDB.ModelCategoryID);
objCmd.Parameters.AddWithValue("@HMR_Range", objDB.HMR_Range);
objCmd.Parameters.AddWithValue("@ID", SqlDbType.Int);
objCmd.Parameters["@ID"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
ID = Convert.ToInt32(objCmd.Parameters["@ID"].Value);
return ID;
}
catch (Exception ex)
{
throw ex;
}
}
示例10: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
HttpResponse<string> response = Unirest.get("https://omgvamp-hearthstone-v1.p.mashape.com/cards?collectible=1")
.header("X-Mashape-Key", "Y6G2Ve8iAOmshQFq4sGVgvBtI1HVp1CVLrWjsnPikTu4oqy2EK")
.asJson<string>();
CardCollection collection = new CardCollection();
collection = JsonConvert.DeserializeObject<CardCollection>(response.Body);
List<Card> cards = new List<Card>();
cards.AddRange(collection.basic);
cards.AddRange(collection.classic);
cards.AddRange(collection.naxxramas);
cards.AddRange(collection.gvg);
cards.AddRange(collection.blackrock);
cards.AddRange(collection.grandTournament);
cards.AddRange(collection.leagueOfExplorers);
DataAccessLayer layer1 = new DataAccessLayer();
try
{
layer1.InsertCardsToDb(cards);
}
catch (Exception)
{
ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertBox", "alert('Kortit jo kannassa');", true);
}
//Grid.DataSource = cards as IEnumerable<Card>;
Grid.DataSource = cards as IEnumerable<Card>;
Grid.DataBind();
}
示例11: SaveProductionData
public void SaveProductionData()
{
bool flagTransation = true;
DataAccessLayer objDataAccess = new DataAccessLayer();
SqlTransaction objTrans = null;
try
{
if (objTrans == null)
{
flagTransation = false;
objDataAccess.GetConnection.Open();
SqlTransaction objTransaction = objDataAccess.GetConnection.BeginTransaction();
objTrans = objTransaction;
}
ProductionManager objManager = new ProductionManager();
objManager.SaveProductionData(objTrans);
if (!flagTransation)
objTrans.Commit();
}
catch (Exception ex)
{
if (!flagTransation)
objTrans.Rollback();
throw ex;
}
finally
{
objDataAccess.GetConnection.Close();
}
}
示例12: SaveMonthOpenClose
public void SaveMonthOpenClose(MonthOpenCloseDB objDB, SqlTransaction objTrans)
{
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "usp_SaveMonthOpenClose";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@MonthID", objDB.MonthID);
objCmd.Parameters.AddWithValue("@YearID", objDB.YearID);
objCmd.Parameters.AddWithValue("@Status", objDB.Status);
objCmd.Parameters.AddWithValue("@id", SqlDbType.Int);
objCmd.Parameters["@id"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
}
catch (Exception ex)
{
throw ex;
}
}
示例13: getModelMapping
public int getModelMapping(Int64 TractorNo, SqlTransaction objTrans)
{
int ModelMappingID = 0;
DataAccessLayer objDataLayer = new DataAccessLayer();
SqlCommand objCmd = new SqlCommand();
try
{
objCmd.CommandText = "usp_getModelMappingID";
objCmd.CommandType = CommandType.StoredProcedure;
objCmd.Parameters.AddWithValue("@TRACTOR_NO", TractorNo);
objCmd.Parameters.AddWithValue("@ModelMappingID", SqlDbType.Int);
objCmd.Parameters["@ModelMappingID"].Direction = ParameterDirection.Output;
objCmd.Transaction = objTrans;
objCmd.Connection = objTrans.Connection;
objDataLayer.Command = objCmd;
objDataLayer.ExecQuery();
ModelMappingID = Convert.ToInt32(objCmd.Parameters["@ModelMappingID"].Value);
}
catch (Exception ex)
{
throw ex;
}
return ModelMappingID;
}
示例14: ExecuteMultiTableQuery
public DataSet ExecuteMultiTableQuery(string strQuery, SqlTransaction objTrans)
{
SqlCommand cmd = new SqlCommand();
DataAccessLayer objDataAccess = new DataAccessLayer();
try
{
cmd.CommandText = strQuery;
cmd.CommandType = CommandType.Text;
cmd.CommandTimeout = 1000;
cmd.Transaction = objTrans;
cmd.Connection = objTrans.Connection;
objDataAccess.Command = cmd;
DataSet ds = new DataSet();
SqlDataAdapter Sda = new SqlDataAdapter(cmd);
Sda.Fill(ds);
return ds;
}
catch (Exception ex)
{
throw ex;
}
finally
{
cmd.Dispose();
}
}
示例15: ExecuteQueryWithDataSet
public DataSet ExecuteQueryWithDataSet(string strQuery, SqlTransaction objTrans)
{
SqlCommand cmd = new SqlCommand();
DataAccessLayer objDataAccess = new DataAccessLayer();
try
{
cmd.CommandText = "execute usp_getMultipleTable '" + strQuery + "'";
cmd.CommandType = CommandType.Text;
cmd.Transaction = objTrans;
cmd.Connection = objTrans.Connection;
objDataAccess.Command = cmd;
DataSet ds = new DataSet();
SqlDataAdapter Sda = new SqlDataAdapter(cmd);
Sda.Fill(ds);
return ds;
}
catch (Exception ex)
{
throw ex;
}
finally
{
cmd.Dispose();
}
}