public static HR_LunchRule GetHR_LunchRuleByLunchRuleID(int LunchRuleID) { HR_LunchRule hR_LunchRule = new HR_LunchRule(); SqlHR_LunchRuleProvider sqlHR_LunchRuleProvider = new SqlHR_LunchRuleProvider(); hR_LunchRule = sqlHR_LunchRuleProvider.GetHR_LunchRuleByLunchRuleID(LunchRuleID); return hR_LunchRule; }
public static HR_LunchRule GetHR_LunchRuleByEmployeeID(string EmployeeID) { HR_LunchRule hR_LunchRules = new HR_LunchRule(); SqlHR_LunchRuleProvider sqlHR_LunchRuleProvider = new SqlHR_LunchRuleProvider(); hR_LunchRules = sqlHR_LunchRuleProvider.GetHR_LunchRuleByEmployeeID(EmployeeID); return hR_LunchRules; }
private void showHR_LunchRuleData() { HR_LunchRule hR_LunchRule = new HR_LunchRule (); hR_LunchRule = HR_LunchRuleManager.GetHR_LunchRuleByLunchRuleID(Int32.Parse(Request.QueryString["ID"])); txtLunchOutTimeHours.Text =hR_LunchRule.LunchOutTimeHours.ToString(); txtLunchOutTimeMins.Text =hR_LunchRule.LunchOutTimeMins.ToString(); txtLunchFlexibleTimeHours.Text =hR_LunchRule.LunchFlexibleTimeHours.ToString(); txtLunchFlexibleTimeMins.Text =hR_LunchRule.LunchFlexibleTimeMins.ToString(); txtLunchTimeAllowed.Text =hR_LunchRule.LunchTimeAllowed.ToString(); radLunchFlag.SelectedValue =hR_LunchRule.LunchFlag.ToString(); }
protected void btnUpdate_Click(object sender, EventArgs e) { HR_LunchRule hR_LunchRule = new HR_LunchRule (); hR_LunchRule.LunchRuleID= int.Parse(Request.QueryString["ID"].ToString()); hR_LunchRule.EmployeeID = Profile.card_id; hR_LunchRule.LunchOutTimeHours= int.Parse(txtLunchOutTimeHours.Text); hR_LunchRule.LunchOutTimeMins= int.Parse(txtLunchOutTimeMins.Text); hR_LunchRule.LunchFlexibleTimeHours= int.Parse(txtLunchFlexibleTimeHours.Text); hR_LunchRule.LunchFlexibleTimeMins= int.Parse(txtLunchFlexibleTimeMins.Text); hR_LunchRule.LunchTimeAllowed= int.Parse(txtLunchTimeAllowed.Text); hR_LunchRule.LunchFlag = radLunchFlag.SelectedValue == "True" ? true : false; ; hR_LunchRule.AddedBy= Profile.card_id; hR_LunchRule.AddedDate= DateTime.Now; hR_LunchRule.ModifiedBy= Profile.card_id; hR_LunchRule.ModifiedDate= DateTime.Now; bool resutl =HR_LunchRuleManager.UpdateHR_LunchRule(hR_LunchRule); Response.Redirect("AdminDisplayHR_LunchRule.aspx"); }
protected void btnAdd_Click(object sender, EventArgs e) { HR_LunchRule hR_LunchRule = new HR_LunchRule (); // hR_LunchRule.LunchRuleID= int.Parse(ddlLunchRuleID.SelectedValue); hR_LunchRule.EmployeeID = Profile.card_id; hR_LunchRule.LunchOutTimeHours= int.Parse(txtLunchOutTimeHours.Text); hR_LunchRule.LunchOutTimeMins= int.Parse(txtLunchOutTimeMins.Text); hR_LunchRule.LunchFlexibleTimeHours= int.Parse(txtLunchFlexibleTimeHours.Text); hR_LunchRule.LunchFlexibleTimeMins= int.Parse(txtLunchFlexibleTimeMins.Text); hR_LunchRule.LunchTimeAllowed= int.Parse(txtLunchTimeAllowed.Text); hR_LunchRule.LunchFlag = radLunchFlag.SelectedValue == "True" ? true : false; ; hR_LunchRule.AddedBy= Profile.card_id; hR_LunchRule.AddedDate= DateTime.Now; hR_LunchRule.ModifiedBy= Profile.card_id; hR_LunchRule.ModifiedDate= DateTime.Now; int resutl =HR_LunchRuleManager.InsertHR_LunchRule(hR_LunchRule); Response.Redirect("AdminDisplayHR_LunchRule.aspx"); }
public static int InsertHR_LunchRule(HR_LunchRule hR_LunchRule) { SqlHR_LunchRuleProvider sqlHR_LunchRuleProvider = new SqlHR_LunchRuleProvider(); return sqlHR_LunchRuleProvider.InsertHR_LunchRule(hR_LunchRule); }
public static bool UpdateHR_LunchRule(HR_LunchRule hR_LunchRule) { SqlHR_LunchRuleProvider sqlHR_LunchRuleProvider = new SqlHR_LunchRuleProvider(); return sqlHR_LunchRuleProvider.UpdateHR_LunchRule(hR_LunchRule); }
protected void btnAddLunchRule_Click(object sender, EventArgs e) { if (hfEmployeeID.Value != null) { string txtStartHour = this.ddlLunchTimeStartHour.SelectedValue.ToString(); string txtStartMin = this.ddlLunchTimeStartMinute.SelectedValue.ToString(); string txtStartTime = DateTime.Now.ToShortDateString() + " " + txtStartHour + " : " + txtStartMin + ": 00"; DateTime dtStartTime = Convert.ToDateTime(txtStartTime); string txtEndHour = this.ddlLunchTimeEndHour.SelectedValue.ToString(); string txtEndMin = this.ddlLunchTimeEndMinute.SelectedValue.ToString(); string txtEndTime = DateTime.Now.ToShortDateString() + " " + txtEndHour + " : " + txtEndMin + ": 00"; DateTime dtEndTime = Convert.ToDateTime(txtEndTime); HR_LunchRule hR_LunchRule = new HR_LunchRule(); hR_LunchRule.EmployeeID = hfEmployeeID.Value.ToString(); hR_LunchRule.LunchTimeStart = dtStartTime; hR_LunchRule.LunchTimeEnd = dtEndTime; hR_LunchRule.LunchFlexibleTimeMins = Convert.ToInt32(ddlLunchFlexibleTimeMins.SelectedValue); hR_LunchRule.LunchTimeAllowed = 0;// int.Parse(txtLunchTimeAllowed.Text); hR_LunchRule.LunchFlag = radLunchFlag.SelectedValue == "True" ? true : false; string userID = Profile.card_id; hR_LunchRule.AddedBy = userID; hR_LunchRule.AddedDate = DateTime.Now; hR_LunchRule.ModifiedBy = userID; hR_LunchRule.ModifiedDate = DateTime.Now; if (hdnLunchRuleID.Value == string.Empty) { int resutl = HR_LunchRuleManager.InsertHR_LunchRule(hR_LunchRule); lblLunchMsg.Text = "Lunch rule Information is saved successfully"; hdnLunchRuleID.Value = resutl.ToString(); } else { hR_LunchRule.LunchRuleID = Convert.ToInt32(hdnLunchRuleID.Value); HR_LunchRuleManager.UpdateHR_LunchRule(hR_LunchRule); lblLunchMsg.Text = "Lunch rule Information is updated successfully"; } lblLunchMsg.ForeColor = System.Drawing.Color.Green; } else { lblLunchMsg.Text = "Employee is not specified."; lblLunchMsg.ForeColor = System.Drawing.Color.Red; } UpdatePanel1.Update(); }
public bool UpdateHR_LunchRule(HR_LunchRule hR_LunchRule) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateHR_LunchRule", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@LunchRuleID", SqlDbType.Int).Value = hR_LunchRule.LunchRuleID; cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar).Value = hR_LunchRule.EmployeeID; cmd.Parameters.Add("@LunchTimeStart", SqlDbType.DateTime).Value = hR_LunchRule.LunchTimeStart; cmd.Parameters.Add("@LunchTimeEnd", SqlDbType.DateTime).Value = hR_LunchRule.LunchTimeEnd; cmd.Parameters.Add("@LunchFlexibleTimeMins", SqlDbType.Int).Value = hR_LunchRule.LunchFlexibleTimeMins; cmd.Parameters.Add("@LunchTimeAllowed", SqlDbType.Int).Value = hR_LunchRule.LunchTimeAllowed; cmd.Parameters.Add("@LunchFlag", SqlDbType.Bit).Value = hR_LunchRule.LunchFlag; cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = hR_LunchRule.ModifiedBy; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = hR_LunchRule.ModifiedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public int InsertHR_LunchRule(HR_LunchRule hR_LunchRule) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("InsertHR_LunchRule", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@LunchRuleID", SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add("@EmployeeID", SqlDbType.NVarChar).Value = hR_LunchRule.EmployeeID; cmd.Parameters.Add("@LunchTimeStart", SqlDbType.DateTime).Value = hR_LunchRule.LunchTimeStart; cmd.Parameters.Add("@LunchTimeEnd", SqlDbType.DateTime).Value = hR_LunchRule.LunchTimeEnd; cmd.Parameters.Add("@LunchFlexibleTimeMins", SqlDbType.Int).Value = hR_LunchRule.LunchFlexibleTimeMins; cmd.Parameters.Add("@LunchTimeAllowed", SqlDbType.Int).Value = hR_LunchRule.LunchTimeAllowed; cmd.Parameters.Add("@LunchFlag", SqlDbType.Bit).Value = hR_LunchRule.LunchFlag; cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = hR_LunchRule.AddedBy; cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = hR_LunchRule.AddedDate; cmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar).Value = hR_LunchRule.ModifiedBy; cmd.Parameters.Add("@ModifiedDate", SqlDbType.DateTime).Value = /*(object)DBNull.Value;*/hR_LunchRule.ModifiedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return (int)cmd.Parameters["@LunchRuleID"].Value; } }
public HR_LunchRule GetHR_LunchRuleFromReader(IDataReader reader) { try { HR_LunchRule hR_LunchRule = new HR_LunchRule ( DataAccessObject.IsNULL<int>(reader["LunchRuleID"]), DataAccessObject.IsNULL<string>(reader["EmployeeID"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["LunchTimeStart"]), DataAccessObject.IsNULL<DateTime>(reader["LunchTimeEnd"]), DataAccessObject.IsNULL<int>(reader["LunchFlexibleTimeMins"]), DataAccessObject.IsNULL<int>(reader["LunchTimeAllowed"]), DataAccessObject.IsNULL<bool>(reader["LunchFlag"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["ModifiedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["ModifiedDate"]) ); return hR_LunchRule; } catch (Exception ex) { return null; } }