private void BindGrid()
        {
            DesignationMasterDAL objclsDesignationMasterDAL = new DesignationMasterDAL();
            string strEmpName   = string.IsNullOrEmpty(txtDesigNm.Text.Trim()) ? "" : (txtDesigNm.Text.Trim());
            var    objEmpMaster = objclsDesignationMasterDAL.Select(strEmpName);

            objclsDesignationMasterDAL = null;
            if (objEmpMaster != null && objEmpMaster.Count > 0)
            {
                grdMain.DataSource = objEmpMaster;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + objEmpMaster.Count;
                imgBtnExcel.Visible = true;

                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text    = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + objEmpMaster.Count.ToString();
                lblcontant.Visible = true;
                divpaging.Visible  = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): 0 ";
                imgBtnExcel.Visible = false;
                divpaging.Visible   = false;
                lblcontant.Visible  = false;
            }
        }
Beispiel #2
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            DesignationMasterDAL objDesignationMasterDAL = new DesignationMasterDAL();
            Int64 intDesignIdno = 0;

            intDesignIdno = objDesignationMasterDAL.SelectDesigIdno();
            Response.Redirect("DesigRights.aspx?DesigIdno=" + intDesignIdno, true);
        }
        private void BindDesignation()
        {
            DesignationMasterDAL designation = new DesignationMasterDAL();
            var lst = designation.Select();

            designation             = null;
            ddlDesig.DataSource     = lst;
            ddlDesig.DataTextField  = "Desig_Name";
            ddlDesig.DataValueField = "Desig_Idno";
            ddlDesig.DataBind();
        }
Beispiel #4
0
        protected void lnkbtnSave_OnClick(object sender, EventArgs e)
        {
            Int32  empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
            string strMsg  = string.Empty;
            DesignationMasterDAL objDesignationMasterDAL = new DesignationMasterDAL();
            Int64 intDesignIdno       = 0;
            Int64 intDesignRightsIdno = 0;

            if (string.IsNullOrEmpty(hiddesignidno.Value) == true)
            {
                intDesignIdno = objDesignationMasterDAL.Insert(txtDesignation.Text.Trim(), Convert.ToBoolean(chkStatus.Checked), empIdno);
                if (intDesignIdno > 0)
                {
                    intDesignRightsIdno = objDesignationMasterDAL.InsertIntotblDesigRightss(intDesignIdno, empIdno);
                }
            }
            else
            {
                intDesignIdno = objDesignationMasterDAL.Update(txtDesignation.Text.Trim(), Convert.ToBoolean(chkStatus.Checked), Convert.ToInt32(hiddesignidno.Value), empIdno);
            }
            objDesignationMasterDAL = null;
            if (intDesignIdno > 0)
            {
                if (string.IsNullOrEmpty(hiddesignidno.Value) == false)
                {
                    lnkbtnNew.Visible = false;
                    strMsg            = "Record updated successfully.";
                }
                else
                {
                    ShowMessage("Record saved successfully.");
                    lblAlert.Text = "Do you want to assign rights for this designation ?";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Alert", "ShowDesigRights()", true);
                }
                this.ClearControls();
            }
            else if (intDesignIdno < 0)
            {
                ShowMessageErr("Record already exists!");
            }
            else
            {
                if (string.IsNullOrEmpty(hiddesignidno.Value) == false)
                {
                    ShowMessageErr("Record not updated!");
                }
                else
                {
                    ShowMessageErr("Record not saved!");
                }
            }
            //ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            txtDesignation.Focus();
        }
 protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "cmdEdit")
     {
         Response.Redirect("DesignationMaster.aspx?DesigIdno=" + e.CommandArgument, true);
     }
     //if (e.CommandName == "cmddelete")
     //{
     //    Int32 intCompIdno = 1;
     //    clsDesignationMasterDAL objclsDesignationMasterDAL = new clsDesignationMasterDAL();
     //    int value = objclsDesignationMasterDAL.Delete(Convert.ToInt32(e.CommandArgument));
     //    objclsDesignationMasterDAL = null;
     //    if (value > 0)
     //    {
     //        this.BindGrid();
     //    }
     //}
     else if (e.CommandName == "cmdstatus")
     {
         Int32    empIdno = Convert.ToInt32((Session["UserIdno"] == null) ? "0" : Session["UserIdno"].ToString());
         int      intDesgID = 0;
         bool     bStatus = false; string strMsg = string.Empty;
         string[] strStatus = Convert.ToString(e.CommandArgument).Split(new char[] { '_' });
         if (strStatus.Length > 1)
         {
             intDesgID = Convert.ToInt32(strStatus[0]);
             if (Convert.ToBoolean(strStatus[1]) == true)
             {
                 bStatus = false;
             }
             else
             {
                 bStatus = true;
             }
             DesignationMasterDAL objclsDesignationMasterDAL = new DesignationMasterDAL();
             int value = objclsDesignationMasterDAL.UpdateStatus(intDesgID, bStatus, empIdno);
             objclsDesignationMasterDAL = null;
             if (value > 0)
             {
                 this.BindGrid();
                 strMsg = "Designation updated successfully.";
                 txtDesigNm.Focus();
             }
             else
             {
                 strMsg = "Designation not updated.";
             }
             ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
         }
     }
 }
Beispiel #6
0
        /// <summary>
        /// To Populate all controls
        /// </summary>
        /// <param name="DesignIdno"></param>
        private void Populate(int DesignIdno)
        {
            DesignationMasterDAL objDesignationBLL = new DesignationMasterDAL();
            var objDesigMast = objDesignationBLL.SelectById(DesignIdno);

            objDesignationBLL = null;
            if (objDesigMast != null)
            {
                txtDesignation.Text = Convert.ToString(objDesigMast.Desig_Name);
                chkStatus.Checked   = Convert.ToBoolean(objDesigMast.Status);
                hiddesignidno.Value = Convert.ToString(objDesigMast.Desig_Idno);
                txtDesignation.Focus();
            }
        }
        public void countall()
        {
            DesignationMasterDAL objclsDesignationMasterDAL = new DesignationMasterDAL();
            Int64 total = 0;

            total = objclsDesignationMasterDAL.selectcount();
            if (total > 0)
            {
                lblTotalRecord.Text = "T. Record (s):" + total;
            }
            else
            {
                lblTotalRecord.Text = "T. Record (s): 0 ";
            }
        }