当前位置: 首页>>代码示例>>C#>>正文


C# DataAccessLayer类代码示例

本文整理汇总了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;
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:32,代码来源:PriviledgeManager.cs

示例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;
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:35,代码来源:AcrController.cs

示例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();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:33,代码来源:QueryConroller.cs

示例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;
        }
开发者ID:nrag,项目名称:yapper,代码行数:29,代码来源:MessageStore.cs

示例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");
        //}
    }
开发者ID:PriyaSekhar,项目名称:WebSite_GitHub,代码行数:26,代码来源:Home.aspx.cs

示例6: SysUserMasterDA

 public SysUserMasterDA()
 {
     if (db == null)
     {
         db = new DataAccessLayer();
     }
 }
开发者ID:Klutzdon,项目名称:PBIMSN,代码行数:7,代码来源:SysUserMasterDA.cs

示例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;
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:27,代码来源:ModelManager.cs

示例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;
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:33,代码来源:ModelManager.cs

示例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;
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:34,代码来源:ReworkCostManager.cs

示例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();
    }
开发者ID:TuoKy,项目名称:IIO13200-HTYO-LeppanenKytta,代码行数:33,代码来源:Test.aspx.cs

示例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();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:33,代码来源:ProductionController.cs

示例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;
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:26,代码来源:MonthOpenCloseManager.cs

示例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;
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:26,代码来源:AcrManager.cs

示例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();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:27,代码来源:QueryManager.cs

示例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();
        }
    }
开发者ID:krishnakant,项目名称:WMS,代码行数:27,代码来源:QueryManager.cs


注:本文中的DataAccessLayer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。