protected void btnAdd_Click(object sender, EventArgs e) { HR_Package hR_Package = new HR_Package(); // hR_Package.PackageID= int.Parse(ddlPackageID.SelectedValue); hR_Package.PackageName = txtPackageName.Text; hR_Package.PackageValue = 0; int PackageID = HR_PackageManager.InsertHR_Package(hR_Package); for (int i = 0; i < ListPackageRules.Count; i++) { HR_PackageRules hR_PackageRules = new HR_PackageRules(); // hR_PackageRules.PackageRulesID= int.Parse(ddlPackageRulesID.SelectedValue); Label lblPackageRulesName = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblPackageRulesName")); Label lblRulesValue = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblRulesValue")); Label lblRulesOperator = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblRulesOperator")); hR_PackageRules.PackageRulesName = lblPackageRulesName.Text; hR_PackageRules.PackageID = PackageID; hR_PackageRules.RulesValue = int.Parse(lblRulesValue.Text); hR_PackageRules.RulesOperator = lblRulesOperator.Text; string userID = Profile.card_id; hR_PackageRules.AddedBy = userID; hR_PackageRules.AddedDate = DateTime.Now; hR_PackageRules.UpdatedBy = userID; hR_PackageRules.UpdatedDate = DateTime.Now; int resutl = HR_PackageRulesManager.InsertHR_PackageRules(hR_PackageRules); } Response.Redirect("AdminDisplayHR_Package.aspx"); }
public static HR_PackageRules GetHR_PackageRulesByPackageRulesID(int PackageRulesID) { HR_PackageRules hR_PackageRules = new HR_PackageRules(); SqlHR_PackageRulesProvider sqlHR_PackageRulesProvider = new SqlHR_PackageRulesProvider(); hR_PackageRules = sqlHR_PackageRulesProvider.GetHR_PackageRulesByPackageRulesID(PackageRulesID); return hR_PackageRules; }
private void showHR_PackageRulesData() { HR_PackageRules hR_PackageRules = new HR_PackageRules(); hR_PackageRules = HR_PackageRulesManager.GetHR_PackageRulesByPackageRulesID(Int32.Parse(Request.QueryString["ID"])); txtPackageRulesName.Text = hR_PackageRules.PackageRulesName.ToString(); // ddlPackageID.SelectedValue =hR_PackageRules.PackageID.ToString(); txtRulesValue.Text = hR_PackageRules.RulesValue.ToString(); txtRulesOperator.Text = hR_PackageRules.RulesOperator.ToString(); }
protected void btnAddMore_Click(object sender, EventArgs e) { HR_PackageRules packageRule = new HR_PackageRules(); packageRule = HR_PackageRulesManager.GetHR_PackageRulesByPackageRulesID(int.Parse(ddlPackageRules.SelectedValue)); packageRule.PackageRulesID = packageRule.PackageRulesID; packageRule.PackageRulesName = packageRule.PackageRulesName; packageRule.RulesValue = packageRule.RulesValue; packageRule.RulesOperator = packageRule.RulesOperator; ListPackageRules.Add(packageRule); gvHR_PackageRules.DataSource = ListPackageRules; gvHR_PackageRules.DataBind(); }
protected void btnUpdate_Click(object sender, EventArgs e) { HR_PackageRules hR_PackageRules = new HR_PackageRules(); hR_PackageRules.PackageRulesID = int.Parse(Request.QueryString["ID"].ToString()); hR_PackageRules.PackageRulesName = txtPackageRulesName.Text; //hR_PackageRules.PackageID= int.Parse(ddlPackageID.SelectedValue); hR_PackageRules.RulesValue = int.Parse(txtRulesValue.Text); hR_PackageRules.RulesOperator = txtRulesOperator.Text; string userID = Profile.card_id; hR_PackageRules.AddedBy = userID; hR_PackageRules.AddedDate = DateTime.Now; hR_PackageRules.UpdatedBy = userID; hR_PackageRules.UpdatedDate = DateTime.Now; bool resutl = HR_PackageRulesManager.UpdateHR_PackageRules(hR_PackageRules); Response.Redirect("AdminDisplayHR_PackageRules.aspx"); }
protected void btnAddMore_Click(object sender, EventArgs e) { //ListPackageRules HR_PackageRules packageRule = new HR_PackageRules(); if (lblPackageRulesID.Text != string.Empty) { packageRule.PackageRulesID = Convert.ToInt32(lblPackageRulesID.Text.Trim()); } else { packageRule.PackageRulesID = 0; } packageRule.PackageRulesName = txtPackageRulesName.Text; packageRule.RulesValue = Int32.Parse(txtRulesValue.Text); packageRule.RulesOperator = ddlRulesOperator.SelectedValue.ToString(); ListPackageRules.Add(packageRule); gvHR_PackageRules.DataSource = ListPackageRules; gvHR_PackageRules.DataBind(); }
protected void btnUpdate_Click(object sender, EventArgs e) { HR_Package hR_Package = new HR_Package(); hR_Package.PackageID = int.Parse(Request.QueryString["ID"].ToString()); hR_Package.PackageName = txtPackageName.Text; hR_Package.PackageValue = 0; bool resutlPackage = HR_PackageManager.UpdateHR_Package(hR_Package); for (int i = 0; i < ListPackageRules.Count; i++) { HR_PackageRules hR_PackageRules = new HR_PackageRules(); // hR_PackageRules.PackageRulesID= int.Parse(ddlPackageRulesID.SelectedValue); Label lblPackageRulesID = (Label)gvHR_PackageRules.Rows[i].FindControl("lblPackageRulesID"); Label lblPackageRulesName = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblPackageRulesName")); Label lblRulesValue = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblRulesValue")); Label lblRulesOperator = ((Label)gvHR_PackageRules.Rows[i].FindControl("lblRulesOperator")); hR_PackageRules.PackageRulesID = Convert.ToInt32(lblPackageRulesID.Text); hR_PackageRules.PackageRulesName = lblPackageRulesName.Text; hR_PackageRules.PackageID = hR_Package.PackageID; hR_PackageRules.RulesValue = int.Parse(lblRulesValue.Text); hR_PackageRules.RulesOperator = lblRulesOperator.Text; string userID = Profile.card_id; hR_PackageRules.AddedBy = userID; hR_PackageRules.AddedDate = DateTime.Now; hR_PackageRules.UpdatedBy = userID; hR_PackageRules.UpdatedDate = DateTime.Now; if (hR_PackageRules.PackageRulesID == 0) { int resutl = HR_PackageRulesManager.InsertHR_PackageRules(hR_PackageRules); } else if (hR_PackageRules.PackageRulesID > 0) { bool resutl = HR_PackageRulesManager.UpdateHR_PackageRules(hR_PackageRules); } } Response.Redirect("AdminDisplayHR_Package.aspx"); }
public bool UpdateHR_PackageRules(HR_PackageRules hR_PackageRules) { using (SqlConnection connection = new SqlConnection(this.ConnectionString)) { SqlCommand cmd = new SqlCommand("UpdateHR_PackageRules", connection); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@PackageRulesID", SqlDbType.Int).Value = hR_PackageRules.PackageRulesID; cmd.Parameters.Add("@PackageRulesName", SqlDbType.NVarChar).Value = hR_PackageRules.PackageRulesName; cmd.Parameters.Add("@PackageID", SqlDbType.Int).Value = hR_PackageRules.PackageID; cmd.Parameters.Add("@RulesValue", SqlDbType.Int).Value = hR_PackageRules.RulesValue; cmd.Parameters.Add("@RulesOperator", SqlDbType.NVarChar).Value = hR_PackageRules.RulesOperator; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = hR_PackageRules.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = hR_PackageRules.UpdatedDate; connection.Open(); int result = cmd.ExecuteNonQuery(); return result == 1; } }
public HR_PackageRules GetHR_PackageRulesFromReader(IDataReader reader) { try { HR_PackageRules hR_PackageRules = new HR_PackageRules ( DataAccessObject.IsNULL<int>(reader["PackageRulesID"]), DataAccessObject.IsNULL<string>(reader["PackageRulesName"]), DataAccessObject.IsNULL<int>(reader["PackageID"]), DataAccessObject.IsNULL<int>(reader["RulesValue"]), DataAccessObject.IsNULL<string>(reader["RulesOperator"]), DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]), DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()), DataAccessObject.IsNULL<DateTime>(reader["UpdatedDate"]) ); return hR_PackageRules; } catch(Exception ex) { return null; } }
protected void btnSelaryPreview_OnClick(object sender, EventArgs e) { DataTable tblSalaryDetails = new DataTable(); tblSalaryDetails.Columns.Add("EmployeeName"); tblSalaryDetails.Columns.Add("GrossSalary"); tblSalaryDetails.Columns.Add("PFAmount"); tblSalaryDetails.Columns.Add("SecurityAmount"); tblSalaryDetails.Columns.Add("DepartmentName"); tblSalaryDetails.Columns.Add("AdvenceSalary"); tblSalaryDetails.Columns.Add("GrandTotal"); string totalpackeges = ""; foreach (GridViewRow row in gvSalaryDetailBreakdown.Rows) { CheckBox chkBoxSelect = (CheckBox)row.FindControl("chkBoxSelect"); if (chkBoxSelect.Checked) { DataRow newRow = tblSalaryDetails.NewRow(); Label lblEmployeeName = (Label)row.FindControl("lblEmployeeName"); Label lblTotalSalary = (Label)row.FindControl("lblTotalSalary"); Label lblPFAmount = (Label)row.FindControl("lblPFAmount"); Label lblSecurityAmount = (Label)row.FindControl("lblSecurityAmount"); Label lblLoanAmount = (Label)row.FindControl("lblLoanAmount"); Label lblGrandTotal = (Label)row.FindControl("lblGrandTotal"); Label lblDepartmentName = (Label)row.FindControl("lblDepartmentName"); newRow["DepartmentName"] = lblDepartmentName.Text; newRow["EmployeeName"] = lblEmployeeName.Text; newRow["GrossSalary"] = lblTotalSalary.Text; newRow["PFAmount"] = lblPFAmount.Text; newRow["SecurityAmount"] = lblSecurityAmount.Text; newRow["AdvenceSalary"] = lblLoanAmount.Text; newRow["GrandTotal"] = lblGrandTotal.Text; tblSalaryDetails.Rows.Add(newRow); GridView gvSalaryOnly = (GridView)row.FindControl("gvSalaryOnly"); string packeges = ""; foreach (GridViewRow sr in gvSalaryOnly.Rows) { HR_PackageRules packageRule = new HR_PackageRules(); Label lblDescription = (Label)sr.FindControl("lblDescription"); Label lblSalaryValue = (Label)sr.FindControl("lblSalaryValue"); packeges += lblSalaryValue.Text + " "; } totalpackeges +=packeges+","; packeges = ""; } } string monthYear = ddlMonths.SelectedItem.Text +" "+ "-" +" "+ ddlYears.SelectedItem.Text; Session["Date"] = monthYear; Session["packeges"] = totalpackeges; Session["salaryDetails"] = tblSalaryDetails; if (Session["packeges"] != null && Session["salaryDetails"] != null) { Response.Redirect("SalaryStatement.aspx"); } }
private void showHR_PackageData() { try { HR_Package hR_Package = new HR_Package(); hR_Package = HR_PackageManager.GetHR_PackageByPackageID(Int32.Parse(Request.QueryString["ID"])); txtPackageName.Text = hR_Package.PackageName.ToString(); //txtPackageName.ReadOnly = true; ListPackageRules.Clear(); DataSet listPackageRulesDataSet = HR_PackageRulesManager.GetAllHR_PackageRulessByPackageID(hR_Package.PackageID); if (listPackageRulesDataSet.Tables[0] != null) { foreach (DataRow row in listPackageRulesDataSet.Tables[0].Rows) { HR_PackageRules packageRule = new HR_PackageRules(); packageRule.PackageRulesID = Convert.ToInt32(row["PackageRulesID"]); packageRule.PackageRulesName = Convert.ToString(row["PackageRulesName"]); packageRule.RulesValue = Convert.ToInt32(row["RulesValue"]); packageRule.RulesOperator = Convert.ToString(row["RulesOperator"]); ListPackageRules.Add(packageRule); } } gvHR_PackageRules.DataSource = ListPackageRules; gvHR_PackageRules.DataBind(); } catch (Exception ex) { } }
protected void lbSelect_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); HR_PackageRules packageRule = new HR_PackageRules(); packageRule = ListPackageRules.ElementAt(index); lblPackageRulesID.Text = packageRule.PackageRulesID.ToString(); txtPackageRulesName.Text = packageRule.PackageRulesName; txtRulesValue.Text = packageRule.RulesValue.ToString(); ddlRulesOperator.SelectedValue = packageRule.RulesOperator; ListPackageRules.RemoveAt(index); gvHR_PackageRules.DataSource = ListPackageRules; gvHR_PackageRules.DataBind(); }
protected void lbDelete_Click(object sender, EventArgs e) { ImageButton linkButton = new ImageButton(); linkButton = (ImageButton)sender; int index = Convert.ToInt32(linkButton.CommandArgument); HR_PackageRules packageRule = new HR_PackageRules(); packageRule = ListPackageRules.ElementAt(index); if (packageRule.PackageRulesID != 0) { bool result = HR_PackageRulesManager.DeleteHR_PackageRules(packageRule.PackageRulesID); } ListPackageRules.RemoveAt(index); gvHR_PackageRules.DataSource = ListPackageRules; gvHR_PackageRules.DataBind(); }
private void RefreshPackageRelues() { _ListPackageRules = new List<HR_PackageRules>(); if (radSalaryRules.SelectedValue == "True") { for (int rowCounter = 0; rowCounter < gridViewPackageAndPackageRules.Rows.Count; rowCounter++) { CheckBox checkBox = (CheckBox)gridViewPackageAndPackageRules.Rows[rowCounter].FindControl("chkPackageRulesID"); if (checkBox.Checked) { HR_PackageRules packageRule = new HR_PackageRules(); packageRule = HR_PackageRulesManager.GetHR_PackageRulesByPackageRulesID(int.Parse(((Label)gridViewPackageAndPackageRules.Rows[rowCounter].FindControl("lblPackageRulesID")).Text)); packageRule.PackageRulesID = packageRule.PackageRulesID; packageRule.PackageRulesName = packageRule.PackageRulesName; packageRule.RulesValue = packageRule.RulesValue; packageRule.RulesOperator = packageRule.RulesOperator; _ListPackageRules.Add(packageRule); } } } else { for (int rowCounter = 0; rowCounter < gvHR_PackageRules.Rows.Count; rowCounter++) { HR_PackageRules packageRule = new HR_PackageRules(); packageRule = HR_PackageRulesManager.GetHR_PackageRulesByPackageRulesID(int.Parse(((Label)gvHR_PackageRules.Rows[rowCounter].FindControl("lblPackageRulesID")).Text)); packageRule.PackageRulesID = packageRule.PackageRulesID; packageRule.PackageRulesName = packageRule.PackageRulesName; packageRule.RulesValue = packageRule.RulesValue; packageRule.RulesOperator = packageRule.RulesOperator; _ListPackageRules.Add(packageRule); } } }
public static int InsertHR_PackageRules(HR_PackageRules hR_PackageRules) { SqlHR_PackageRulesProvider sqlHR_PackageRulesProvider = new SqlHR_PackageRulesProvider(); return sqlHR_PackageRulesProvider.InsertHR_PackageRules(hR_PackageRules); }
public static bool UpdateHR_PackageRules(HR_PackageRules hR_PackageRules) { SqlHR_PackageRulesProvider sqlHR_PackageRulesProvider = new SqlHR_PackageRulesProvider(); return sqlHR_PackageRulesProvider.UpdateHR_PackageRules(hR_PackageRules); }