public void BindLeave() { try { LeaveMBo objLeaveMBO = new LeaveMBo(); LeaveMBl objLeaveMBL = new LeaveMBl(); ApplicationResult objResult = new ApplicationResult(); objResult = objLeaveMBL.LeaveM_SelectAll(); if (objResult != null) { gvLeaveMaster.DataSource = objResult.resultDT; gvLeaveMaster.DataBind(); if (gvLeaveMaster.Rows.Count > 0) { PanelGrid_VisibilityMode(1); } else { PanelGrid_VisibilityMode(2); } } } catch (Exception ex) { logger.Error("Error", ex); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } }
protected void gvLeaveMaster_OnRowCommand(object sender, GridViewCommandEventArgs e) { try { ApplicationResult objResult = new ApplicationResult(); LeaveMBl objLeaveMBL = new LeaveMBl(); if (e.CommandName.ToString() == "Edit1") { ViewState["Mode"] = "Edit"; ViewState["LeaveID"] = e.CommandArgument.ToString(); objResult = objLeaveMBL.LeaveM_Select(Convert.ToInt32(e.CommandArgument.ToString())); if (objResult != null) { if (objResult.resultDT.Rows.Count > 0) { txtLeaveCode.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_LEAVECODE].ToString(); txtLeaveName.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_LEAVENAME].ToString(); txtLeaveDescription.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_LEAVEDESCRIPTION].ToString(); txtLOpening.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_LEAVEOPENING].ToString(); txtCarryForward.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_LEAVECARRYFORWARDLIMIT].ToString(); ddlYear.Text = objResult.resultDT.Rows[0][LeaveMBo.LEAVEM_YEAR].ToString(); // txtFeesGroupName.Text = objResult.resultDT.Rows[0][FeesGroupBo.FEESGROUP_FEEGROUPNAME].ToString(); // ddlLedger.SelectedValue = objResult.resultDT.Rows[0][FeesGroupBo.FEESGROUP_LedgerID].ToString(); PanelGrid_VisibilityMode(2); } } } else if (e.CommandName.ToString() == "Delete1") { objResult = objLeaveMBL.LeaveM_Delete(Convert.ToInt32(e.CommandArgument.ToString())); if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Record Deleted Successfully');</script>"); PanelGrid_VisibilityMode(1); // bindYear(); BindLeave(); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>"); } } } catch (Exception ex) { } }
protected void btnSaveFeesGroup_Click(object sender, EventArgs e) { ; LeaveMBo objLeaveMBO = new LeaveMBo(); LeaveMBl objLeaveMBL = new LeaveMBl(); ApplicationResult objResults = new ApplicationResult(); Controls objControls = new Controls(); objLeaveMBO.TrustMID = Convert.ToInt32(Session[ApplicationSession.TRUSTID]); objLeaveMBO.LeaveCode = txtLeaveCode.Text.Trim(); objLeaveMBO.LeaveName = txtLeaveName.Text.Trim(); objLeaveMBO.LeaveDescription = txtLeaveDescription.Text; objLeaveMBO.LeaveOpening = Convert.ToInt32(txtLOpening.Text); objLeaveMBO.LeaveCarryForwardLimit = Convert.ToInt32(txtCarryForward.Text); objLeaveMBO.Year = Convert.ToInt32(ddlYear.SelectedItem.Text); objLeaveMBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objLeaveMBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); //objLeaveMBO.SchoolMID = Convert.ToInt32(Session[ApplicationSession.SCHOOLID]); //objLeaveMBO.FeeGroupName = txtFeesGroupName.Text.Trim(); //objLeaveMBO.LedgerID = Convert.ToInt32(ddlLedger.SelectedValue); if (ViewState["Mode"].ToString() == "Save") { objLeaveMBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objLeaveMBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objResults = objLeaveMBL.LeaveM_Insert(objLeaveMBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClearAll(); ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Leave Saved Successfully.');</script>"); BindLeave(); //bindYear(); PanelGrid_VisibilityMode(1); } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Leave Name already Exists.');</script>"); } } else { objLeaveMBO.LeaveID = Convert.ToInt32(ViewState["LeaveID"].ToString()); objLeaveMBO.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objLeaveMBO.LastModifiedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objLeaveMBO.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]); objLeaveMBO.CreatedDate = DateTime.UtcNow.AddHours(5.5).ToString(); objResults = objLeaveMBL.LeaveM_Update(objLeaveMBO); if (objResults.status == ApplicationResult.CommonStatusType.SUCCESS) { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Leave updated successfully.');</script>"); //bindYear(); BindLeave(); ClearAll(); ViewState["Mode"] = "Save"; // btnSave.Text = "Save"; } else { ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Fees Group Name already Exists.');</script>"); } } }