public List <ContractualEmployeeReward> GetListContractualEmployeeReward(int mainOfficeTypeID) { List <ContractualEmployeeReward> listContractualEmployeeReward = new List <ContractualEmployeeReward>() { }; SqlParameter[] parametersMainOfficeType = new SqlParameter[] { new SqlParameter("@MainOfficeTypeID", mainOfficeTypeID) }; //Lets get the list of ContractualEmployeeReward records from database using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("MainOfficeType_GetList_ContractualEmployeeReward", CommandType.StoredProcedure, parametersMainOfficeType)) { //check if any record exists or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of ContractualEmployeeReward listContractualEmployeeReward = new List <ContractualEmployeeReward>(); //Now lets populate the ContractualEmployeeReward details into the list of ContractualEmployeeRewards foreach (DataRow row in table.Rows) { ContractualEmployeeReward contractualEmployeeReward = contractualEmployeeRewardDBAccess.GetDetails(Convert.ToInt32(row["YearTypeID"]), Convert.ToInt32(row["MonthTypeID"]), Convert.ToInt64(row["NationalCode"])); listContractualEmployeeReward.Add(contractualEmployeeReward); } } } return(listContractualEmployeeReward); }
public List <ContractualEmployeeReward> GetListContractualEmployeeReward(int yearTypeID) { List <ContractualEmployeeReward> listContractualEmployeeReward = new List <ContractualEmployeeReward>() { }; SqlParameter[] parametersYearType = new SqlParameter[] { new SqlParameter("@YearTypeID", yearTypeID) }; //Lets get the list of ContractualEmployeeReward records from database using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("ContractualEmployeeReward_GetList_UseInYearType", CommandType.StoredProcedure, parametersYearType)) { //check if any record exists or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of contractualEmployeeReward listContractualEmployeeReward = new List <ContractualEmployeeReward>(); //Now lets populate the ContractualEmployeeReward details into the list of contractualEmployeeRewards foreach (DataRow row in table.Rows) { ContractualEmployeeReward contractualEmployeeReward = ConvertRowToContractualEmployeeReward(row); listContractualEmployeeReward.Add(contractualEmployeeReward); } } } return(listContractualEmployeeReward); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { Label lblYearTypeID = GridView1.Rows[e.RowIndex].FindControl("lblYearTypeID") as Label; Label lblMonthTypeID = GridView1.Rows[e.RowIndex].FindControl("lblMonthTypeID") as Label; Label lblNationalCode = GridView1.Rows[e.RowIndex].FindControl("lblNationalCode") as Label; Label lblTotalReward = GridView1.Rows[e.RowIndex].FindControl("lblTotalReward") as Label; Label lblReward_ = GridView1.Rows[e.RowIndex].FindControl("lblReward_") as Label; Label lblEmployeeFullName = GridView1.Rows[e.RowIndex].FindControl("lblEmployeeFullName") as Label; Label lblDepartmentIDTitle = GridView1.Rows[e.RowIndex].FindControl("lblDepartmentIDTitle") as Label; Label lblYearTypeIDTitle = GridView1.Rows[e.RowIndex].FindControl("lblYearTypeIDTitle") as Label; Label lblMonthTypeIDTitle = GridView1.Rows[e.RowIndex].FindControl("lblMonthTypeIDTitle") as Label; TextBox txtReward = GridView1.Rows[e.RowIndex].FindControl("txtReward") as TextBox; TextBox txtBossFinalValue = GridView1.Rows[e.RowIndex].FindControl("txtBossFinalValue") as TextBox; TextBox txtAssistantFinalValue = GridView1.Rows[e.RowIndex].FindControl("txtAssistantFinalValue") as TextBox; TextBox txtManagerFinalValue = GridView1.Rows[e.RowIndex].FindControl("txtManagerFinalValue") as TextBox; TextBox txtExtraReward1 = GridView1.Rows[e.RowIndex].FindControl("txtExtraReward1") as TextBox; TextBox txtExtraReward2 = GridView1.Rows[e.RowIndex].FindControl("txtExtraReward2") as TextBox; TextBox txtExtraReward3 = GridView1.Rows[e.RowIndex].FindControl("txtExtraReward3") as TextBox; if (lblYearTypeID != null && lblMonthTypeID != null && lblNationalCode != null && lblTotalReward != null && lblReward_ != null && lblEmployeeFullName != null && lblDepartmentIDTitle != null && lblYearTypeIDTitle != null && lblMonthTypeIDTitle != null && txtReward != null && txtBossFinalValue != null && txtAssistantFinalValue != null && txtManagerFinalValue != null && txtExtraReward1 != null && txtExtraReward2 != null && txtExtraReward3 != null) { ContractualEmployeeReward contractualEmployeeReward = new ContractualEmployeeReward(); contractualEmployeeReward.YearTypeID = Convert.ToInt32(lblYearTypeID.Text.Trim()); contractualEmployeeReward.MonthTypeID = Convert.ToInt32(lblMonthTypeID.Text.Trim()); contractualEmployeeReward.NationalCode = Convert.ToInt64(lblNationalCode.Text.Trim()); contractualEmployeeReward.TotalReward = Convert.ToInt64(lblTotalReward.Text.Trim()); contractualEmployeeReward.Reward_ = Convert.ToInt64(lblReward_.Text.Trim()); contractualEmployeeReward.EmployeeFullName = lblEmployeeFullName.Text; contractualEmployeeReward.DepartmentIDTitle = lblDepartmentIDTitle.Text; contractualEmployeeReward.YearTypeIDTitle = lblYearTypeIDTitle.Text; contractualEmployeeReward.MonthTypeIDTitle = lblMonthTypeIDTitle.Text; contractualEmployeeReward.Reward = Convert.ToInt64(txtReward.Text.Trim()); contractualEmployeeReward.BossFinalValue = Convert.ToInt64(txtBossFinalValue.Text.Trim()); contractualEmployeeReward.AssistantFinalValue = Convert.ToInt64(txtAssistantFinalValue.Text.Trim()); contractualEmployeeReward.ManagerFinalValue = Convert.ToInt64(txtManagerFinalValue.Text.Trim()); contractualEmployeeReward.ExtraReward1 = Convert.ToInt64(txtExtraReward1.Text.Trim()); contractualEmployeeReward.ExtraReward2 = Convert.ToInt64(txtExtraReward2.Text.Trim()); contractualEmployeeReward.ExtraReward3 = Convert.ToInt64(txtExtraReward3.Text.Trim()); //Let us now update the database if (contractualEmployeeRewardHandler.Update(contractualEmployeeReward) == true) { lblResult.Text = "Record Updated Successfully"; } else { lblResult.Text = "Failed to Update record"; } //end the editing and bind with updated records. GridView1.EditIndex = -1; BindData(); } }
public bool Exists(ContractualEmployeeReward contractualEmployeeReward) { SqlParameter[] parametersContractualEmployeeReward = new SqlParameter[] { new SqlParameter("@YearTypeID", contractualEmployeeReward.YearTypeID), new SqlParameter("@MonthTypeID", contractualEmployeeReward.MonthTypeID), new SqlParameter("@NationalCode", contractualEmployeeReward.NationalCode) }; return(SqlDBHelper.ExecuteScalar("ContractualEmployeeReward_Exists", CommandType.StoredProcedure, parametersContractualEmployeeReward) > 0); }
public List <ContractualEmployeeReward> SearchLike(ContractualEmployeeReward contractualEmployeeReward) { List <ContractualEmployeeReward> listContractualEmployeeReward = new List <ContractualEmployeeReward>(); SqlParameter[] parametersContractualEmployeeReward = new SqlParameter[] { new SqlParameter("@YearTypeID", contractualEmployeeReward.YearTypeID), new SqlParameter("@MonthTypeID", contractualEmployeeReward.MonthTypeID), new SqlParameter("@NationalCode", contractualEmployeeReward.NationalCode), new SqlParameter("@TotalReward", contractualEmployeeReward.TotalReward), new SqlParameter("@Reward_", contractualEmployeeReward.Reward_), new SqlParameter("@EmployeeFullName", contractualEmployeeReward.EmployeeFullName), new SqlParameter("@DepartmentIDTitle", contractualEmployeeReward.DepartmentIDTitle), new SqlParameter("@YearTypeIDTitle", contractualEmployeeReward.YearTypeIDTitle), new SqlParameter("@MonthTypeIDTitle", contractualEmployeeReward.MonthTypeIDTitle), new SqlParameter("@Reward", contractualEmployeeReward.Reward), new SqlParameter("@BossFinalValue", contractualEmployeeReward.BossFinalValue), new SqlParameter("@AssistantFinalValue", contractualEmployeeReward.AssistantFinalValue), new SqlParameter("@ManagerFinalValue", contractualEmployeeReward.ManagerFinalValue), new SqlParameter("@ExtraReward1", contractualEmployeeReward.ExtraReward1), new SqlParameter("@ExtraReward2", contractualEmployeeReward.ExtraReward2), new SqlParameter("@ExtraReward3", contractualEmployeeReward.ExtraReward3), }; using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("ContractualEmployeeReward_SearchLike", CommandType.StoredProcedure, parametersContractualEmployeeReward)) { if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { ContractualEmployeeReward tmpContractualEmployeeReward = new ContractualEmployeeReward(); tmpContractualEmployeeReward.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; tmpContractualEmployeeReward.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; tmpContractualEmployeeReward.NationalCode = (row["NationalCode"] != DBNull.Value) ? Convert.ToInt64(row["NationalCode"]) : 0; tmpContractualEmployeeReward.TotalReward = (row["TotalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalReward"]) : 0; tmpContractualEmployeeReward.Reward_ = (row["Reward_"] != DBNull.Value) ? Convert.ToInt64(row["Reward_"]) : 0; tmpContractualEmployeeReward.EmployeeFullName = row["EmployeeFullName"].ToString(); tmpContractualEmployeeReward.DepartmentIDTitle = row["DepartmentIDTitle"].ToString(); tmpContractualEmployeeReward.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); tmpContractualEmployeeReward.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); tmpContractualEmployeeReward.Reward = (row["Reward"] != DBNull.Value) ? Convert.ToInt64(row["Reward"]) : 0; tmpContractualEmployeeReward.BossFinalValue = (row["BossFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["BossFinalValue"]) : 0; tmpContractualEmployeeReward.AssistantFinalValue = (row["AssistantFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["AssistantFinalValue"]) : 0; tmpContractualEmployeeReward.ManagerFinalValue = (row["ManagerFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["ManagerFinalValue"]) : 0; tmpContractualEmployeeReward.ExtraReward1 = (row["ExtraReward1"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward1"]) : 0; tmpContractualEmployeeReward.ExtraReward2 = (row["ExtraReward2"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward2"]) : 0; tmpContractualEmployeeReward.ExtraReward3 = (row["ExtraReward3"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward3"]) : 0; listContractualEmployeeReward.Add(tmpContractualEmployeeReward); } } } return(listContractualEmployeeReward); }
public bool Update(ContractualEmployeeReward contractualEmployeeReward) { SqlParameter[] parametersContractualEmployeeReward = new SqlParameter[] { new SqlParameter("@YearTypeID", contractualEmployeeReward.YearTypeID), new SqlParameter("@MonthTypeID", contractualEmployeeReward.MonthTypeID), new SqlParameter("@NationalCode", contractualEmployeeReward.NationalCode), new SqlParameter("@Reward", contractualEmployeeReward.Reward), new SqlParameter("@BossFinalValue", contractualEmployeeReward.BossFinalValue), new SqlParameter("@AssistantFinalValue", contractualEmployeeReward.AssistantFinalValue), new SqlParameter("@ManagerFinalValue", contractualEmployeeReward.ManagerFinalValue), new SqlParameter("@ExtraReward1", contractualEmployeeReward.ExtraReward1), new SqlParameter("@ExtraReward2", contractualEmployeeReward.ExtraReward2), new SqlParameter("@ExtraReward3", contractualEmployeeReward.ExtraReward3) }; return(SqlDBHelper.ExecuteNonQuery("ContractualEmployeeReward_Update", CommandType.StoredProcedure, parametersContractualEmployeeReward)); }
public Int64 Insert(ContractualEmployeeReward contractualEmployeeReward) { SqlParameter[] parametersContractualEmployeeReward = new SqlParameter[] { new SqlParameter("@YearTypeID", (contractualEmployeeReward.YearTypeID > 0) ? contractualEmployeeReward.YearTypeID : (object)DBNull.Value), new SqlParameter("@MonthTypeID", (contractualEmployeeReward.MonthTypeID > 0) ? contractualEmployeeReward.MonthTypeID : (object)DBNull.Value), new SqlParameter("@NationalCode", (contractualEmployeeReward.NationalCode > 0) ? contractualEmployeeReward.NationalCode : (object)DBNull.Value), new SqlParameter("@Reward", contractualEmployeeReward.Reward), new SqlParameter("@BossFinalValue", contractualEmployeeReward.BossFinalValue), new SqlParameter("@AssistantFinalValue", contractualEmployeeReward.AssistantFinalValue), new SqlParameter("@ManagerFinalValue", contractualEmployeeReward.ManagerFinalValue), new SqlParameter("@ExtraReward1", contractualEmployeeReward.ExtraReward1), new SqlParameter("@ExtraReward2", contractualEmployeeReward.ExtraReward2), new SqlParameter("@ExtraReward3", contractualEmployeeReward.ExtraReward3) }; return(SqlDBHelper.ExecuteScalar("ContractualEmployeeReward_Insert", CommandType.StoredProcedure, parametersContractualEmployeeReward)); }
protected void Page_Load(object sender, EventArgs e) { string yearTypeID = Request.QueryString["yearTypeID"] as string; string monthTypeID = Request.QueryString["monthTypeID"] as string; string nationalCode = Request.QueryString["nationalCode"] as string; if (yearTypeID == null || monthTypeID == null || nationalCode == null) { Response.Redirect("Z_ContractualEmployeeRewardDefault.aspx"); } try { contractualEmployeeRewardYearTypeID = Convert.ToInt32(yearTypeID.Trim()); contractualEmployeeRewardMonthTypeID = Convert.ToInt32(monthTypeID.Trim()); contractualEmployeeRewardNationalCode = Convert.ToInt64(nationalCode.Trim()); contractualEmployeeRewardHandler = new ContractualEmployeeRewardHandler(); ContractualEmployeeReward contractualEmployeeReward = contractualEmployeeRewardHandler.GetDetails(contractualEmployeeRewardYearTypeID, contractualEmployeeRewardMonthTypeID, contractualEmployeeRewardNationalCode); lblYearTypeID.Text = contractualEmployeeReward.YearTypeID.ToString(); lblMonthTypeID.Text = contractualEmployeeReward.MonthTypeID.ToString(); lblNationalCode.Text = contractualEmployeeReward.NationalCode.ToString(); lblTotalReward.Text = contractualEmployeeReward.TotalReward.ToString(); lblReward_.Text = contractualEmployeeReward.Reward_.ToString(); lblEmployeeFullName.Text = contractualEmployeeReward.EmployeeFullName.ToString(); lblDepartmentIDTitle.Text = contractualEmployeeReward.DepartmentIDTitle.ToString(); lblYearTypeIDTitle.Text = contractualEmployeeReward.YearTypeIDTitle.ToString(); lblMonthTypeIDTitle.Text = contractualEmployeeReward.MonthTypeIDTitle.ToString(); lblReward.Text = contractualEmployeeReward.Reward.ToString(); lblBossFinalValue.Text = contractualEmployeeReward.BossFinalValue.ToString(); lblAssistantFinalValue.Text = contractualEmployeeReward.AssistantFinalValue.ToString(); lblManagerFinalValue.Text = contractualEmployeeReward.ManagerFinalValue.ToString(); lblExtraReward1.Text = contractualEmployeeReward.ExtraReward1.ToString(); lblExtraReward2.Text = contractualEmployeeReward.ExtraReward2.ToString(); lblExtraReward3.Text = contractualEmployeeReward.ExtraReward3.ToString(); } catch (Exception) { Response.Redirect("Z_ContractualEmployeeRewardDefault.aspx"); } }
private ContractualEmployeeReward ConvertRowToContractualEmployeeReward(DataRow row) { ContractualEmployeeReward contractualEmployeeReward = new ContractualEmployeeReward(); contractualEmployeeReward.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; contractualEmployeeReward.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; contractualEmployeeReward.NationalCode = (row["NationalCode"] != DBNull.Value) ? Convert.ToInt64(row["NationalCode"]) : 0; contractualEmployeeReward.TotalReward = (row["TotalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalReward"]) : 0; contractualEmployeeReward.Reward_ = (row["Reward_"] != DBNull.Value) ? Convert.ToInt64(row["Reward_"]) : 0; contractualEmployeeReward.EmployeeFullName = row["EmployeeFullName"].ToString(); contractualEmployeeReward.DepartmentIDTitle = row["DepartmentIDTitle"].ToString(); contractualEmployeeReward.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); contractualEmployeeReward.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); contractualEmployeeReward.Reward = (row["Reward"] != DBNull.Value) ? Convert.ToInt64(row["Reward"]) : 0; contractualEmployeeReward.BossFinalValue = (row["BossFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["BossFinalValue"]) : 0; contractualEmployeeReward.AssistantFinalValue = (row["AssistantFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["AssistantFinalValue"]) : 0; contractualEmployeeReward.ManagerFinalValue = (row["ManagerFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["ManagerFinalValue"]) : 0; contractualEmployeeReward.ExtraReward1 = (row["ExtraReward1"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward1"]) : 0; contractualEmployeeReward.ExtraReward2 = (row["ExtraReward2"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward2"]) : 0; contractualEmployeeReward.ExtraReward3 = (row["ExtraReward3"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward3"]) : 0; return(contractualEmployeeReward); }
protected void btnYES_Click(object sender, EventArgs e) { ContractualEmployeeReward contractualEmployeeReward = new ContractualEmployeeReward(); contractualEmployeeReward.YearTypeID = Convert.ToInt32(ddlYearTypeID.SelectedValue); contractualEmployeeReward.MonthTypeID = Convert.ToInt32(ddlMonthTypeID.SelectedValue); contractualEmployeeReward.NationalCode = Convert.ToInt64(ddlNationalCode.SelectedValue); contractualEmployeeReward.Reward = Convert.ToInt64(txtReward.Text); contractualEmployeeReward.BossFinalValue = Convert.ToInt64(txtBossFinalValue.Text); contractualEmployeeReward.AssistantFinalValue = Convert.ToInt64(txtAssistantFinalValue.Text); contractualEmployeeReward.ManagerFinalValue = Convert.ToInt64(txtManagerFinalValue.Text); contractualEmployeeReward.ExtraReward1 = Convert.ToInt64(txtExtraReward1.Text); contractualEmployeeReward.ExtraReward2 = Convert.ToInt64(txtExtraReward2.Text); contractualEmployeeReward.ExtraReward3 = Convert.ToInt64(txtExtraReward3.Text); ContractualEmployeeRewardHandler contractualEmployeeRewardHandler = new ContractualEmployeeRewardHandler(); if (contractualEmployeeRewardHandler.Insert(contractualEmployeeReward) > 0) { Response.Redirect("Z_ContractualEmployeeRewardDefault.aspx"); } }
public ContractualEmployeeReward GetDetails(int yearTypeID, int monthTypeID, Int64 nationalCode) { ContractualEmployeeReward contractualEmployeeReward = new ContractualEmployeeReward(); SqlParameter[] parametersContractualEmployeeReward = new SqlParameter[] { new SqlParameter("@YearTypeID", yearTypeID), new SqlParameter("@MonthTypeID", monthTypeID), new SqlParameter("@NationalCode", nationalCode) }; using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("ContractualEmployeeReward_GetDetails", CommandType.StoredProcedure, parametersContractualEmployeeReward)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; contractualEmployeeReward.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; contractualEmployeeReward.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; contractualEmployeeReward.NationalCode = (row["NationalCode"] != DBNull.Value) ? Convert.ToInt64(row["NationalCode"]) : 0; contractualEmployeeReward.TotalReward = (row["TotalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalReward"]) : 0; contractualEmployeeReward.Reward_ = (row["Reward_"] != DBNull.Value) ? Convert.ToInt64(row["Reward_"]) : 0; contractualEmployeeReward.EmployeeFullName = row["EmployeeFullName"].ToString(); contractualEmployeeReward.DepartmentIDTitle = row["DepartmentIDTitle"].ToString(); contractualEmployeeReward.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); contractualEmployeeReward.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); contractualEmployeeReward.Reward = (row["Reward"] != DBNull.Value) ? Convert.ToInt64(row["Reward"]) : 0; contractualEmployeeReward.BossFinalValue = (row["BossFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["BossFinalValue"]) : 0; contractualEmployeeReward.AssistantFinalValue = (row["AssistantFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["AssistantFinalValue"]) : 0; contractualEmployeeReward.ManagerFinalValue = (row["ManagerFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["ManagerFinalValue"]) : 0; contractualEmployeeReward.ExtraReward1 = (row["ExtraReward1"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward1"]) : 0; contractualEmployeeReward.ExtraReward2 = (row["ExtraReward2"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward2"]) : 0; contractualEmployeeReward.ExtraReward3 = (row["ExtraReward3"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward3"]) : 0; } } return(contractualEmployeeReward); }
public List <ContractualEmployeeReward> GetListAll() { List <ContractualEmployeeReward> listContractualEmployeeReward = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("ContractualEmployeeReward_GetListAll", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { listContractualEmployeeReward = new List <ContractualEmployeeReward>(); foreach (DataRow row in table.Rows) { ContractualEmployeeReward contractualEmployeeReward = new ContractualEmployeeReward(); contractualEmployeeReward.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; contractualEmployeeReward.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; contractualEmployeeReward.NationalCode = (row["NationalCode"] != DBNull.Value) ? Convert.ToInt64(row["NationalCode"]) : 0; contractualEmployeeReward.TotalReward = (row["TotalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalReward"]) : 0; contractualEmployeeReward.Reward_ = (row["Reward_"] != DBNull.Value) ? Convert.ToInt64(row["Reward_"]) : 0; contractualEmployeeReward.EmployeeFullName = row["EmployeeFullName"].ToString(); contractualEmployeeReward.DepartmentIDTitle = row["DepartmentIDTitle"].ToString(); contractualEmployeeReward.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); contractualEmployeeReward.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); contractualEmployeeReward.Reward = (row["Reward"] != DBNull.Value) ? Convert.ToInt64(row["Reward"]) : 0; contractualEmployeeReward.BossFinalValue = (row["BossFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["BossFinalValue"]) : 0; contractualEmployeeReward.AssistantFinalValue = (row["AssistantFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["AssistantFinalValue"]) : 0; contractualEmployeeReward.ManagerFinalValue = (row["ManagerFinalValue"] != DBNull.Value) ? Convert.ToInt64(row["ManagerFinalValue"]) : 0; contractualEmployeeReward.ExtraReward1 = (row["ExtraReward1"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward1"]) : 0; contractualEmployeeReward.ExtraReward2 = (row["ExtraReward2"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward2"]) : 0; contractualEmployeeReward.ExtraReward3 = (row["ExtraReward3"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward3"]) : 0; listContractualEmployeeReward.Add(contractualEmployeeReward); } } } return(listContractualEmployeeReward); }