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


C# DBDataHelper类代码示例

本文整理汇总了C#中DBDataHelper的典型用法代码示例。如果您正苦于以下问题:C# DBDataHelper类的具体用法?C# DBDataHelper怎么用?C# DBDataHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DBDataHelper类属于命名空间,在下文中一共展示了DBDataHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateEmployee

    public void CreateEmployee(Employees objEmployee)
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        List<SqlParameter> lstMasterEmployeeDetail = new List<SqlParameter>();
        lstMasterEmployeeDetail.Add(new SqlParameter("@facultyId", objEmployee.Id));
        lstMasterEmployeeDetail.Add(new SqlParameter("@name", objEmployee.Name));
        lstMasterEmployeeDetail.Add(new SqlParameter("@joiningDate", objEmployee.JoiningDate));
        lstMasterEmployeeDetail.Add(new SqlParameter("@gender", objEmployee.Gender));
        lstMasterEmployeeDetail.Add(new SqlParameter("@createdOn", objEmployee.CreatedOn));
        lstMasterEmployeeDetail.Add(new SqlParameter("@isDeleted", false));
        DataTable dt = new DataTable();
        DataSet ds;
        int EmployeeId;
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            ds = objDDBDataHelper.GetDataSet("spCreateEmployee", SQLTextType.Stored_Proc, lstMasterEmployeeDetail);
            EmployeeId = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
        }
        List<SqlParameter> lstEmployeeDetail = new List<SqlParameter>();
        lstEmployeeDetail.Add(new SqlParameter("@employeeId", EmployeeId));
        lstEmployeeDetail.Add(new SqlParameter("@roleId", objEmployee.RoleId));
        lstEmployeeDetail.Add(new SqlParameter("@departmentId", objEmployee.DepartmentId));
        lstEmployeeDetail.Add(new SqlParameter("@contactNumber", objEmployee.ContactNumber));
        lstEmployeeDetail.Add(new SqlParameter("@weeklyOffDay", objEmployee.WeeklyOffDay));
        lstEmployeeDetail.Add(new SqlParameter("@shiftId", objEmployee.ShiftId));
        lstEmployeeDetail.Add(new SqlParameter("@createdAt", objEmployee.CreatedOn));
        lstEmployeeDetail.Add(new SqlParameter("@updatedAt", objEmployee.UpdatedOn));
        lstEmployeeDetail.Add(new SqlParameter("@isDeleted", false));
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            objDDBDataHelper.ExecSQL("spCreateEmployeeTransc", SQLTextType.Stored_Proc, lstEmployeeDetail);
        }

    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:34,代码来源:ManageEmployees.cs

示例2: LeaveFromGivenMasterLeaveType

    public List<TypeOfLeave> LeaveFromGivenMasterLeaveType(int masterLeaveType)
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DBDataHelper helper = new DBDataHelper();
        List<SqlParameter> lstLeaveDetail = new List<SqlParameter>();
        string query = "select Id,Name from tblTypeOfLeave where [email protected]";
        lstLeaveDetail.Add(new SqlParameter("@masterleavetype", masterLeaveType));
        DataTable dt = new DataTable();
        DataSet ds;
        int i = 0;
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstLeaveDetail);
            List<TypeOfLeave> lstLeaveType = new List<TypeOfLeave>();
            foreach (DataRow rows in ds.Tables[0].Rows)
            {
                TypeOfLeave objLeaveType = new TypeOfLeave();
                objLeaveType.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]);
                objLeaveType.Name = (ds.Tables[0].Rows[i][1]).ToString();
                lstLeaveType.Add(objLeaveType);
                i++;
            }
            return lstLeaveType;
        }

    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:26,代码来源:ManageLeaves.cs

示例3: UpdateEmployee

    public bool UpdateEmployee(Employees objEmployee)
    {
        List<SqlParameter> lstEmployeeDetail = new List<SqlParameter>();
        lstEmployeeDetail.Add(new SqlParameter("@employeeId", objEmployee.Id));
        lstEmployeeDetail.Add(new SqlParameter("@gender", objEmployee.Gender));
        lstEmployeeDetail.Add(new SqlParameter("@joiningDate", objEmployee.JoiningDate));
        lstEmployeeDetail.Add(new SqlParameter("@isDeleted", false));
        lstEmployeeDetail.Add(new SqlParameter("@updatedOn", DateTime.Now));
        lstEmployeeDetail.Add(new SqlParameter("@password", objEmployee.Password));
        lstEmployeeDetail.Add(new SqlParameter("@roleId", objEmployee.RoleId));
        lstEmployeeDetail.Add(new SqlParameter("@departmentId", objEmployee.DepartmentId));
        lstEmployeeDetail.Add(new SqlParameter("@contactNumber", objEmployee.ContactNumber));
        lstEmployeeDetail.Add(new SqlParameter("@weeklyOffDay", objEmployee.WeeklyOffDay));
        lstEmployeeDetail.Add(new SqlParameter("@shiftId", objEmployee.ShiftId));
        DataTable dt = new DataTable();
        try
        {
            using (DBDataHelper objDDBDataHelper = new DBDataHelper())
            {
                objDDBDataHelper.ExecSQL("spUpdateEmployeeByEmployeeId", SQLTextType.Stored_Proc, lstEmployeeDetail);

            }
            return true;
        }
        catch(Exception ex)
        {
            return false;
        }
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:29,代码来源:ManageEmployees.cs

示例4: Calendar1_SelectionChanged

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        BindData();
        lblDate.Text = Calendar1.SelectedDate.Date.ToString("d");
        txtHoliday.Text = "";
        btnAddHoliday.Text = "Add Holiday";
        btnAddHoliday.Enabled = true;

        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DBDataHelper helper = new DBDataHelper();
        string query = @"SELECT [NameOfHoliday]
                         FROM [tblHolidays]
                         WHERE Date = @date";
        List<SqlParameter> lst_params = new List<SqlParameter>();
        lst_params.Add(new SqlParameter("@date", Calendar1.SelectedDate));
        DataTable dt = new DataTable();
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            dt = objDDBDataHelper.GetDataTable(query, SQLTextType.Query, lst_params);
            if (dt != null && dt.Rows.Count > 0)
            {
                btnAddHoliday.Enabled = false;
                btnAddHoliday.Text = "Holiday Exists";
                txtHoliday.Text = dt.Rows[0][0] == DBNull.Value ? "" : dt.Rows[0][0].ToString();
            }
        }
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:27,代码来源:AddHoliday.aspx.cs

示例5: GetEmployeesPresentDateWise

 public List<Employees> GetEmployeesPresentDateWise(DateTime dateTime)
 {
     DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
     List<Employees> lstEmployees = new List<Employees>();
     List<SqlParameter> lstAttendanceDetail = new List<SqlParameter>();
     lstAttendanceDetail.Add(new SqlParameter("@date", dateTime));
     int i = 0;
     DataSet ds = new DataSet();
     try
     {
         using (DBDataHelper objDDBDataHelper = new DBDataHelper())
         {
             ds = objDDBDataHelper.GetDataSet("spGetEmployeesPresentDateWise", SQLTextType.Stored_Proc, lstAttendanceDetail);
         }
     }
     catch (Exception ex)
     {
         return lstEmployees;
     }
     foreach (DataRow rows in ds.Tables[0].Rows)
     {
         Employees objEmployees = new Employees();
         objEmployees.Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]);
         objEmployees.FirstName = ds.Tables[0].Rows[i][1].ToString();
         objEmployees.MiddleName = ds.Tables[0].Rows[i][2].ToString();
         objEmployees.LastName = ds.Tables[0].Rows[i][3].ToString();
         lstEmployees.Add(objEmployees);
         i++;
     }
     return lstEmployees;
 }
开发者ID:hmandal,项目名称:BiometricsAttendanceSystem,代码行数:31,代码来源:ManageAttendance.cs

示例6: BindGridData

 public List<AssignLeaveViewModel> BindGridData()
 {
     MasterEntries objMasterEntries = new MasterEntries();
     DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
     DataTable dt = new DataTable();
     List<SqlParameter> lstData = new List<SqlParameter>();
     lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"])));
     lstData.Add(new SqlParameter("@dateMonth", Calendar1.SelectedDate.Month));
     lstData.Add(new SqlParameter("@dateYear", Calendar1.SelectedDate.Year));
     lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0)));
     DataSet ds;
     int i = 0;
     string query = "SELECT Id , LeaveTypeId , [Date] FROM tblLeave WHERE MONTH([Date]) = @dateMonth AND YEAR([Date]) = @dateYear And EmployeeId = @employeeId And IsDeleted = @IsDeleted";
     using (DBDataHelper objDDBDataHelper = new DBDataHelper())
     {
         ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData);
         List<AssignLeaveViewModel> lstLeaves = new List<AssignLeaveViewModel>();
         foreach (DataRow row in ds.Tables[0].Rows)
         {
             AssignLeaveViewModel objLeaves = new AssignLeaveViewModel();
             int Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]);
             int leaveId = Convert.ToInt32(ds.Tables[0].Rows[i][1]);
             Leaves objLeaves1 = new Leaves();
             objMasterEntries.GetLeavesById(leaveId, out objLeaves1);
             objLeaves.leaveId = Id;
             objLeaves.Id = objLeaves1.Id;
             objLeaves.LeaveName = objLeaves1.LeaveName;
             objLeaves.EmployeeId = Convert.ToInt32(Session["employeeId"]);
             objLeaves.Date = (Convert.ToDateTime(ds.Tables[0].Rows[i][2])).Date;
             lstLeaves.Add(objLeaves);
             i++;
         }
         return lstLeaves;
     }
 }
开发者ID:hmandal,项目名称:BiometricsAttendanceSystem,代码行数:35,代码来源:AssignLeaveToEmployee.aspx.cs

示例7: getDataForOldLeavesByEmployeeId

    public LeavesOldStockViewModel getDataForOldLeavesByEmployeeId(DateTime sessionStartDate, DateTime sessionEndDate, int employeeId)
    {
        List<LeavesOldStockViewModel> lstLeavesOldStockViewModel = new List<LeavesOldStockViewModel>();
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DBDataHelper helper = new DBDataHelper();
        List<SqlParameter> lst_params = new List<SqlParameter>();
        lst_params.Add(new SqlParameter("@employeeId", employeeId));
        DataTable dt = new DataTable();
        string query = "SELECT tblEmployeesMaster.Id, Name ,[SLCount],[ELCount],[SessionStartDate],[SesssionEndDate] FROM[tblLeavesOldStock] right outer join tblEmployeesMaster On tblEmployeesMaster.Id = tblLeavesOldStock.EmployeeId Where tblLeavesOldStock.EmployeeId = @employeeId";
        LeavesOldStockViewModel objLeavesOldStockViewModel = new LeavesOldStockViewModel();
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            dt = objDDBDataHelper.GetDataTable(query, SQLTextType.Query, lst_params);
            foreach (DataRow row in dt.Rows)
            {
                objLeavesOldStockViewModel.employeeId = row[0] == DBNull.Value ? 0 : Int32.Parse(row[0].ToString());
                objLeavesOldStockViewModel.employeeName = row[1] == DBNull.Value ? "" : row[1].ToString();
                objLeavesOldStockViewModel.slCount = row[2] == DBNull.Value ? 0 : Int32.Parse(row[2].ToString());
                objLeavesOldStockViewModel.elCount = row[3] == DBNull.Value ? 0 : Int32.Parse(row[3].ToString());
                objLeavesOldStockViewModel.sessionStartDate = row[4] == DBNull.Value ? DateTime.Now : DateTime.Parse(row[4].ToString());
                objLeavesOldStockViewModel.sessionEndDate = row[5] == DBNull.Value ? DateTime.Now : DateTime.Parse(row[5].ToString());
                
            }
        }

        return objLeavesOldStockViewModel;
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:27,代码来源:ManageOldData.aspx.cs

示例8: GetDataForGridview

    public List<AssignLeaveViewModel> GetDataForGridview()
    {
        MasterEntries objMasterEntries = new MasterEntries();
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DateTime sessionStartDate = new DateTime();
        DateTime sessionEndDate = new DateTime();
        if (DateTime.Now.Month <= 7)
        {
            sessionStartDate = new DateTime(DateTime.Now.Year - 1, 8, 1);
            sessionEndDate = new DateTime(DateTime.Now.Year, 7, 31);
        }
        else
        {
            sessionStartDate = new DateTime(DateTime.Now.Year, 8, 1);
            sessionEndDate = new DateTime(DateTime.Now.Year + 1, 7, 31);
        }

        List<SqlParameter> lstData = new List<SqlParameter>();
        lstData.Add(new SqlParameter("@employeeId", Convert.ToInt32(Session["employeeId"])));
        lstData.Add(new SqlParameter("@sessionStartDate", sessionStartDate));
        lstData.Add(new SqlParameter("@sessionEndDate", sessionEndDate));
        lstData.Add(new SqlParameter("@IsDeleted", Convert.ToInt32(0)));

        DataSet ds;
        int i = 0;
        string query = @"SELECT Id , LeaveTypeId , [Date] 
                         FROM tblLeave 
                         WHERE [Date]  >= @sessionStartDate
                         AND [Date] <= @sessionEndDate 
                         AND EmployeeId = @employeeId 
                         AND IsDeleted = @IsDeleted";

        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstData);
            List<AssignLeaveViewModel> lstLeaves = new List<AssignLeaveViewModel>();
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                AssignLeaveViewModel objLeaves = new AssignLeaveViewModel();
                int Id = Convert.ToInt32(ds.Tables[0].Rows[i][0]);
                int leaveId = Convert.ToInt32(ds.Tables[0].Rows[i][1]);
                Leaves objLeaves1 = new Leaves();
                objMasterEntries.GetLeavesById(leaveId, out objLeaves1);
                objLeaves.leaveId = Id;
                objLeaves.Id = objLeaves1.Id;
                objLeaves.LeaveName = objLeaves1.LeaveName;
                objLeaves.EmployeeId = Convert.ToInt32(Session["employeeId"]);
                objLeaves.Date = (Convert.ToDateTime(ds.Tables[0].Rows[i][2])).Date;
                lstLeaves.Add(objLeaves);
                i++;
            }
            return lstLeaves;
        }
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:54,代码来源:AssignLeaveToEmployee.aspx.cs

示例9: BindData

    protected void BindData()
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DBDataHelper helper = new DBDataHelper();
        string query = @"SELECT [Id],[SessionStartDate],[SessionEndDate]
                         FROM [tblSession] ORDER BY [SessionStartDate] DESC";

        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            grdSession.DataSource = objDDBDataHelper.GetDataTable(query, SQLTextType.Query);
            grdSession.DataBind();
        }
    }
开发者ID:hmandal,项目名称:BiometricsAttendanceSystem,代码行数:13,代码来源:AddSession.aspx.cs

示例10: GetDepartmentById

 /// <summary>
 /// 
 /// </summary>
 /// <param name="departmentId"></param>
 /// <returns></returns>
 public string GetDepartmentById(int departmentId)
 {
     DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
     List<SqlParameter> lstDepartment = new List<SqlParameter>();
     lstDepartment.Add(new SqlParameter("@departmentId", departmentId));
     DataTable dt = new DataTable();
     DataSet ds;
     string department;
     using (DBDataHelper objDDBDataHelper = new DBDataHelper())
     {
         ds = objDDBDataHelper.GetDataSet("spGetDepartmentById", SQLTextType.Stored_Proc, lstDepartment);
         department = ds.Tables[0].Rows[0][0].ToString();
     }
     return department;
 }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:20,代码来源:MasterEntries.cs

示例11: GetAllTasksAssignedToAFaculty

 /// <summary>
 /// This method gets all the tasks that are assigned to the faculty based on the id of the faculty.
 /// </summary>
 /// <param name="facultyID">An integer parameter containing the ID of the faculty.</param>
 /// <returns>It returns a dictionary of tasks assigned to the faculty along with the status of each task.</returns>
 public Dictionary<Task, TaskStatusType> GetAllTasksAssignedToAFaculty(int facultyID)
 {
     SqlParameter FacultyID = new SqlParameter("facultyID", facultyID);
     List<SqlParameter> parameterCollection = new List<SqlParameter>(){FacultyID};
     DataTable taskTable = new DataTable();
     using(DBDataHelper helper = new DBDataHelper())
     {
         taskTable = helper.GetDataTable("dbo.GetAllTasksAssignedToAFaculty", SQLTextType.Stored_Proc, parameterCollection);
     }
     //List<Task> tasks = new List<Task>();
     Dictionary<Task, TaskStatusType> tasks = new Dictionary<Task, TaskStatusType>();
     foreach (DataRow row in taskTable.Rows)
     {
         Task task = new Task()
         {
             ID = int.Parse(row["TaskID"].ToString()),
             Name = row["Name"].ToString(),
             Priority = (PriorityType)(Enum.Parse(typeof(PriorityType), row["PriorityID"].ToString())),
             StartDate = DateTime.Parse(row["StartDate"].ToString()),
             EndDate = DateTime.Parse(row["EndDate"].ToString()),
             Description = row["Description"].ToString(),
             Type = (TaskType)(Enum.Parse(typeof(TaskType), row["TaskTypeID"].ToString()))
         };
         TaskStatusType taskStatus = (TaskStatusType)(Enum.Parse(typeof(TaskStatusType),row["TaskStatusID"].ToString()));
         DataTable table = new DataTable();
         SqlParameter HODID = new SqlParameter("ID",row["HODID"]);
         List<SqlParameter> collection = new List<SqlParameter>(){HODID};
         using(DBDataHelper helper = new DBDataHelper())
         {
             table = helper.GetDataTable("dbo.GetFacultyByID", SQLTextType.Stored_Proc, collection);
         }
         HOD hod = new HOD()
         {
             ID = int.Parse(table.Rows[0]["FacultyID"].ToString()),
             Name = table.Rows[0]["Name"].ToString(),
             EmailID = table.Rows[0]["EmailID"].ToString(),
             Designation = DesignationType.HOD,
             Department = (DepartmentType)(Enum.Parse(typeof(DepartmentType),table.Rows[0]["DepartmentID"].ToString())),
             ImageURL = table.Rows[0]["ImageURL"].ToString(),
             ContactNo = table.Rows[0]["ContactNo"].ToString()
         };
         task.AssignedBy = hod;
         task.AssignedTo = GetAllFacultiesHavingTheTask(task.ID);
         tasks.Add(task,taskStatus);
     }
     return tasks;
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:52,代码来源:FacultyRepository.cs

示例12: btnUpdate_Click

    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        List<LeaveAssignedRecord> lstLeaveAssignedRecord = new List<LeaveAssignedRecord>();
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DataSet ds;
        int leaveId;
        LeaveAssignedPerSession objLeaveAssignedPerSession = new LeaveAssignedPerSession();
        ManageReports objManageReports = new ManageReports();
        foreach (RepeaterItem i in EditgvLeaves.Items)
        {
            TextBox txtLeaveCount = (TextBox)i.FindControl("txtLeaveCount");
            Label txtLeaveName = (Label)i.FindControl("txtLeave");
            string leaveName = txtLeaveName.Text;
            List<SqlParameter> lstParams = new List<SqlParameter>();
            lstParams.Add(new SqlParameter("@name", leaveName));
            string query = "Select Id from tblTypeOfLeave where Name = @name";
            using (DBDataHelper objDDBDataHelper = new DBDataHelper())
            {
                ds = objDDBDataHelper.GetDataSet(query, SQLTextType.Query, lstParams);
                leaveId = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
            }

            DateTime SessionStartDate, SessionEndDate;
            if (DateTime.Now.Month >= 8)
            {
                SessionStartDate = new DateTime(DateTime.Now.Year, 08, 01);
                SessionEndDate = new DateTime(DateTime.Now.Year+1, 07, 31);
            }
            else
            {
                SessionStartDate = new DateTime(DateTime.Now.Year-1, 08, 01);
                SessionEndDate = new DateTime(DateTime.Now.Year, 07, 31);
            }
            objLeaveAssignedPerSession.EmployeeId = Convert.ToInt32(Session["empId"]);
            objLeaveAssignedPerSession.leaveCount = Convert.ToInt32(txtLeaveCount.Text);
            objLeaveAssignedPerSession.leaveType = leaveId;
            objManageReports.UpdateLeavesAssignedPerSessionEmployeeWise(objLeaveAssignedPerSession, SessionStartDate,SessionEndDate);
        }

        popupEditLeaveAssigned.Hide();

        int departmentId = Convert.ToInt32(ddlShowDepartment.SelectedValue);
        ManageReports objManageReports1 = new ManageReports();
        lstLeaveAssignedRecord = objManageReports1.GetLeavesAssignedPerSession(departmentId, DateTime.Now);
        //grid1.DataSource = lstLeaveAssignedRecord;
        //grid1.DataBind();
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:47,代码来源:ViewEmployeeLeaves.aspx.cs

示例13: BindData

    protected void BindData()
    {
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;
        DBDataHelper helper = new DBDataHelper();
        string query = @"SELECT [Id],[NameOfHoliday],[Status],[Date]
                             FROM [tblHolidays]
                             WHERE year([Date]) = year(@date)";

        List<SqlParameter> lst_params = new List<SqlParameter>();
        lst_params.Add(new SqlParameter("@date", Calendar1.SelectedDate));

        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            grdHoliday.DataSource = objDDBDataHelper.GetDataTable(query, SQLTextType.Query, lst_params);
            grdHoliday.DataBind();
        }
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:17,代码来源:AddHoliday.aspx.cs

示例14: btnAddSession_Click

    protected void btnAddSession_Click(object sender, EventArgs e)
    {
        #region Add_Session
        DBDataHelper.ConnectionString = ConfigurationManager.ConnectionStrings["CSBiometricAttendance"].ConnectionString;

        DateTime sessionStartDate = new DateTime(Int32.Parse(DateTime.Now.Year.ToString()), 8, 1);
        DateTime sessionEndDate = new DateTime(sessionStartDate.Year + 1, 7, 31);

        string query = "Select Count(*) from tblSession Where [email protected]";
        List<SqlParameter> lstParams = new List<SqlParameter>();
        lstParams.Add(new SqlParameter("@sessionStartDate", sessionStartDate));
        DataTable ds = new DataTable();
        using (DBDataHelper objDDBDataHelper = new DBDataHelper())
        {
            ds = objDDBDataHelper.GetDataTable(query, SQLTextType.Query, lstParams);
        }

        if (ds.Rows.Count != 0)
            if (Int32.Parse(ds.Rows[0][0].ToString()) == 0)
            {

                string addSession = @"INSERT INTO [dbo].[tblSession]
                                      ([SessionStartDate]
                                       ,[SessionEndDate])
                                       VALUES (@sessionStartDate,@sessionEndDate)";

                List<SqlParameter> lstParams2 = new List<SqlParameter>();
                lstParams2.Add(new SqlParameter("@sessionStartDate", sessionStartDate));
                lstParams2.Add(new SqlParameter("@sessionEndDate", sessionEndDate));

                using (DBDataHelper objDDBDataHelper = new DBDataHelper())
                {
                    objDDBDataHelper.ExecSQL(addSession, SQLTextType.Query, lstParams2);
                }
                ManageReports objManageReprts = new ManageReports();
                objManageReprts.AssignSessionWiseLeave(sessionStartDate);
                objManageReprts.UpdateLeaveBalanceTable(sessionStartDate);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Session Added')", true);
            }
            else
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Session Exists')", true);
            }
        #endregion
    }
开发者ID:AnupKumarGupta,项目名称:BiometricsAttendanceSystem,代码行数:45,代码来源:Script.aspx.cs

示例15: DeleteEmployee

 public bool DeleteEmployee(long employeeId)
 {
     List<SqlParameter> lstEmployeeDetail = new List<SqlParameter>();
     lstEmployeeDetail.Add(new SqlParameter("@employeeId", employeeId));
     DataTable dt = new DataTable();
     try
     {
         using (DBDataHelper objDDBDataHelper = new DBDataHelper())
         {
             objDDBDataHelper.ExecSQL("spDeleteEmployee", SQLTextType.Stored_Proc, lstEmployeeDetail);
         }
         return true;
     }
     catch (Exception ex)
     {
         return false;
     }
 }
开发者ID:hmandal,项目名称:BiometricsAttendanceSystem,代码行数:18,代码来源:ManageEmployees.cs


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