protected void btnDelete_Click(object sender, EventArgs e) { act_activity aObj = new act_activity(); aObj.ConnectionString = DataAccess.getConnStr(); if (!Request.QueryString.Get("id").ToString().Equals("-1")) { if (hfDelete.Value == "Yes") { aObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("id").ToString())); aObj.DeleteCurrentRow(); aObj.Save(); InjectScript.Text = "<script>CloseAndRebind()</" + "script>"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.RadMultiViewActivity.SelectedIndex = 0; RadTabStrip1.SelectedIndex = 0; hlActivityChangeRequest.Attributes.Add("onclick", "editActivityChangeRequest(" + Request.QueryString.Get("id").ToString() + ", -1, 'activityEquip')"); ddStatus.DataBind(); cblCoreIndicators.DataBind(); SqlActivitieChanges.DataBind(); RadGrid2.DataBind(); hfPageInfo.Value = "0"; lblMsg.Text = ""; try { this.RadMultiViewActivity.SelectedIndex = Convert.ToInt32(Request.QueryString.Get("view").ToString()); RadTabStrip1.SelectedIndex = Convert.ToInt32(Request.QueryString.Get("view").ToString()); } catch { } lp_local_plan lpObj = new lp_local_plan(); if (lpObj.LoadByPrimaryKey(Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()))) { lblCollege.Text = lpObj.Txt_college_name; lblFiscalYear.Text = lpObj.Nbr_fiscal_year.ToString(); } if (Request.QueryString.Get("id").ToString().Equals("-1")) { btnDelete.Visible = false; btnSave.Text = "Add"; lblAid.Text = ""; RadTabStrip1.Tabs[1].Visible = false; btnPrint.Enabled = false; btn_Print_History.Enabled = false; btnPrintWord.Enabled = false; } else { btnDelete.Visible = true; btnSave.Text = "Save"; lblAid.Text = Request.QueryString.Get("id").ToString(); act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); if(actObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("id").ToString()))) { txtTypeEquip.Text = actObj.Txt_activity_name.ToString(); txtSupProgram.Text = actObj.Txt_activity_desc.ToString(); try { lblDateUpdated.Text = actObj.Dte_updated_date.ToShortDateString(); } catch { lblDateUpdated.Text = ""; } try { lblUpdatedBy.Text = actObj.Txt_updated_user; } catch { lblUpdatedBy.Text = ""; } txtSystemOfficeNotes.Text = actObj.Txt_system_office_notes; try { cbApproved.Checked = actObj.Flg_approved; } catch { cbApproved.Checked = false; } try { cbLocked.Checked = actObj.Flg_locked; } catch { cbLocked.Checked = false; } ddStatus.SelectedIndex = ddStatus.Items.IndexOf(ddStatus.Items.FindByValue(actObj.Key_level_id.ToString())); } } DLB_Category.SelectedIndex = 10; DLB_Category.Enabled = false; DLB_FunCode.SelectedIndex = 0; DLB_FunCode.Enabled = false; //DataView dw = (DataView)SqlDS_RLactivityGET.Select(DataSourceSelectArguments.Empty); //foreach (DataRow dr in dw.Table.Rows) //{ // txtTypeEquip.Text = dr["txt_activity_name"].ToString(); // DLB_Category.SelectedIndex = DLB_Category.Items.IndexOf(DLB_Category.Items.FindByValue(dr["key_category_id"].ToString())); // DLB_FunCode.SelectedIndex = DLB_FunCode.Items.IndexOf(DLB_FunCode.Items.FindByValue(dr["key_fund_source_id"].ToString())); // txtSupProgram.Text = dr["txt_activity_desc"].ToString(); //} //DataView dy = (DataView)SqlDS_RLActivityLineGet.Select(DataSourceSelectArguments.Empty); //foreach (DataRow dr in dy.Table.Rows) //{ //} if (cbLocked.Checked == true) if (!Session[Session.SessionID + "roleid"].ToString().Equals("101")) Lock_Page(); try { if (Request.QueryString.Get("reload") == "true") { RadTabStrip1.SelectedIndex = 1; RadMultiViewActivity.SelectedIndex = 1; } } catch { } } }
protected void btnPrintWord_Click(object sender, EventArgs e) { if (Page.IsValid) { if (Request.QueryString.Get("id").ToString().Equals("-1")) { Save(); } else { act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); if (actObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("id").ToString()))) { try { if (actObj.Flg_locked) { if (Session[Session.SessionID + "roleid"].ToString().Equals("101")) { Save(); } } else Save(); } catch { Save(); } } } lblPrintTrigger.Text = "<script>Print('equipactivities','AWDOCX')</" + "script>"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.RadMultiViewActivity.SelectedIndex = 0; RadTabStrip1.SelectedIndex = 0; hlActivityChangeRequest.Attributes.Add("onclick", "editActivityChangeRequest(" + Request.QueryString.Get("id").ToString() + ",-1, 'activityFunds')"); DLB_Category.Attributes.Add("OnChange", "saveCurrentBudget()"); txtDescActivity.Attributes.Add("onkeyup", "calCharNumber()"); txtDescCoreInd.Attributes.Add("onkeyup", "calCharNumber1()"); } try { if (Request.QueryString.Get("reload") == "true") { RadTabStrip1.SelectedIndex = 1; RadMultiViewActivity.SelectedIndex = 1; } } catch { } if (!IsPostBack) { DLB_Category.DataBind(); DLB_FunCode.DataBind(); ddlUseOfFunds.DataBind(); TRG_Funds.DataBind(); DLB_ActType.DataBind(); ddlProgramType.DataBind(); ddStatus.DataBind(); cblCoreIndicators.DataBind(); hfPageInfo.Value = "0"; lblMsg.Text = ""; try { this.RadMultiViewActivity.SelectedIndex = Convert.ToInt32(Request.QueryString.Get("view").ToString()); RadTabStrip1.SelectedIndex = Convert.ToInt32(Request.QueryString.Get("view").ToString()); } catch { } lp_local_plan lpObj = new lp_local_plan(); if (lpObj.LoadByPrimaryKey(Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()))) { lblCollege.Text = lpObj.Txt_college_name; lblFiscalYear.Text = lpObj.Nbr_fiscal_year.ToString(); } if(Request.QueryString.Get("id").ToString().Equals("-1")) { //Add new btnDelete.Visible = false; btnSave.Text = "Add"; lblAvtivityNbr.Text = ""; RadTabStrip1.Tabs[1].Visible = false; btnPrint.Enabled = false; btn_Print_History.Enabled = false; btnPrintWord.Enabled = false; } else { // Edit //btnDelete.Visible = true; btnSave.Text = "Save"; //DataView dw = (DataView)SqlDS_RLactivityGET.Select(DataSourceSelectArguments.Empty); //foreach (DataRow dr in dw.Table.Rows) //{ // DLB_ActType.SelectedIndex = DLB_ActType.Items.IndexOf(DLB_ActType.Items.FindByValue(dr["key_activity_type_id"].ToString())); // txtActivityName.Text = dr["txt_activity_name"].ToString(); // txtDescActivity.Text = dr["txt_activity_desc"].ToString(); // txtDescCoreInd.Text = dr["txt_activity_core_indicator_desc"].ToString(); // DLB_Category.SelectedIndex = DLB_Category.Items.IndexOf(DLB_Category.Items.FindByValue(dr["key_category_id"].ToString())); // DLB_FunCode.SelectedIndex = DLB_FunCode.Items.IndexOf(DLB_FunCode.Items.FindByValue(dr["key_function_code_id"].ToString())); // ddlUseOfFunds.SelectedIndex = ddlUseOfFunds.Items.IndexOf(ddlUseOfFunds.Items.FindByValue(dr["key_fund_source_id"].ToString())); // ddlProgramType.SelectedIndex = ddlProgramType.Items.IndexOf(ddlProgramType.Items.FindByValue(dr["key_fa_activity_type_id"].ToString())); //} act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); if (actObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("id").ToString()))) { try { DLB_ActType.SelectedIndex = DLB_ActType.Items.IndexOf(DLB_ActType.Items.FindByValue(actObj.Key_fa_activity_type_id.ToString())); } catch { DLB_ActType.SelectedIndex = 0; } lblAvtivityNbr.Text = actObj.Key_activity_id.ToString(); txtActivityName.Text = actObj.Txt_activity_name; txtDescActivity.Text = actObj.Txt_activity_desc; try { txtDescCoreInd.Text = actObj.Txt_activity_core_indicator_desc; } catch { txtDescCoreInd.Text = ""; } DLB_Category.SelectedIndex = DLB_Category.Items.IndexOf(DLB_Category.Items.FindByValue(actObj.Key_category_id.ToString())); try { DLB_FunCode.SelectedIndex = DLB_FunCode.Items.IndexOf(DLB_FunCode.Items.FindByValue(actObj.Key_function_code_id.ToString())); } catch { DLB_FunCode.SelectedIndex = 0; } //ddlUseOfFunds.SelectedIndex = ddlUseOfFunds.Items.IndexOf(ddlUseOfFunds.Items.FindByValue(actObj.Key_fund_source_id.ToString())); //Set for 0 right now - will be changed later ddlUseOfFunds.SelectedIndex = 1; try { ddlProgramType.SelectedIndex = ddlProgramType.Items.IndexOf(ddlProgramType.Items.FindByValue(actObj.Key_fa_activity_type_id.ToString())); } catch { ddlProgramType.SelectedIndex = 0; } try { lblDateUpdated.Text = actObj.Dte_updated_date.ToShortDateString(); } catch { lblDateUpdated.Text = ""; } try { lblUpdatedBy.Text = actObj.Txt_updated_user; } catch { lblUpdatedBy.Text = ""; } try { cbApproved.Checked = actObj.Flg_approved; } catch { cbApproved.Checked = false; } try { cbLocked.Checked = actObj.Flg_locked; } catch { cbLocked.Checked = false; } txtSystemOfficeNotes.Text = actObj.Txt_system_office_notes.ToString(); ddStatus.SelectedIndex = ddStatus.Items.IndexOf(ddStatus.Items.FindByValue(actObj.Key_level_id.ToString())); } } DLB_ActType.SelectedIndex = 0; if (cbLocked.Checked == true) { if (!Session[Session.SessionID + "roleid"].ToString().Equals("101")) Lock_Page(); } //else //{ // if (ddStatus.SelectedIndex < 2) // Lock_SO(); //} } try { SDS_FunctionCODE.SelectParameters.Clear(); SDS_FunctionCODE.SelectParameters.Add("p_key_category_id", DLB_Category.SelectedValue.ToString()); DataView DW = (DataView)SDS_FunctionCODE.Select(DataSourceSelectArguments.Empty); txt_UseOfFunds.Attributes.Add("ReadOnly", "ReadOnly"); foreach (DataRow dr in DW.Table.Rows) { txt_UseOfFunds.Text = dr["txt_category_type_desc"].ToString(); } } catch { } if(hfTempTotal.Value.Trim() != "") lblTotalBudget.Text = hfTempTotal.Value; }
protected void Save() { lblMsg.Text = ""; hfPageInfo.Value = "0"; hfFlgSave.Value = ""; if (Request.QueryString.Get("id").Equals("-1")) { //Add new Activity DataAccess obj = new DataAccess(); int iLpid; try { iLpid = Convert.ToInt32(Session[Session.SessionID + "PlanID"].ToString()); String ika = obj.insertActivity(iLpid, txtActivityName.Text, txtDescActivity.Text, Convert.ToInt32(ddlProgramType.SelectedValue), txtDescCoreInd.Text, Convert.ToInt32(DLB_Category.SelectedValue), Convert.ToInt32(DLB_FunCode.SelectedValue), Convert.ToInt32(DLB_ActType.SelectedValue), 101); lblAvtivityNbr.Text = ika; //Insert Core Indicator for (int i = 0; i < cblCoreIndicators.Items.Count; i++) if (cblCoreIndicators.Items[i].Selected) obj.insertFundedActivityCoreIndicator(Convert.ToInt32(ika), Convert.ToInt32(cblCoreIndicators.Items[i].Value)); //update Line Item for (int i = 0; i < TRG_Funds.MasterTableView.Items.Count; i++) { TextBox tb = (TextBox)TRG_Funds.MasterTableView.Items[i].FindControl("txt_Funds"); if (tb != null && !tb.Text.Equals("")) { obj.updateFundedActivityLineItems(Convert.ToInt32(ika), Convert.ToInt32(TRG_Funds.MasterTableView.Items[i].GetDataKeyValue("key_line_item_type_id")), Convert.ToDecimal(tb.Text)); } } InjectScript.Text = "<script>refreshPage(" + ika + ")</" + "script>"; } catch { //No local plan id } } else { //Update current activity DataAccess obj = new DataAccess(); act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); int ika = Convert.ToInt32(Request.QueryString.Get("id").ToString()); if (actObj.LoadByPrimaryKey(ika)) { //Local Plan id will be enter later, use 101 for now obj.updateActivity(ika, Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()), txtActivityName.Text, txtDescActivity.Text, Convert.ToInt32(ddlProgramType.SelectedValue), txtDescCoreInd.Text, Convert.ToInt32(DLB_Category.SelectedValue), Convert.ToInt32(DLB_FunCode.SelectedValue), Convert.ToInt32(DLB_ActType.SelectedValue), txtSystemOfficeNotes.Text, Convert.ToInt32(ddStatus.SelectedValue), cbLocked.Checked, cbApproved.Checked, false, "", 101); //Insert Core Indicator for (int i = 0; i < cblCoreIndicators.Items.Count; i++) if (cblCoreIndicators.Items[i].Selected) obj.insertFundedActivityCoreIndicator(Convert.ToInt32(ika), Convert.ToInt32(cblCoreIndicators.Items[i].Value)); //update Line Item for (int i = 0; i < TRG_Funds.MasterTableView.Items.Count; i++) { TextBox tb = (TextBox)TRG_Funds.MasterTableView.Items[i].FindControl("txt_Funds"); if (tb != null && !tb.Text.Equals("")) { obj.updateFundedActivityLineItems(Convert.ToInt32(ika), Convert.ToInt32(TRG_Funds.MasterTableView.Items[i].GetDataKeyValue("key_line_item_type_id")), Convert.ToDecimal(tb.Text)); } } } scs_error_dictionary errObj = new scs_error_dictionary(); if (errObj.LoadByPrimaryKey("200")) { lblMsg.Text = errObj.Txt_message; } } TRG_Funds.DataBind(); RadGrid1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { act_activity aObj = new act_activity(); if (aObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("aid")))) { hdnactivityid.Value = Request.QueryString.Get("aid").ToString(); lblActivityName.Text = aObj.Txt_activity_name; lblDescription.Text = aObj.Txt_activity_desc; hfLpId.Value = aObj.Key_local_plan_id.ToString(); } } lblInject.Text = ""; GearBox_ActivityReimbursement_Secruity(); }
protected void Page_Load(object sender, EventArgs e) { txtNewActivityDesc.Attributes.Add("onKeyUp", "calCharNumber1()"); txtNewCoreIndicatorDesc.Attributes.Add("onKeyUp", "calCharNumber2()"); if (!Page.IsPostBack) { SqlDS_RLcoreindi_Get.DataBind(); cblCoreIndicators.DataBind(); lblMsg.Text = ""; lp_local_plan lpObj = new lp_local_plan(); if (lpObj.LoadByPrimaryKey(Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()))) { lblCollege.Text = lpObj.Txt_college_name; lblFiscalYear.Text = lpObj.Nbr_fiscal_year.ToString(); } act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); if (actObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("aid").ToString()))) { lblAvtivityNbr.Text = actObj.Key_activity_id.ToString(); lblActivityName.Text = actObj.Txt_activity_name; lblActivityDesc.Text = actObj.Txt_activity_desc; try { lblCoreIndicatorDesc.Text = actObj.Txt_activity_core_indicator_desc; //txtNewCoreIndicatorDesc.Text = actObj.Txt_activity_core_indicator_desc; } catch { lblCoreIndicatorDesc.Text = ""; //txtNewCoreIndicatorDesc.Text = ""; } //try //{ // cbApproved.Checked = actObj.Flg_approved; //} //catch //{ // cbApproved.Checked = false; //} } if (Request.QueryString.Get("acrId").ToString().Equals("-1")) { //Add new btnDelete.Visible = false; btnSave.Text = "Add"; lblAvtivityNbr.Text = ""; lblDateCreated.Text = DateTime.Now.ToShortDateString(); txtNewActivityName.Text = actObj.Txt_activity_name; //txtNewActivityDesc.Text = actObj.Txt_activity_desc; } else { // Edit btnDelete.Visible = true; btnSave.Text = "Save"; act_change acObj = new act_change(); if (acObj.LoadByPrimaryKey(Convert.ToInt32(Request.QueryString.Get("acrId").ToString()))) { txtNewActivityName.Text = acObj.Txt_activity_name_new; try { txtNewCoreIndicatorDesc.Text = acObj.Txt_activity_core_indicator_desc_new; } catch { txtNewCoreIndicatorDesc.Text = ""; } try { txtNewActivityDesc.Text = acObj.Txt_activity_desc_new; } catch { txtNewActivityDesc.Text = ""; } try{ cbApproved.Checked = acObj.Flg_approved; } catch{ cbApproved.Checked = false; } if (cbApproved.Checked) { btnSave.Enabled = false; cbApproved.Enabled = false; } else { btnSave.Enabled = true; cbApproved.Enabled = true; } lblDateCreated.Text = acObj.Dte_create_date.ToShortDateString(); } } } }
protected void btnSave_Click(object sender, EventArgs e) { if (Page.IsValid) { try { //Update current activity DataAccess obj = new DataAccess(); act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); int ika = Convert.ToInt32(Request.QueryString.Get("keyid").ToString()); if (actObj.LoadByPrimaryKey(ika)) { obj.updateActivity(ika, Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()), (FormView1.FindControl("txtActivityName") as TextBox).Text, (FormView1.FindControl("txtDescActivity") as TextBox).Text, Convert.ToInt32((FormView1.FindControl("ddlProgramType") as DropDownList).SelectedValue), (FormView1.FindControl("txtDescCoreInd") as TextBox).Text, Convert.ToInt32((FormView1.FindControl("DLB_Category") as DropDownList).SelectedValue), Convert.ToInt32((FormView1.FindControl("DLB_FunCode") as DropDownList).SelectedValue), actObj.Key_activity_type_id, (FormView1.FindControl("txtSystemOfficeNotes") as TextBox).Text, Convert.ToInt32((FormView1.FindControl("ddStatus") as DropDownList).SelectedValue), (FormView1.FindControl("cbLocked") as CheckBox).Checked, (FormView1.FindControl("cbApproved") as CheckBox).Checked, true, (FormView1.FindControl("txtAmdReductionDesc") as TextBox).Text, 102); //Insert Core Indicator CheckBoxList cblCoreIndicators = FormView1.FindControl("chkCoreIndicators") as CheckBoxList; for (int i = 0; i < cblCoreIndicators.Items.Count; i++) if (cblCoreIndicators.Items[i].Selected) obj.insertFundedActivityCoreIndicator(Convert.ToInt32(ika), Convert.ToInt32(cblCoreIndicators.Items[i].Value)); //update Line Item //for (int i = 0; i < TRG_Funds.MasterTableView.Items.Count; i++) //{ // TextBox tb = (TextBox)TRG_Funds.MasterTableView.Items[i].FindControl("txt_Funds"); // if (tb != null && !tb.Text.Equals("")) // { // obj.updateFundedActivityLineItems(Convert.ToInt32(ika), // Convert.ToInt32(TRG_Funds.MasterTableView.Items[i].GetDataKeyValue("key_line_item_type_id")), // Convert.ToDecimal(tb.Text)); // } //} scs_error_dictionary errObj = new scs_error_dictionary(); if (errObj.LoadByPrimaryKey("200")) { (FormView1.FindControl("lblMsg") as Label).Text = errObj.Txt_message; } } } catch(Exception ex) { scs_error_dictionary errObj = new scs_error_dictionary(); if (errObj.LoadByPrimaryKey("201")) { (FormView1.FindControl("lblMsg") as Label).Text = errObj.Txt_message; } } } }
protected void Save() { if (Page.IsValid) { try { //Update current activity DataAccess obj = new DataAccess(); act_activity actObj = new act_activity(); actObj.ConnectionString = DataAccess.getConnStr(); int ika = Convert.ToInt32(Request.QueryString.Get("keyid").ToString()); if (actObj.LoadByPrimaryKey(ika)) { String sRet = obj.updateActivity(ika, Convert.ToInt32(Session[Session.SessionID.ToString() + "PlanID"].ToString()), (FormView1.FindControl("txtActivityName") as TextBox).Text, (FormView1.FindControl("txtDescActivity") as TextBox).Text, -1, (FormView1.FindControl("txtDescCoreInd") as TextBox).Text, -1, -1, actObj.Key_activity_type_id, (FormView1.FindControl("txtSystemOfficeNotes") as TextBox).Text, Convert.ToInt32((FormView1.FindControl("ddStatus") as DropDownList).SelectedValue), (FormView1.FindControl("cbLocked") as CheckBox).Checked, (FormView1.FindControl("cbApproved") as CheckBox).Checked, true, (FormView1.FindControl("txtAmdReductionDesc") as TextBox).Text, 102); String errCode; if (sRet.Equals("0")) errCode = "200"; else errCode = "201"; scs_error_dictionary errObj = new scs_error_dictionary(); if (errObj.LoadByPrimaryKey(errCode)) { (FormView1.FindControl("lblMsg") as Label).Text = errObj.Txt_message; // errObj.Txt_message; } } } catch (Exception ex) { scs_error_dictionary errObj = new scs_error_dictionary(); if (errObj.LoadByPrimaryKey("201")) { (FormView1.FindControl("lblMsg") as Label).Text = errObj.Txt_message; } } } }