Пример #1
0
        //To Bind EmployeeGrid

        #region [Bind Employee Grid]

        public DataSet BindEmployeeGrid_DL(EWA_AssignDeptDes objEWA)
        {
            DataSet ds = new DataSet();

            try
            {
                prmList    = new string[10];
                prmList[0] = "@Action";
                prmList[1] = objEWA.Action;
                prmList[2] = "@OrgId";

                prmList[3] = objEWA.OrgId.ToString();
                prmList[4] = "@DesignationTypeId";
                prmList[5] = objEWA.DesignationTypeId.ToString();
                prmList[6] = "@DepartmentId";
                prmList[7] = objEWA.DepartmentId.ToString();
                prmList[8] = "@DesignationId";
                prmList[9] = objEWA.DesignationId.ToString();

                ds = ObjHelper.FillControl(prmList, "SP_EmpAssignDeptDes");

                return(ds);
            }
            catch (Exception exp)
            {
                throw exp;
            }
        }
Пример #2
0
        //Emp Data Bound
        #region [Emp Data Bound]

        protected void GrdViewEmployee_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            try
            {
                if (e.Row.RowIndex > -1)
                {
                    GridViewRow       GrdRow = e.Row;
                    EWA_AssignDeptDes ObjEWA = new EWA_AssignDeptDes();
                    BL_AssignDeptDes  ObjBL  = new BL_AssignDeptDes();
                    ObjEWA.Action   = "FetchDepartment";
                    ObjEWA.UserCode = GrdRow.Cells[0].Text;

                    DataSet ds      = ObjBL.FetchDepartment_BL(ObjEWA);
                    string  joinstr = "No record found";
                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        joinstr = ds.Tables[0].Rows[0][0].ToString();
                        for (int i = 1; i < ds.Tables[0].Rows.Count; i++)
                        {
                            joinstr += "," + ds.Tables[0].Rows[i][0].ToString();
                        }
                    }
                    GrdRow.Cells[2].Text = joinstr;
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #3
0
        //Grid Emp Bind
        #region [Grid Emp Bind]

        private void GrdEmployeeBind()
        {
            try
            {
                EWA_AssignDeptDes objEWA = new EWA_AssignDeptDes();
                BL_AssignDeptDes  objBL  = new BL_AssignDeptDes();
                objEWA.Action = "FetchNotAssignedEmployee";
                objEWA.OrgId  = Session["OrgId"].ToString();

                objEWA.DepartmentId      = ddlDepartment.SelectedValue.ToString();
                objEWA.DesignationTypeId = rbtlDesType.SelectedValue.ToString();
                objEWA.DesignationId     = ddlDesignation.SelectedValue.ToString();

                DataSet ds = objBL.EmployeeGridBind_BL(objEWA);
                if (ds.Tables[0].Rows.Count != 0)
                {
                    GrdEmployee.DataSource = ds;
                    GrdEmployee.DataBind();
                    dsGrdEmployee = ds.Copy();
                    GrdEmployee.Columns[3].Visible = true;
                }
                else
                {
                    ShowEmptyGridView(GrdEmployee);
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }
Пример #4
0
        //To Perform Insert,Update,Delete and Search Actions On EmpDeptDes Table

        #region [Perform Actions On Emp Dept Des]

        public int EmpDeptDesAction_DL(EWA_AssignDeptDes objEWA)
        {
            try
            {
                cmd             = new SqlCommand("SP_EmpAssignDeptDes", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@Action", objEWA.Action);
                cmd.Parameters.AddWithValue("@UserCode", objEWA.UserCode);
                cmd.Parameters.AddWithValue("@DepartmentId", objEWA.DepartmentId);
                cmd.Parameters.AddWithValue("@DesignationTypeId", objEWA.DesignationTypeId);
                cmd.Parameters.AddWithValue("@DesignationId", objEWA.DesignationId);
                cmd.Parameters.AddWithValue("@OrgId", objEWA.OrgId);
                cmd.Parameters.AddWithValue("@UserId", objEWA.UserId);
                cmd.Parameters.AddWithValue("@IsActive", objEWA.IsActive);
                con.Open();
                int flag = cmd.ExecuteNonQuery();
                con.Close();
                return(flag);
            }
            catch (Exception ex)
            {
                int err = ((System.Data.SqlClient.SqlException)(ex)).Number;
                if (err == 547 && objEWA.Action == "Delete")
                {
                    throw new SystemException("Record is in use !!!");
                }
                else
                {
                    throw ex;
                }
            }
        }
Пример #5
0
        //Course Class Action
        #region [Course Class Action]

        public int EmpCourseClassAction_BL(EWA_AssignDeptDes objEWA)
        {
            try
            {
                int flag = objDL.EmpDeptDesAction_DL(objEWA);
                return(flag);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #6
0
        //Fetch Department
        #region [Fetch Department]

        public DataSet FetchDepartment_BL(EWA_AssignDeptDes ObjEWA)
        {
            try
            {
                DL_AssignDeptDes objDL = new DL_AssignDeptDes();
                DataSet          ds    = objDL.FetchDepartment_DL(ObjEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objDL = null;
            }
        }
Пример #7
0
        //To Call Employee Grid Bind
        #region [Employee Grid Bind]

        public System.Data.DataSet EmployeeGridBind_BL(EWA_AssignDeptDes objEWA)
        {
            try
            {
                DL_AssignDeptDes objDL = new DL_AssignDeptDes();
                DataSet          ds    = objDL.BindEmployeeGrid_DL(objEWA);
                return(ds);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                objDL = null;
            }
        }
Пример #8
0
        //Fetch department
        #region [Fetch Department]

        public DataSet FetchDepartment_DL(EWA_AssignDeptDes ObjEWA)
        {
            DataSet ds = new DataSet();

            try
            {
                prmList    = new string[4];
                prmList[0] = "@Action";
                prmList[1] = ObjEWA.Action;
                prmList[2] = "@UserCode";
                prmList[3] = ObjEWA.UserCode;

                ds = ObjHelper.FillControl(prmList, "SP_EmpAssignDeptDes");
                return(ds);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Пример #9
0
        //Link Button
        #region [Link Button]

        protected void lnkbtn_Click(object sender, EventArgs e)
        {
            try
            {
                string[] confirmValue = Request.Form["confirm_value"].Split(',');
                if (confirmValue[confirmValue.Length - 1] == "Yes")
                {
                    int flag;

                    EWA_AssignDeptDes ObjEWA = new EWA_AssignDeptDes();
                    BL_AssignDeptDes  ObjBL  = new BL_AssignDeptDes();
                    GridViewRow       grdrow = (GridViewRow)((LinkButton)sender).NamingContainer;

                    ObjEWA.Action            = "Delete";
                    ObjEWA.UserCode          = grdrow.Cells[0].Text;
                    ObjEWA.DepartmentId      = ddlDepartment.SelectedValue.ToString();
                    ObjEWA.DesignationTypeId = rbtlDesType.SelectedValue.ToString();
                    ObjEWA.DesignationId     = ddlDesignation.SelectedValue.ToString();

                    flag = ObjBL.EmpDeptDesAction_BL(ObjEWA);
                    if (flag > 0)
                    {
                        msgBox.ShowMessage("deleted !!!", "Deleted", UserControls.MessageBox.MessageStyle.Successfull);
                    }
                    else
                    {
                        msgBox.ShowMessage("Not Deleted. Atleast one department should be assigned !!!", "Not Deleted", UserControls.MessageBox.MessageStyle.Information);
                    }
                    GrdViewEmployeeBind();
                    GrdEmployeeBind();
                }
            }
            catch (Exception exp)
            {
                GeneralErr(exp.Message.ToString());
            }
        }