public bool Update(BaseMonthlyInformation baseMonthlyInformation) { SqlParameter[] parametersBaseMonthlyInformation = new SqlParameter[] { new SqlParameter("@YearTypeID", baseMonthlyInformation.YearTypeID), new SqlParameter("@MonthTypeID", baseMonthlyInformation.MonthTypeID), new SqlParameter("@MainOfficeTypeID", baseMonthlyInformation.MainOfficeTypeID), new SqlParameter("@ContractualReward", (baseMonthlyInformation.ContractualReward != null) ? baseMonthlyInformation.ContractualReward : (object)DBNull.Value), new SqlParameter("@ContractualConstantReward", (baseMonthlyInformation.ContractualConstantReward != null) ? baseMonthlyInformation.ContractualConstantReward : (object)DBNull.Value), new SqlParameter("@ExtraReward", (baseMonthlyInformation.ExtraReward != null) ? baseMonthlyInformation.ExtraReward : (object)DBNull.Value), new SqlParameter("@Factor5", baseMonthlyInformation.Factor5), new SqlParameter("@Factor6", baseMonthlyInformation.Factor6), new SqlParameter("@Factor7", baseMonthlyInformation.Factor7), new SqlParameter("@Factor8", baseMonthlyInformation.Factor8), new SqlParameter("@Factor9", baseMonthlyInformation.Factor9), new SqlParameter("@Factor10", baseMonthlyInformation.Factor10), new SqlParameter("@OfficialReward", (baseMonthlyInformation.OfficialReward != null) ? baseMonthlyInformation.OfficialReward : (object)DBNull.Value), new SqlParameter("@IsFanalized", (baseMonthlyInformation.IsFanalized != null) ? baseMonthlyInformation.IsFanalized : (object)DBNull.Value), new SqlParameter("@IsFainalizedEmployeesInformation", (baseMonthlyInformation.IsFainalizedEmployeesInformation != null) ? baseMonthlyInformation.IsFainalizedEmployeesInformation : (object)DBNull.Value), new SqlParameter("@IsFainalizedRewardCalculation", (baseMonthlyInformation.IsFainalizedRewardCalculation != null) ? baseMonthlyInformation.IsFainalizedRewardCalculation : (object)DBNull.Value), new SqlParameter("@BossFactor", baseMonthlyInformation.BossFactor), new SqlParameter("@OperationalFactor", baseMonthlyInformation.OperationalFactor), new SqlParameter("@Factor1", baseMonthlyInformation.Factor1), new SqlParameter("@Factor2", baseMonthlyInformation.Factor2), new SqlParameter("@Factor3", baseMonthlyInformation.Factor3), new SqlParameter("@Factor4", baseMonthlyInformation.Factor4) }; return(SqlDBHelper.ExecuteNonQuery("BaseMonthlyInformation_Update", CommandType.StoredProcedure, parametersBaseMonthlyInformation)); }
public List <BaseMonthlyInformation> GetListBaseMonthlyInformation(int mainOfficeTypeID) { List <BaseMonthlyInformation> listBaseMonthlyInformation = new List <BaseMonthlyInformation>() { }; SqlParameter[] parametersMainOfficeType = new SqlParameter[] { new SqlParameter("@MainOfficeTypeID", mainOfficeTypeID) }; //Lets get the list of BaseMonthlyInformation records from database using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("BaseMonthlyInformation_GetList_UseInMainOfficeType", CommandType.StoredProcedure, parametersMainOfficeType)) { //check if any record exists or not if (table.Rows.Count > 0) { //Lets go ahead and create the list of baseMonthlyInformation listBaseMonthlyInformation = new List <BaseMonthlyInformation>(); //Now lets populate the BaseMonthlyInformation details into the list of baseMonthlyInformations foreach (DataRow row in table.Rows) { BaseMonthlyInformation baseMonthlyInformation = ConvertRowToBaseMonthlyInformation(row); listBaseMonthlyInformation.Add(baseMonthlyInformation); } } } return(listBaseMonthlyInformation); }
public BaseMonthlyInformation GetDetails(int yearTypeID, int monthTypeID, int mainOfficeTypeID) { BaseMonthlyInformation baseMonthlyInformation = new BaseMonthlyInformation(); SqlParameter[] parametersBaseMonthlyInformation = new SqlParameter[] { new SqlParameter("@YearTypeID", yearTypeID), new SqlParameter("@MonthTypeID", monthTypeID), new SqlParameter("@MainOfficeTypeID", mainOfficeTypeID) }; using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("BaseMonthlyInformation_GetDetails", CommandType.StoredProcedure, parametersBaseMonthlyInformation)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; baseMonthlyInformation.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; baseMonthlyInformation.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; baseMonthlyInformation.MainOfficeTypeID = (row["MainOfficeTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MainOfficeTypeID"]) : 0; baseMonthlyInformation.ValueToScore = (row["ValueToScore"] != DBNull.Value) ? Convert.ToDecimal(row["ValueToScore"]) : 0; baseMonthlyInformation.TotalOperationalReward = (row["TotalOperationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOperationalReward"]) : 0; baseMonthlyInformation.TotalOrganizationalReward = (row["TotalOrganizationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOrganizationalReward"]) : 0; baseMonthlyInformation.ContractualDividableReward = (row["ContractualDividableReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDividableReward"]) : 0; baseMonthlyInformation.ContractualBossReward = (row["ContractualBossReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualBossReward"]) : 0; baseMonthlyInformation.ContractualDevotedReward = (row["ContractualDevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDevotedReward"]) : 0; baseMonthlyInformation.ContractualRemainingReward = (row["ContractualRemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualRemainingReward"]) : 0; baseMonthlyInformation.DividableReward = (row["DividableReward"] != DBNull.Value) ? Convert.ToInt64(row["DividableReward"]) : 0; baseMonthlyInformation.BossReward = (row["BossReward"] != DBNull.Value) ? Convert.ToInt64(row["BossReward"]) : 0; baseMonthlyInformation.DevotedReward = (row["DevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["DevotedReward"]) : 0; baseMonthlyInformation.RemainingReward = (row["RemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["RemainingReward"]) : 0; baseMonthlyInformation.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); baseMonthlyInformation.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); baseMonthlyInformation.ContractualReward = (row["ContractualReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualReward"]) : 0; baseMonthlyInformation.ContractualConstantReward = (row["ContractualConstantReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualConstantReward"]) : 0; baseMonthlyInformation.ExtraReward = (row["ExtraReward"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward"]) : 0; baseMonthlyInformation.Factor5 = (row["Factor5"] != DBNull.Value) ? Convert.ToDecimal(row["Factor5"]) : 0; baseMonthlyInformation.Factor6 = (row["Factor6"] != DBNull.Value) ? Convert.ToDecimal(row["Factor6"]) : 0; baseMonthlyInformation.Factor7 = (row["Factor7"] != DBNull.Value) ? Convert.ToDecimal(row["Factor7"]) : 0; baseMonthlyInformation.Factor8 = (row["Factor8"] != DBNull.Value) ? Convert.ToDecimal(row["Factor8"]) : 0; baseMonthlyInformation.Factor9 = (row["Factor9"] != DBNull.Value) ? Convert.ToDecimal(row["Factor9"]) : 0; baseMonthlyInformation.Factor10 = (row["Factor10"] != DBNull.Value) ? Convert.ToDecimal(row["Factor10"]) : 0; baseMonthlyInformation.OfficialReward = (row["OfficialReward"] != DBNull.Value) ? Convert.ToInt64(row["OfficialReward"]) : 0; baseMonthlyInformation.IsFanalized = (row["IsFanalized"] != DBNull.Value) ? Convert.ToBoolean((row["IsFanalized"].ToString() == "1" || row["IsFanalized"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedEmployeesInformation = (row["IsFainalizedEmployeesInformation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedEmployeesInformation"].ToString() == "1" || row["IsFainalizedEmployeesInformation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedRewardCalculation = (row["IsFainalizedRewardCalculation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedRewardCalculation"].ToString() == "1" || row["IsFainalizedRewardCalculation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.BossFactor = (row["BossFactor"] != DBNull.Value) ? Convert.ToDecimal(row["BossFactor"]) : 0; baseMonthlyInformation.OperationalFactor = (row["OperationalFactor"] != DBNull.Value) ? Convert.ToDecimal(row["OperationalFactor"]) : 0; baseMonthlyInformation.Factor1 = (row["Factor1"] != DBNull.Value) ? Convert.ToDecimal(row["Factor1"]) : 0; baseMonthlyInformation.Factor2 = (row["Factor2"] != DBNull.Value) ? Convert.ToDecimal(row["Factor2"]) : 0; baseMonthlyInformation.Factor3 = (row["Factor3"] != DBNull.Value) ? Convert.ToDecimal(row["Factor3"]) : 0; baseMonthlyInformation.Factor4 = (row["Factor4"] != DBNull.Value) ? Convert.ToDecimal(row["Factor4"]) : 0; } } return(baseMonthlyInformation); }
public bool Exists(BaseMonthlyInformation baseMonthlyInformation) { SqlParameter[] parametersBaseMonthlyInformation = new SqlParameter[] { new SqlParameter("@YearTypeID", baseMonthlyInformation.YearTypeID), new SqlParameter("@MonthTypeID", baseMonthlyInformation.MonthTypeID), new SqlParameter("@MainOfficeTypeID", baseMonthlyInformation.MainOfficeTypeID) }; return(SqlDBHelper.ExecuteScalar("BaseMonthlyInformation_Exists", CommandType.StoredProcedure, parametersBaseMonthlyInformation) > 0); }
public List <BaseMonthlyInformation> GetListAll() { List <BaseMonthlyInformation> listBaseMonthlyInformation = null; using (DataTable table = SqlDBHelper.ExecuteSelectCommand("BaseMonthlyInformation_GetListAll", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { listBaseMonthlyInformation = new List <BaseMonthlyInformation>(); foreach (DataRow row in table.Rows) { BaseMonthlyInformation baseMonthlyInformation = new BaseMonthlyInformation(); baseMonthlyInformation.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; baseMonthlyInformation.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; baseMonthlyInformation.MainOfficeTypeID = (row["MainOfficeTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MainOfficeTypeID"]) : 0; baseMonthlyInformation.ValueToScore = (row["ValueToScore"] != DBNull.Value) ? Convert.ToDecimal(row["ValueToScore"]) : 0; baseMonthlyInformation.TotalOperationalReward = (row["TotalOperationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOperationalReward"]) : 0; baseMonthlyInformation.TotalOrganizationalReward = (row["TotalOrganizationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOrganizationalReward"]) : 0; baseMonthlyInformation.ContractualDividableReward = (row["ContractualDividableReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDividableReward"]) : 0; baseMonthlyInformation.ContractualBossReward = (row["ContractualBossReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualBossReward"]) : 0; baseMonthlyInformation.ContractualDevotedReward = (row["ContractualDevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDevotedReward"]) : 0; baseMonthlyInformation.ContractualRemainingReward = (row["ContractualRemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualRemainingReward"]) : 0; baseMonthlyInformation.DividableReward = (row["DividableReward"] != DBNull.Value) ? Convert.ToInt64(row["DividableReward"]) : 0; baseMonthlyInformation.BossReward = (row["BossReward"] != DBNull.Value) ? Convert.ToInt64(row["BossReward"]) : 0; baseMonthlyInformation.DevotedReward = (row["DevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["DevotedReward"]) : 0; baseMonthlyInformation.RemainingReward = (row["RemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["RemainingReward"]) : 0; baseMonthlyInformation.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); baseMonthlyInformation.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); baseMonthlyInformation.ContractualReward = (row["ContractualReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualReward"]) : 0; baseMonthlyInformation.ContractualConstantReward = (row["ContractualConstantReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualConstantReward"]) : 0; baseMonthlyInformation.ExtraReward = (row["ExtraReward"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward"]) : 0; baseMonthlyInformation.Factor5 = (row["Factor5"] != DBNull.Value) ? Convert.ToDecimal(row["Factor5"]) : 0; baseMonthlyInformation.Factor6 = (row["Factor6"] != DBNull.Value) ? Convert.ToDecimal(row["Factor6"]) : 0; baseMonthlyInformation.Factor7 = (row["Factor7"] != DBNull.Value) ? Convert.ToDecimal(row["Factor7"]) : 0; baseMonthlyInformation.Factor8 = (row["Factor8"] != DBNull.Value) ? Convert.ToDecimal(row["Factor8"]) : 0; baseMonthlyInformation.Factor9 = (row["Factor9"] != DBNull.Value) ? Convert.ToDecimal(row["Factor9"]) : 0; baseMonthlyInformation.Factor10 = (row["Factor10"] != DBNull.Value) ? Convert.ToDecimal(row["Factor10"]) : 0; baseMonthlyInformation.OfficialReward = (row["OfficialReward"] != DBNull.Value) ? Convert.ToInt64(row["OfficialReward"]) : 0; baseMonthlyInformation.IsFanalized = (row["IsFanalized"] != DBNull.Value) ? Convert.ToBoolean((row["IsFanalized"].ToString() == "1" || row["IsFanalized"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedEmployeesInformation = (row["IsFainalizedEmployeesInformation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedEmployeesInformation"].ToString() == "1" || row["IsFainalizedEmployeesInformation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedRewardCalculation = (row["IsFainalizedRewardCalculation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedRewardCalculation"].ToString() == "1" || row["IsFainalizedRewardCalculation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.BossFactor = (row["BossFactor"] != DBNull.Value) ? Convert.ToDecimal(row["BossFactor"]) : 0; baseMonthlyInformation.OperationalFactor = (row["OperationalFactor"] != DBNull.Value) ? Convert.ToDecimal(row["OperationalFactor"]) : 0; baseMonthlyInformation.Factor1 = (row["Factor1"] != DBNull.Value) ? Convert.ToDecimal(row["Factor1"]) : 0; baseMonthlyInformation.Factor2 = (row["Factor2"] != DBNull.Value) ? Convert.ToDecimal(row["Factor2"]) : 0; baseMonthlyInformation.Factor3 = (row["Factor3"] != DBNull.Value) ? Convert.ToDecimal(row["Factor3"]) : 0; baseMonthlyInformation.Factor4 = (row["Factor4"] != DBNull.Value) ? Convert.ToDecimal(row["Factor4"]) : 0; listBaseMonthlyInformation.Add(baseMonthlyInformation); } } } return(listBaseMonthlyInformation); }
protected void btnYES_Click(object sender, EventArgs e) { BaseMonthlyInformation baseMonthlyInformation = new BaseMonthlyInformation(); baseMonthlyInformation.YearTypeID = Convert.ToInt32(ddlYearTypeID.SelectedValue); baseMonthlyInformation.MonthTypeID = Convert.ToInt32(ddlMonthTypeID.SelectedValue); baseMonthlyInformation.MainOfficeTypeID = Convert.ToInt32(ddlMainOfficeTypeID.SelectedValue); baseMonthlyInformation.ContractualReward = Convert.ToInt64(txtContractualReward.Text); baseMonthlyInformation.ContractualConstantReward = Convert.ToInt64(txtContractualConstantReward.Text); baseMonthlyInformation.ExtraReward = Convert.ToInt64(txtExtraReward.Text); baseMonthlyInformation.OfficialReward = Convert.ToInt64(txtOfficialReward.Text); BaseMonthlyInformationHandler baseMonthlyInformationHandler = new BaseMonthlyInformationHandler(); if (baseMonthlyInformationHandler.Insert(baseMonthlyInformation) > 0) { Response.Redirect("Z_BaseMonthlyInformationDefault.aspx"); } }
private BaseMonthlyInformation ConvertRowToBaseMonthlyInformation(DataRow row) { BaseMonthlyInformation baseMonthlyInformation = new BaseMonthlyInformation(); baseMonthlyInformation.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; baseMonthlyInformation.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; baseMonthlyInformation.MainOfficeTypeID = (row["MainOfficeTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MainOfficeTypeID"]) : 0; baseMonthlyInformation.ValueToScore = (row["ValueToScore"] != DBNull.Value) ? Convert.ToDecimal(row["ValueToScore"]) : 0; baseMonthlyInformation.TotalOperationalReward = (row["TotalOperationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOperationalReward"]) : 0; baseMonthlyInformation.TotalOrganizationalReward = (row["TotalOrganizationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOrganizationalReward"]) : 0; baseMonthlyInformation.ContractualDividableReward = (row["ContractualDividableReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDividableReward"]) : 0; baseMonthlyInformation.ContractualBossReward = (row["ContractualBossReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualBossReward"]) : 0; baseMonthlyInformation.ContractualDevotedReward = (row["ContractualDevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDevotedReward"]) : 0; baseMonthlyInformation.ContractualRemainingReward = (row["ContractualRemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualRemainingReward"]) : 0; baseMonthlyInformation.DividableReward = (row["DividableReward"] != DBNull.Value) ? Convert.ToInt64(row["DividableReward"]) : 0; baseMonthlyInformation.BossReward = (row["BossReward"] != DBNull.Value) ? Convert.ToInt64(row["BossReward"]) : 0; baseMonthlyInformation.DevotedReward = (row["DevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["DevotedReward"]) : 0; baseMonthlyInformation.RemainingReward = (row["RemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["RemainingReward"]) : 0; baseMonthlyInformation.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); baseMonthlyInformation.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); baseMonthlyInformation.ContractualReward = (row["ContractualReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualReward"]) : 0; baseMonthlyInformation.ContractualConstantReward = (row["ContractualConstantReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualConstantReward"]) : 0; baseMonthlyInformation.ExtraReward = (row["ExtraReward"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward"]) : 0; baseMonthlyInformation.Factor5 = (row["Factor5"] != DBNull.Value) ? Convert.ToDecimal(row["Factor5"]) : 0; baseMonthlyInformation.Factor6 = (row["Factor6"] != DBNull.Value) ? Convert.ToDecimal(row["Factor6"]) : 0; baseMonthlyInformation.Factor7 = (row["Factor7"] != DBNull.Value) ? Convert.ToDecimal(row["Factor7"]) : 0; baseMonthlyInformation.Factor8 = (row["Factor8"] != DBNull.Value) ? Convert.ToDecimal(row["Factor8"]) : 0; baseMonthlyInformation.Factor9 = (row["Factor9"] != DBNull.Value) ? Convert.ToDecimal(row["Factor9"]) : 0; baseMonthlyInformation.Factor10 = (row["Factor10"] != DBNull.Value) ? Convert.ToDecimal(row["Factor10"]) : 0; baseMonthlyInformation.OfficialReward = (row["OfficialReward"] != DBNull.Value) ? Convert.ToInt64(row["OfficialReward"]) : 0; baseMonthlyInformation.IsFanalized = (row["IsFanalized"] != DBNull.Value) ? Convert.ToBoolean((row["IsFanalized"].ToString() == "1" || row["IsFanalized"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedEmployeesInformation = (row["IsFainalizedEmployeesInformation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedEmployeesInformation"].ToString() == "1" || row["IsFainalizedEmployeesInformation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.IsFainalizedRewardCalculation = (row["IsFainalizedRewardCalculation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedRewardCalculation"].ToString() == "1" || row["IsFainalizedRewardCalculation"].ToString().ToLower() == "true") ? true : false) : false; baseMonthlyInformation.BossFactor = (row["BossFactor"] != DBNull.Value) ? Convert.ToDecimal(row["BossFactor"]) : 0; baseMonthlyInformation.OperationalFactor = (row["OperationalFactor"] != DBNull.Value) ? Convert.ToDecimal(row["OperationalFactor"]) : 0; baseMonthlyInformation.Factor1 = (row["Factor1"] != DBNull.Value) ? Convert.ToDecimal(row["Factor1"]) : 0; baseMonthlyInformation.Factor2 = (row["Factor2"] != DBNull.Value) ? Convert.ToDecimal(row["Factor2"]) : 0; baseMonthlyInformation.Factor3 = (row["Factor3"] != DBNull.Value) ? Convert.ToDecimal(row["Factor3"]) : 0; baseMonthlyInformation.Factor4 = (row["Factor4"] != DBNull.Value) ? Convert.ToDecimal(row["Factor4"]) : 0; return(baseMonthlyInformation); }
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 lblMainOfficeTypeID = GridView1.Rows[e.RowIndex].FindControl("lblMainOfficeTypeID") as Label; Label lblValueToScore = GridView1.Rows[e.RowIndex].FindControl("lblValueToScore") as Label; Label lblTotalOperationalReward = GridView1.Rows[e.RowIndex].FindControl("lblTotalOperationalReward") as Label; Label lblTotalOrganizationalReward = GridView1.Rows[e.RowIndex].FindControl("lblTotalOrganizationalReward") as Label; Label lblContractualDividableReward = GridView1.Rows[e.RowIndex].FindControl("lblContractualDividableReward") as Label; Label lblContractualBossReward = GridView1.Rows[e.RowIndex].FindControl("lblContractualBossReward") as Label; Label lblContractualDevotedReward = GridView1.Rows[e.RowIndex].FindControl("lblContractualDevotedReward") as Label; Label lblContractualRemainingReward = GridView1.Rows[e.RowIndex].FindControl("lblContractualRemainingReward") as Label; Label lblDividableReward = GridView1.Rows[e.RowIndex].FindControl("lblDividableReward") as Label; Label lblBossReward = GridView1.Rows[e.RowIndex].FindControl("lblBossReward") as Label; Label lblDevotedReward = GridView1.Rows[e.RowIndex].FindControl("lblDevotedReward") as Label; Label lblRemainingReward = GridView1.Rows[e.RowIndex].FindControl("lblRemainingReward") as Label; Label lblYearTypeIDTitle = GridView1.Rows[e.RowIndex].FindControl("lblYearTypeIDTitle") as Label; Label lblMonthTypeIDTitle = GridView1.Rows[e.RowIndex].FindControl("lblMonthTypeIDTitle") as Label; TextBox txtContractualReward = GridView1.Rows[e.RowIndex].FindControl("txtContractualReward") as TextBox; TextBox txtContractualConstantReward = GridView1.Rows[e.RowIndex].FindControl("txtContractualConstantReward") as TextBox; TextBox txtExtraReward = GridView1.Rows[e.RowIndex].FindControl("txtExtraReward") as TextBox; TextBox txtFactor5 = GridView1.Rows[e.RowIndex].FindControl("txtFactor5") as TextBox; TextBox txtFactor6 = GridView1.Rows[e.RowIndex].FindControl("txtFactor6") as TextBox; TextBox txtFactor7 = GridView1.Rows[e.RowIndex].FindControl("txtFactor7") as TextBox; TextBox txtFactor8 = GridView1.Rows[e.RowIndex].FindControl("txtFactor8") as TextBox; TextBox txtFactor9 = GridView1.Rows[e.RowIndex].FindControl("txtFactor9") as TextBox; TextBox txtFactor10 = GridView1.Rows[e.RowIndex].FindControl("txtFactor10") as TextBox; TextBox txtOfficialReward = GridView1.Rows[e.RowIndex].FindControl("txtOfficialReward") as TextBox; TextBox txtIsFanalized = GridView1.Rows[e.RowIndex].FindControl("txtIsFanalized") as TextBox; TextBox txtIsFainalizedEmployeesInformation = GridView1.Rows[e.RowIndex].FindControl("txtIsFainalizedEmployeesInformation") as TextBox; TextBox txtIsFainalizedRewardCalculation = GridView1.Rows[e.RowIndex].FindControl("txtIsFainalizedRewardCalculation") as TextBox; TextBox txtBossFactor = GridView1.Rows[e.RowIndex].FindControl("txtBossFactor") as TextBox; TextBox txtOperationalFactor = GridView1.Rows[e.RowIndex].FindControl("txtOperationalFactor") as TextBox; TextBox txtFactor1 = GridView1.Rows[e.RowIndex].FindControl("txtFactor1") as TextBox; TextBox txtFactor2 = GridView1.Rows[e.RowIndex].FindControl("txtFactor2") as TextBox; TextBox txtFactor3 = GridView1.Rows[e.RowIndex].FindControl("txtFactor3") as TextBox; TextBox txtFactor4 = GridView1.Rows[e.RowIndex].FindControl("txtFactor4") as TextBox; if (lblYearTypeID != null && lblMonthTypeID != null && lblMainOfficeTypeID != null && lblValueToScore != null && lblTotalOperationalReward != null && lblTotalOrganizationalReward != null && lblContractualDividableReward != null && lblContractualBossReward != null && lblContractualDevotedReward != null && lblContractualRemainingReward != null && lblDividableReward != null && lblBossReward != null && lblDevotedReward != null && lblRemainingReward != null && lblYearTypeIDTitle != null && lblMonthTypeIDTitle != null && txtContractualReward != null && txtContractualConstantReward != null && txtExtraReward != null && txtFactor5 != null && txtFactor6 != null && txtFactor7 != null && txtFactor8 != null && txtFactor9 != null && txtFactor10 != null && txtOfficialReward != null && txtIsFanalized != null && txtIsFainalizedEmployeesInformation != null && txtIsFainalizedRewardCalculation != null && txtBossFactor != null && txtOperationalFactor != null && txtFactor1 != null && txtFactor2 != null && txtFactor3 != null && txtFactor4 != null) { BaseMonthlyInformation baseMonthlyInformation = new BaseMonthlyInformation(); baseMonthlyInformation.YearTypeID = Convert.ToInt32(lblYearTypeID.Text.Trim()); baseMonthlyInformation.MonthTypeID = Convert.ToInt32(lblMonthTypeID.Text.Trim()); baseMonthlyInformation.MainOfficeTypeID = Convert.ToInt32(lblMainOfficeTypeID.Text.Trim()); baseMonthlyInformation.TotalOperationalReward = Convert.ToInt64(lblTotalOperationalReward.Text.Trim()); baseMonthlyInformation.TotalOrganizationalReward = Convert.ToInt64(lblTotalOrganizationalReward.Text.Trim()); baseMonthlyInformation.ContractualDividableReward = Convert.ToInt64(lblContractualDividableReward.Text.Trim()); baseMonthlyInformation.ContractualBossReward = Convert.ToInt64(lblContractualBossReward.Text.Trim()); baseMonthlyInformation.ContractualDevotedReward = Convert.ToInt64(lblContractualDevotedReward.Text.Trim()); baseMonthlyInformation.ContractualRemainingReward = Convert.ToInt64(lblContractualRemainingReward.Text.Trim()); baseMonthlyInformation.DividableReward = Convert.ToInt64(lblDividableReward.Text.Trim()); baseMonthlyInformation.BossReward = Convert.ToInt64(lblBossReward.Text.Trim()); baseMonthlyInformation.DevotedReward = Convert.ToInt64(lblDevotedReward.Text.Trim()); baseMonthlyInformation.RemainingReward = Convert.ToInt64(lblRemainingReward.Text.Trim()); baseMonthlyInformation.YearTypeIDTitle = lblYearTypeIDTitle.Text; baseMonthlyInformation.MonthTypeIDTitle = lblMonthTypeIDTitle.Text; baseMonthlyInformation.ContractualReward = Convert.ToInt64(txtContractualReward.Text.Trim()); baseMonthlyInformation.ContractualConstantReward = Convert.ToInt64(txtContractualConstantReward.Text.Trim()); baseMonthlyInformation.ExtraReward = Convert.ToInt64(txtExtraReward.Text.Trim()); baseMonthlyInformation.OfficialReward = Convert.ToInt64(txtOfficialReward.Text.Trim()); //Let us now update the database if (baseMonthlyInformationHandler.Update(baseMonthlyInformation) == 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 List <BaseMonthlyInformation> SearchLike(BaseMonthlyInformation baseMonthlyInformation) { List <BaseMonthlyInformation> listBaseMonthlyInformation = new List <BaseMonthlyInformation>(); SqlParameter[] parametersBaseMonthlyInformation = new SqlParameter[] { new SqlParameter("@YearTypeID", baseMonthlyInformation.YearTypeID), new SqlParameter("@MonthTypeID", baseMonthlyInformation.MonthTypeID), new SqlParameter("@MainOfficeTypeID", baseMonthlyInformation.MainOfficeTypeID), new SqlParameter("@ValueToScore", baseMonthlyInformation.ValueToScore), new SqlParameter("@TotalOperationalReward", baseMonthlyInformation.TotalOperationalReward), new SqlParameter("@TotalOrganizationalReward", baseMonthlyInformation.TotalOrganizationalReward), new SqlParameter("@ContractualDividableReward", baseMonthlyInformation.ContractualDividableReward), new SqlParameter("@ContractualBossReward", baseMonthlyInformation.ContractualBossReward), new SqlParameter("@ContractualDevotedReward", baseMonthlyInformation.ContractualDevotedReward), new SqlParameter("@ContractualRemainingReward", baseMonthlyInformation.ContractualRemainingReward), new SqlParameter("@DividableReward", baseMonthlyInformation.DividableReward), new SqlParameter("@BossReward", baseMonthlyInformation.BossReward), new SqlParameter("@DevotedReward", baseMonthlyInformation.DevotedReward), new SqlParameter("@RemainingReward", baseMonthlyInformation.RemainingReward), new SqlParameter("@YearTypeIDTitle", baseMonthlyInformation.YearTypeIDTitle), new SqlParameter("@MonthTypeIDTitle", baseMonthlyInformation.MonthTypeIDTitle), new SqlParameter("@ContractualReward", baseMonthlyInformation.ContractualReward), new SqlParameter("@ContractualConstantReward", baseMonthlyInformation.ContractualConstantReward), new SqlParameter("@ExtraReward", baseMonthlyInformation.ExtraReward), new SqlParameter("@Factor5", baseMonthlyInformation.Factor5), new SqlParameter("@Factor6", baseMonthlyInformation.Factor6), new SqlParameter("@Factor7", baseMonthlyInformation.Factor7), new SqlParameter("@Factor8", baseMonthlyInformation.Factor8), new SqlParameter("@Factor9", baseMonthlyInformation.Factor9), new SqlParameter("@Factor10", baseMonthlyInformation.Factor10), new SqlParameter("@OfficialReward", baseMonthlyInformation.OfficialReward), new SqlParameter("@IsFanalized", baseMonthlyInformation.IsFanalized), new SqlParameter("@IsFainalizedEmployeesInformation", baseMonthlyInformation.IsFainalizedEmployeesInformation), new SqlParameter("@IsFainalizedRewardCalculation", baseMonthlyInformation.IsFainalizedRewardCalculation), new SqlParameter("@BossFactor", baseMonthlyInformation.BossFactor), new SqlParameter("@OperationalFactor", baseMonthlyInformation.OperationalFactor), new SqlParameter("@Factor1", baseMonthlyInformation.Factor1), new SqlParameter("@Factor2", baseMonthlyInformation.Factor2), new SqlParameter("@Factor3", baseMonthlyInformation.Factor3), new SqlParameter("@Factor4", baseMonthlyInformation.Factor4), }; using (DataTable table = SqlDBHelper.ExecuteParamerizedSelectCommand("BaseMonthlyInformation_SearchLike", CommandType.StoredProcedure, parametersBaseMonthlyInformation)) { if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { BaseMonthlyInformation tmpBaseMonthlyInformation = new BaseMonthlyInformation(); tmpBaseMonthlyInformation.YearTypeID = (row["YearTypeID"] != DBNull.Value) ? Convert.ToInt32(row["YearTypeID"]) : 0; tmpBaseMonthlyInformation.MonthTypeID = (row["MonthTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MonthTypeID"]) : 0; tmpBaseMonthlyInformation.MainOfficeTypeID = (row["MainOfficeTypeID"] != DBNull.Value) ? Convert.ToInt32(row["MainOfficeTypeID"]) : 0; tmpBaseMonthlyInformation.ValueToScore = (row["ValueToScore"] != DBNull.Value) ? Convert.ToDecimal(row["ValueToScore"]) : 0; tmpBaseMonthlyInformation.TotalOperationalReward = (row["TotalOperationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOperationalReward"]) : 0; tmpBaseMonthlyInformation.TotalOrganizationalReward = (row["TotalOrganizationalReward"] != DBNull.Value) ? Convert.ToInt64(row["TotalOrganizationalReward"]) : 0; tmpBaseMonthlyInformation.ContractualDividableReward = (row["ContractualDividableReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDividableReward"]) : 0; tmpBaseMonthlyInformation.ContractualBossReward = (row["ContractualBossReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualBossReward"]) : 0; tmpBaseMonthlyInformation.ContractualDevotedReward = (row["ContractualDevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualDevotedReward"]) : 0; tmpBaseMonthlyInformation.ContractualRemainingReward = (row["ContractualRemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualRemainingReward"]) : 0; tmpBaseMonthlyInformation.DividableReward = (row["DividableReward"] != DBNull.Value) ? Convert.ToInt64(row["DividableReward"]) : 0; tmpBaseMonthlyInformation.BossReward = (row["BossReward"] != DBNull.Value) ? Convert.ToInt64(row["BossReward"]) : 0; tmpBaseMonthlyInformation.DevotedReward = (row["DevotedReward"] != DBNull.Value) ? Convert.ToInt64(row["DevotedReward"]) : 0; tmpBaseMonthlyInformation.RemainingReward = (row["RemainingReward"] != DBNull.Value) ? Convert.ToInt64(row["RemainingReward"]) : 0; tmpBaseMonthlyInformation.YearTypeIDTitle = row["YearTypeIDTitle"].ToString(); tmpBaseMonthlyInformation.MonthTypeIDTitle = row["MonthTypeIDTitle"].ToString(); tmpBaseMonthlyInformation.ContractualReward = (row["ContractualReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualReward"]) : 0; tmpBaseMonthlyInformation.ContractualConstantReward = (row["ContractualConstantReward"] != DBNull.Value) ? Convert.ToInt64(row["ContractualConstantReward"]) : 0; tmpBaseMonthlyInformation.ExtraReward = (row["ExtraReward"] != DBNull.Value) ? Convert.ToInt64(row["ExtraReward"]) : 0; tmpBaseMonthlyInformation.Factor5 = (row["Factor5"] != DBNull.Value) ? Convert.ToDecimal(row["Factor5"]) : 0; tmpBaseMonthlyInformation.Factor6 = (row["Factor6"] != DBNull.Value) ? Convert.ToDecimal(row["Factor6"]) : 0; tmpBaseMonthlyInformation.Factor7 = (row["Factor7"] != DBNull.Value) ? Convert.ToDecimal(row["Factor7"]) : 0; tmpBaseMonthlyInformation.Factor8 = (row["Factor8"] != DBNull.Value) ? Convert.ToDecimal(row["Factor8"]) : 0; tmpBaseMonthlyInformation.Factor9 = (row["Factor9"] != DBNull.Value) ? Convert.ToDecimal(row["Factor9"]) : 0; tmpBaseMonthlyInformation.Factor10 = (row["Factor10"] != DBNull.Value) ? Convert.ToDecimal(row["Factor10"]) : 0; tmpBaseMonthlyInformation.OfficialReward = (row["OfficialReward"] != DBNull.Value) ? Convert.ToInt64(row["OfficialReward"]) : 0; tmpBaseMonthlyInformation.IsFanalized = (row["IsFanalized"] != DBNull.Value) ? Convert.ToBoolean((row["IsFanalized"].ToString() == "1" || row["IsFanalized"].ToString().ToLower() == "true") ? true : false) : false; tmpBaseMonthlyInformation.IsFainalizedEmployeesInformation = (row["IsFainalizedEmployeesInformation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedEmployeesInformation"].ToString() == "1" || row["IsFainalizedEmployeesInformation"].ToString().ToLower() == "true") ? true : false) : false; tmpBaseMonthlyInformation.IsFainalizedRewardCalculation = (row["IsFainalizedRewardCalculation"] != DBNull.Value) ? Convert.ToBoolean((row["IsFainalizedRewardCalculation"].ToString() == "1" || row["IsFainalizedRewardCalculation"].ToString().ToLower() == "true") ? true : false) : false; tmpBaseMonthlyInformation.BossFactor = (row["BossFactor"] != DBNull.Value) ? Convert.ToDecimal(row["BossFactor"]) : 0; tmpBaseMonthlyInformation.OperationalFactor = (row["OperationalFactor"] != DBNull.Value) ? Convert.ToDecimal(row["OperationalFactor"]) : 0; tmpBaseMonthlyInformation.Factor1 = (row["Factor1"] != DBNull.Value) ? Convert.ToDecimal(row["Factor1"]) : 0; tmpBaseMonthlyInformation.Factor2 = (row["Factor2"] != DBNull.Value) ? Convert.ToDecimal(row["Factor2"]) : 0; tmpBaseMonthlyInformation.Factor3 = (row["Factor3"] != DBNull.Value) ? Convert.ToDecimal(row["Factor3"]) : 0; tmpBaseMonthlyInformation.Factor4 = (row["Factor4"] != DBNull.Value) ? Convert.ToDecimal(row["Factor4"]) : 0; listBaseMonthlyInformation.Add(tmpBaseMonthlyInformation); } } } return(listBaseMonthlyInformation); }
protected void Page_Load(object sender, EventArgs e) { string yearTypeID = Request.QueryString["yearTypeID"] as string; string monthTypeID = Request.QueryString["monthTypeID"] as string; string mainOfficeTypeID = Request.QueryString["mainOfficeTypeID"] as string; if (yearTypeID == null || monthTypeID == null || mainOfficeTypeID == null) { Response.Redirect("Z_BaseMonthlyInformationDefault.aspx"); } try { baseMonthlyInformationYearTypeID = Convert.ToInt32(yearTypeID.Trim()); baseMonthlyInformationMonthTypeID = Convert.ToInt32(monthTypeID.Trim()); baseMonthlyInformationMainOfficeTypeID = Convert.ToInt32(mainOfficeTypeID.Trim()); baseMonthlyInformationHandler = new BaseMonthlyInformationHandler(); BaseMonthlyInformation baseMonthlyInformation = baseMonthlyInformationHandler.GetDetails(baseMonthlyInformationYearTypeID, baseMonthlyInformationMonthTypeID, baseMonthlyInformationMainOfficeTypeID); lblYearTypeID.Text = baseMonthlyInformation.YearTypeID.ToString(); lblMonthTypeID.Text = baseMonthlyInformation.MonthTypeID.ToString(); lblMainOfficeTypeID.Text = baseMonthlyInformation.MainOfficeTypeID.ToString(); lblValueToScore.Text = baseMonthlyInformation.ValueToScore.ToString(); lblTotalOperationalReward.Text = baseMonthlyInformation.TotalOperationalReward.ToString(); lblTotalOrganizationalReward.Text = baseMonthlyInformation.TotalOrganizationalReward.ToString(); lblContractualDividableReward.Text = baseMonthlyInformation.ContractualDividableReward.ToString(); lblContractualBossReward.Text = baseMonthlyInformation.ContractualBossReward.ToString(); lblContractualDevotedReward.Text = baseMonthlyInformation.ContractualDevotedReward.ToString(); lblContractualRemainingReward.Text = baseMonthlyInformation.ContractualRemainingReward.ToString(); lblDividableReward.Text = baseMonthlyInformation.DividableReward.ToString(); lblBossReward.Text = baseMonthlyInformation.BossReward.ToString(); lblDevotedReward.Text = baseMonthlyInformation.DevotedReward.ToString(); lblRemainingReward.Text = baseMonthlyInformation.RemainingReward.ToString(); lblYearTypeIDTitle.Text = baseMonthlyInformation.YearTypeIDTitle.ToString(); lblMonthTypeIDTitle.Text = baseMonthlyInformation.MonthTypeIDTitle.ToString(); lblContractualReward.Text = baseMonthlyInformation.ContractualReward.ToString(); lblContractualConstantReward.Text = baseMonthlyInformation.ContractualConstantReward.ToString(); lblExtraReward.Text = baseMonthlyInformation.ExtraReward.ToString(); lblFactor5.Text = baseMonthlyInformation.Factor5.ToString(); lblFactor6.Text = baseMonthlyInformation.Factor6.ToString(); lblFactor7.Text = baseMonthlyInformation.Factor7.ToString(); lblFactor8.Text = baseMonthlyInformation.Factor8.ToString(); lblFactor9.Text = baseMonthlyInformation.Factor9.ToString(); lblFactor10.Text = baseMonthlyInformation.Factor10.ToString(); lblOfficialReward.Text = baseMonthlyInformation.OfficialReward.ToString(); lblIsFanalized.Text = baseMonthlyInformation.IsFanalized.ToString(); lblIsFainalizedEmployeesInformation.Text = baseMonthlyInformation.IsFainalizedEmployeesInformation.ToString(); lblIsFainalizedRewardCalculation.Text = baseMonthlyInformation.IsFainalizedRewardCalculation.ToString(); lblBossFactor.Text = baseMonthlyInformation.BossFactor.ToString(); lblOperationalFactor.Text = baseMonthlyInformation.OperationalFactor.ToString(); lblFactor1.Text = baseMonthlyInformation.Factor1.ToString(); lblFactor2.Text = baseMonthlyInformation.Factor2.ToString(); lblFactor3.Text = baseMonthlyInformation.Factor3.ToString(); lblFactor4.Text = baseMonthlyInformation.Factor4.ToString(); } catch (Exception) { Response.Redirect("Z_BaseMonthlyInformationDefault.aspx"); } }