Exemple #1
0
        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)
            {
            }
        }