Ejemplo n.º 1
0
    /// <summary>
    /// Disaply the seat arrangment according to Branch & Section.
    /// </summary>
    public void DisplaySeatArrangment()
    {
        try
        {
            //Declare the object of  BusinessEntities.SeatAllocation class.
            BusinessEntities.SeatAllocation SeatInformation = new BusinessEntities.SeatAllocation();

            //By default page should display section A seat arrangement.
            if (String.IsNullOrEmpty(RbListSeatAllocation.SelectedValue))
            {
                RbListSeatAllocation.SelectedIndex = 0;
            }

            SeatInformation.SectionID    = Convert.ToInt32(RbListSeatAllocation.SelectedValue);
            SeatInformation.RaveBranchID = Convert.ToInt32(ddlBranch.SelectedValue);

            //Assign HTML made table to Div for display.
            divSeatDetails.InnerHtml = makeSeatDetailsTable(getSeatDetails(SeatInformation));
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "DisplaySeatArrangment", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Shift the employee  seat location fron one seat to another.
    /// </summary>
    /// <param name="Source"></param>
    /// <param name="Destination"></param>
    /// <returns></returns>
    public bool ShiftLocation(BusinessEntities.SeatAllocation Source, BusinessEntities.SeatAllocation Destination)
    {
        try
        {
            //Invoke the object of business layer to call BusinessLayer method.
            objBLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

            //Create & Invoke the object of BusinessEntities.SeatAllocation to get details of shifted employee.
            BusinessEntities.SeatAllocation EmpDetails = new BusinessEntities.SeatAllocation();

            //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of destination.
            seatDetails = new BusinessEntities.SeatAllocation();

            //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of source.
            BusinessEntities.SeatAllocation seat = new BusinessEntities.SeatAllocation();

            //call BusinessLayer method to shift the location.
            result = objBLSeatAllocation.ShiftLocation(Source, Destination);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "ShiftLocation", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
        return(result);
    }
Ejemplo n.º 3
0
        public bool Allocate(BusinessEntities.SeatAllocation SeatDetails)
        {
            try
            {
                //instantiate SeatAllocation object of data layer
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();

                result = objSeatAllocation.Allocate(SeatDetails);

                if (result)
                {
                    SendAllocatationEMail(SeatDetails);
                }

                return(result);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, "Allocate", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 4
0
    /// <summary>
    /// Get the color code for whether seat allocated or not.
    /// </summary>
    /// <param name="SeatNo"></param>
    /// <returns></returns>
    public string getColorCodeForSeats(BusinessEntities.SeatAllocation SeatNo)
    {
        try
        {
            string tdColor;

            //If No employee is associated with seat then display yellow color.
            if (SeatNo.EmployeeID == 0)
            {
                tdColor = "#F7FE2E";
            }
            //If  employee is associated with seat then display green color.
            else
            {
                tdColor = "#009900";
            }
            return(tdColor);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "getColorCodeForSeats", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 5
0
        /// <summary>
        /// Swaping seat location.
        /// </summary>
        /// <param name="sourceSeatId"> first seat location</param>
        /// <param name="destinationSeatId"> 2nd seat location</param>
        /// <returns></returns>
        public bool SwapLocation(BusinessEntities.SeatAllocation source,
                                 BusinessEntities.SeatAllocation destination)
        {
            try
            {
                //instantiate SeatAllocation object of data layer
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();

                result = objSeatAllocation.SwapLocation(source, destination);

                if (result)
                {
                    //Shifting mail for first shifted employee.
                    SendSeatShiftingEmail(source, destination);

                    //Shifting mail for second shifted employee.
                    SendSeatShiftingEmail(destination, source);
                }

                return(result);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, GETSEATDETAILS, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 6
0
    /// <summary>
    /// Check whether employee allocated to any seat.
    /// </summary>
    /// <param name="employeeId"></param>
    /// <returns></returns>
    public bool CheckEmployeeLocation(int employeeId)
    {
        bool flag = true;

        try
        {
            SeatDetails = new BusinessEntities.SeatAllocation();

            BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();
            SeatDetails      = BLSeatAllocation.CheckEmployeeLocation(employeeId);

            if (SeatDetails != null)
            {
                flag = false;
                lblConfirmMessage.Text = "<font color=RED >'" + SeatDetails.EmployeeName + "' has been already allocated at Seat No. '" + SeatDetails.SeatName + "'</font>";
            }
            else
            {
                flag = true;
            }
            return(flag);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "CheckEmployeeLocation", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 7
0
    /// <summary>
    /// Check whether seat is allocated to self(LOGIN USER).
    /// </summary>
    /// <param name="seat"></param>
    /// <returns></returns>
    public bool CheckSelfAllocation(BusinessEntities.SeatAllocation seat)
    {
        try
        {
            BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

            SeatDetails = new BusinessEntities.SeatAllocation();

            //Get logged in user
            Common.AuthorizationManager.AuthorizationManager objAuMan = new Common.AuthorizationManager.AuthorizationManager();

            string LoggedInuserEmailId = objAuMan.getLoggedInUserEmailId();

            if (LoggedInuserEmailId == seat.EmployeeEmailID)
            {
                result = true;
            }
            return(result);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, CHECKSELFALLOCATION, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Shift the seat from one location to another.
        /// </summary>
        /// <param name="Source"></param>
        /// <param name="Destination"></param>
        /// <returns></returns>
        public bool ShiftLocation(BusinessEntities.SeatAllocation Source, BusinessEntities.SeatAllocation Destination)
        {
            try
            {
                //instantiate SeatAllocation object of data layer.
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();

                result = objSeatAllocation.ShiftLocation(Source, Destination);

                if (result)
                {
                    SendSeatShiftingEmail(Source, Destination);
                }

                return(result);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, GETSEATDETAILS, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// gets the Seat details as per the ID.
        /// </summary>
        /// <param name="EmpID"></param>
        /// <returns></returns>
        public BusinessEntities.SeatAllocation GetSeatDeatilsByID(BusinessEntities.SeatAllocation Seat)
        {
            DataAccessClass objDASeatAllocation = new DataAccessClass();

            try
            {
                objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString());

                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0]       = new SqlParameter(SPParameter.SeatID, DbType.Int32);
                sqlParam[0].Value = Seat.SeatID;

                //--get result
                DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetSeatDetailsByID, sqlParam);

                //--Create entities and add to list
                BusinessEntities.SeatAllocation objBESeatDetail = new BusinessEntities.SeatAllocation();

                foreach (DataRow dr in dsSeatDescription.Tables[0].Rows)
                {
                    if (dr[DbTableColumn.Seat_SeatName].ToString() != string.Empty)
                    {
                        objBESeatDetail.SeatName = dr[DbTableColumn.Seat_SeatName].ToString();
                    }
                    if (dr[DbTableColumn.Seat_BayID].ToString() != string.Empty)
                    {
                        objBESeatDetail.BayID = Convert.ToInt32(dr[DbTableColumn.Seat_BayID]);
                    }
                    if (dr[DbTableColumn.Seat_Description].ToString() != string.Empty)
                    {
                        objBESeatDetail.SeatDescription = dr[DbTableColumn.Seat_Description].ToString();
                    }
                    if (dr[DbTableColumn.Seat_ExtentionNo].ToString() != string.Empty)
                    {
                        objBESeatDetail.ExtensionNo = Convert.ToInt32(dr[DbTableColumn.Seat_ExtentionNo]);
                    }
                    if (dr[DbTableColumn.Seat_Landmark].ToString() != string.Empty)
                    {
                        objBESeatDetail.SeatLandmark = dr[DbTableColumn.Seat_Landmark].ToString();
                    }
                    if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID].ToString());
                    }
                }
                return(objBESeatDetail);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetEmployeeDetailsByID", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER);
            }
            finally
            {
                objDASeatAllocation.CloseConncetion();
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Deallocate the employee from seat.
        /// </summary>
        /// <returns></returns>
        public List <BusinessEntities.SeatAllocation> UnallocatedEmployee()
        {
            DataAccessClass objDASeatAllocation = new DataAccessClass();
            List <BusinessEntities.SeatAllocation> objListSeatAlloctaion = null;

            // Initialise Collection class object
            raveHRCollection = new BusinessEntities.RaveHRCollection();
            try
            {
                objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString());


                //--get result
                DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetUnallocatedEmployee);

                //--Create entities and add to list
                BusinessEntities.SeatAllocation objBESeatDetail = null;
                objListSeatAlloctaion = new List <BusinessEntities.SeatAllocation>();

                foreach (DataRow dr in dsSeatDescription.Tables[0].Rows)
                {
                    objBESeatDetail = new BusinessEntities.SeatAllocation();

                    if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID]);
                    }
                    if (dr[DbTableColumn.Seat_EmployeeCode].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeCode = dr[DbTableColumn.Seat_EmployeeCode].ToString();
                    }
                    if (dr[DbTableColumn.Seat_EmployeeName].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeName = dr[DbTableColumn.Seat_EmployeeName].ToString();
                    }
                    if (dr[DbTableColumn.Seat_EMPEmailID].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeEmailID = dr[DbTableColumn.Seat_EMPEmailID].ToString();
                    }

                    //--add to list
                    objListSeatAlloctaion.Add(objBESeatDetail);
                }


                return(objListSeatAlloctaion);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "UnallocatedEmployee", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER);
            }
            finally
            {
                objDASeatAllocation.CloseConncetion();
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Save the employee details.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (btnSave.Text != "Close")
         {
             BusinessEntities.SeatAllocation SeatInfo = new BusinessEntities.SeatAllocation();
             BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();
             SeatInfo         = getControldata();
             result           = BLSeatAllocation.SaveEmpDetails(SeatInfo);
             if (result)
             {
                 lblConfirmMessage.Visible = true;
                 lblConfirmMessage.Text    = "Details Updated sucessfully";
                 btnSave.Text = "Close";
             }
         }
         else
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "close", "window.close();", true);
         }
     }
     catch (RaveHRException ex)
     {
         LogErrorMessage(ex);
     }
     catch (Exception ex)
     {
         RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
         LogErrorMessage(objEx);
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Send mail after allocation on seat.
        /// </summary>
        /// <param name="seatDetails"></param>
        private void SendAllocatationEMail(BusinessEntities.SeatAllocation seatDetails)
        {
            try
            {
                AuthorizationManager objAuMan = new AuthorizationManager();

                BusinessEntities.SeatAllocation EmpDetails = new BusinessEntities.SeatAllocation();

                BusinessEntities.SeatAllocation seat = new BusinessEntities.SeatAllocation();

                //get  seat details.
                seat = GetSeatDetailsByID(seatDetails);

                //Get the details of allocated employee.
                EmpDetails = GetEmployeeDetailsByID(seatDetails);

                IRMSEmail obj = new RMSEmail(Convert.ToInt16(EnumsConstants.RMSModule.SeatAllocation),
                                             Convert.ToInt16(EnumsConstants.EmailFunctionality.AllocatedSeat));

                //string strFromUser = objAuMan.getLoggedInUserEmailId();
                //going google
                //string username = objAuMan.GetDomainUserName(strFromUser.Replace(CommonConstants.RAVEDOMAIN, string.Empty));
                string username    = "";
                string strFromUser = objAuMan.getLoggedInUser();
                //GoogleMail
                //if (strFromUser.ToLower().Contains("@rave-tech.co.in"))
                //{
                //    username = objAuMan.GetDomainUserName(strFromUser.Replace(RAVEDOMAIN, string.Empty));
                //}
                //else
                //{
                //    username = objAuMan.GetDomainUserName(strFromUser.Replace(NORTHGATEDOMAIN, string.Empty));
                //}

                username = objAuMan.GetDomainUserName(strFromUser);

                obj.From = strFromUser;

                obj.To.Add(EmpDetails.EmployeeEmailID);

                obj.Subject = string.Format(obj.Subject, EmpDetails.EmployeeName,
                                            seat.SeatName);
                obj.Body = string.Format(obj.Body, EmpDetails.EmployeeName,
                                         seat.SeatName,
                                         GetLinkForEmail(),
                                         username);
                obj.SendEmail(obj);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, "SendAllocatationEMail", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 13
0
    /// <summary>
    /// Swaping seat location.
    /// </summary>
    /// <param name="sourceSeatId"> first seat location</param>
    /// <param name="destinationSeatId"> 2nd seat location</param>
    /// <returns></returns>
    public bool SwapLocation(int sourceSeatId, int destinationSeatId)
    {
        try
        {
            //Check the roles for shifting of loaction.(Only admin can shift the location.)
            if (Rave.HR.BusinessLayer.SeatAllocation.SeatAllocationRoles.CheckRolesSeatAllocation())
            {
                //Invoke the object of business layer to call BusinessLayer method.
                objBLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

                //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of source.
                BusinessEntities.SeatAllocation SourceSeatDetails = new BusinessEntities.SeatAllocation();

                //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of source.
                BusinessEntities.SeatAllocation DestinationSeatDetails = new BusinessEntities.SeatAllocation();

                //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of source.
                BusinessEntities.SeatAllocation Source = new BusinessEntities.SeatAllocation();
                Source.SeatID = sourceSeatId;

                //Invoke the object of BusinessEntities.SeatAllocation to get the seat deatils of source.
                BusinessEntities.SeatAllocation Destination = new BusinessEntities.SeatAllocation();
                Destination.SeatID = destinationSeatId;

                //call BusinessLayer method to shift the location.
                result = objBLSeatAllocation.SwapLocation(Source, Destination);

                //Checks For the sucess of the Shifting and sends the mail.
                if (result)
                {
                    lblMessage.Text = "Seat swapping done successfully";
                }
            }
            else
            {
                lblMessage.Text = "You are not authorised to swap employee's Location.";
                lblMessage.Text = "<font color=RED>" + lblMessage.Text + "</font>";
            }
            //Clear the hidden fields value.
            hdfDragFrom.Value  = string.Empty;
            hdfDragTo.Value    = string.Empty;
            hdfClickedTd.Value = string.Empty;
        }

        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "SwapLocation", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
        return(result);
    }
Ejemplo n.º 14
0
    /// <summary>
    /// Allocate the employee to related(clicked )seat.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnAllocate_Click(object sender, EventArgs e)
    {
        try
        {
            if (Convert.ToInt32(ddlEmpAsset.SelectedValue) != 301)
            {
                if (string.IsNullOrEmpty(hfEmpID.Value))
                {
                    hfEmpID.Value = "0";
                }

                if (Convert.ToInt32(hfEmpID.Value) != 0 && Convert.ToInt32(hfSeatID.Value) != 0)
                {
                    if (CheckEmployeeLocation(Convert.ToInt32(hfEmpID.Value)))
                    {
                        SeatDetails      = new BusinessEntities.SeatAllocation();
                        BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

                        SeatDetails.EmployeeID = Convert.ToInt32(hfEmpID.Value);
                        SeatDetails.SeatID     = Convert.ToInt32(hfSeatID.Value);

                        result = BLSeatAllocation.Allocate(SeatDetails);
                        if (result)
                        {
                            lblConfirmMessage.Visible = true;
                            lblConfirmMessage.Text    = "Details Updated sucessfully";
                            btnAllocate.Visible       = false;
                            btnOK.Visible             = true;
                        }
                    }
                }
                else
                {
                    lblConfirmMessage.Text = "<font color=RED >" + "Select a Proper Employee Code." + "</font>";
                }
            }
            else
            {
                HideControlsForAsset();
                btnAllocate.Visible    = false;
                lblConfirmMessage.Text = "<font color=RED >" + "MODULE UNDER DEVLOPMENT" + "</font>";
            }
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnAllocate_Click", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }
Ejemplo n.º 15
0
        /// <summary>
        /// get the branches of a section.
        /// </summary>
        /// <param name="branchID"></param>
        /// <returns></returns>
        public RaveHRCollection GetSectionByBranch(int branchID)
        {
            BusinessEntities.SeatAllocation objSeatAllocation = null;
            SqlDataReader   objReader           = null;;
            DataAccessClass objDASeatAllocation = new DataAccessClass();

            try
            {
                raveHRCollection = new RaveHRCollection();
                objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString());

                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0]       = new SqlParameter(SPParameter.BranchID, DbType.Int32);
                sqlParam[0].Value = branchID;

                objReader = objDASeatAllocation.ExecuteReaderSP(SPNames.SeatAllocation_GetSection, sqlParam);

                while (objReader.Read())
                {
                    objSeatAllocation             = new BusinessEntities.SeatAllocation();
                    objSeatAllocation.SectionID   = int.Parse(objReader[DbTableColumn.Seat_SectionID].ToString());
                    objSeatAllocation.SectionName = objReader[DbTableColumn.Seat_SectionName].ToString();
                    raveHRCollection.Add(objSeatAllocation);
                }

                return(raveHRCollection);
            }
            //catches RaveHRException exception
            catch (RaveHRException ex)
            {
                throw ex;
            }
            //catches genral exception
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetSectionByBranch", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER);
            }
            //close datareader and connection
            finally
            {
                //checks if datareader is null
                if (!objReader.IsClosed)
                {
                    //close datareader
                    objReader.Close();
                }

                //close connection
                objDASeatAllocation.CloseConncetion();
            }
        }
Ejemplo n.º 16
0
    /// <summary>
    /// Bind data to their respective controls.
    /// </summary>
    /// <param name="SeatData"></param>
    public void BindDataForView(BusinessEntities.SeatAllocation SeatData)
    {
        try
        {
            if (SeatData.EmployeeName != string.Empty)
            {
                tbEmpName.Text = SeatData.EmployeeName;
            }
            if (SeatData.EmployeeCode != string.Empty)
            {
                tbEmpCode.Text = SeatData.EmployeeCode;
            }
            if (SeatData.DepartmentName != string.Empty)
            {
                tbDepartmentName.Text = SeatData.DepartmentName;
            }
            if (SeatData.ProjectName != string.Empty)
            {
                tbProjectName.Text = SeatData.ProjectName;
            }
            else
            {
                tbProjectName.Text = "No project Assigned";
            }

            if (SeatData.ExtensionNo != 0)
            {
                tbExtension.Text = SeatData.ExtensionNo.ToString();
            }
            else
            {
                tbExtension.Text = "No Extension Provided";
            }

            if (SeatData.SeatLandmark != string.Empty)
            {
                tbLandmark.Text = SeatData.SeatLandmark;
            }
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "BindDataForView", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Source"></param>
        /// <param name="Destination"></param>
        /// <returns></returns>
        public bool ShiftLocation(BusinessEntities.SeatAllocation Source, BusinessEntities.SeatAllocation Destination)
        {
            DataAccessClass objDASeatAllocation = new DataAccessClass();

            try
            {
                bool result = false;

                //Opens the connection.
                objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString());
                SqlParameter[] sqlParam = new SqlParameter[2];
                sqlParam[0]       = new SqlParameter(SPParameter.SourceLocation, DbType.Int32);
                sqlParam[0].Value = Source.SeatID;
                sqlParam[1]       = new SqlParameter(SPParameter.Destination, DbType.Int32);
                sqlParam[1].Value = Destination.SeatID;
                //sqlParam[2] = new SqlParameter(SPParameter.EmployeeID, DbType.Int32);
                //sqlParam[2].Value = Destination.EmployeeID;

                //update changes in the database.
                int shift = objDASeatAllocation.ExecuteNonQuerySP(SPNames.SeatAllocation_ShiftLocation, sqlParam);

                if (shift != 0)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }
                return(result);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, SHIFTLOCATION, EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER);
            }

            finally
            {
                objDASeatAllocation.CloseConncetion();
            }
        }
Ejemplo n.º 18
0
    /// <summary>
    /// Call to above method to shift the loaction.
    /// </summary>
    /// <param name="shiftFrom"></param>
    /// <param name="shiftTo"></param>
    public void callShiftLocationMethod(string shiftFrom, string shiftTo)
    {
        try
        {
            //Check the roles for shifting of loaction.(Only admin can shift the location.)
            if (Rave.HR.BusinessLayer.SeatAllocation.SeatAllocationRoles.CheckRolesSeatAllocation())
            {
                //Add the shift from location.
                BusinessEntities.SeatAllocation SeatInformationFrom = new BusinessEntities.SeatAllocation();
                SeatInformationFrom.SeatID = Convert.ToInt32(shiftFrom);

                //Add the shift To loaction.
                BusinessEntities.SeatAllocation SeatInformationTo = new BusinessEntities.SeatAllocation();
                SeatInformationTo.SeatID = Convert.ToInt32(shiftTo);

                //Display message if Seat is shifted successfully .
                if (ShiftLocation(SeatInformationFrom, SeatInformationTo))
                {
                    lblMessage.Text = "Location has been shifted successfully.";
                }
                else
                {
                    lblMessage.Text = "Location has not been shifted successfully.";
                    lblMessage.Text = "<font color=RED>" + lblMessage.Text + "</font>";
                }
            }
            else
            {
                lblMessage.Text = "You are not authorised to shift a employee's Location.";
                lblMessage.Text = "<font color=RED>" + lblMessage.Text + "</font>";
            }
            //Clear the hidden fields value.
            hdfDragFrom.Value  = string.Empty;
            hdfDragTo.Value    = string.Empty;
            hdfClickedTd.Value = string.Empty;
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "callShiftLocationMethod", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 19
0
 /// <summary>
 /// Get the employee details at a particular seat.
 /// </summary>
 /// <param name="Seat"></param>
 /// <returns></returns>
 public BusinessEntities.SeatAllocation EmployeeDetailsAtSeat(BusinessEntities.SeatAllocation Seat)
 {
     try
     {
         SeatDetails      = new BusinessEntities.SeatAllocation();
         BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();
         SeatDetails      = BLSeatAllocation.GetEmployeeDetailsForSeat(Seat);
     }
     catch (RaveHRException ex)
     {
         LogErrorMessage(ex);
     }
     catch (Exception ex)
     {
         RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, EMPLOYEESEATDETAILS, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
         LogErrorMessage(objEx);
     }
     return(SeatDetails);
 }
Ejemplo n.º 20
0
        /// <summary>
        ///  This method will fetch records of seats from  Data acess layer and return to UI layer.
        /// </summary>
        /// <returns>list</returns>
        public BusinessEntities.RaveHRCollection GetSeatDetails(BusinessEntities.SeatAllocation Section)
        {
            try
            {
                //instantiate SeatAllocation object of data layer
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();

                raveHRCollection = objSeatAllocation.GetSeatDetails(Section);

                return(raveHRCollection);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, GETSEATDETAILS, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        ///  This method will fetch records of seats from  Data acess layer and return to UI layer.
        /// </summary>
        /// <returns>list</returns>
        public BusinessEntities.SeatAllocation GetSeatDetailsByID(BusinessEntities.SeatAllocation Seat)
        {
            try
            {
                //instantiate SeatAllocation object of data layer
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();
                BusinessEntities.SeatAllocation SeatData = new BusinessEntities.SeatAllocation();

                SeatData = objSeatAllocation.GetSeatDeatilsByID(Seat);

                return(SeatData);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, GETEMPLOYEEDETAILSBYID, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// To check Employee Location.
        /// </summary>
        /// <param name="employeeId"></param>
        /// <returns></returns>
        public BusinessEntities.SeatAllocation CheckEmployeeLocation(int employeeId)
        {
            try
            {
                //instantiate SeatAllocation object of data layer
                objSeatAllocation = new Rave.HR.DataAccessLayer.SeatAllocation.SeatAllocation();
                BusinessEntities.SeatAllocation SeatData = new BusinessEntities.SeatAllocation();

                SeatData = objSeatAllocation.CheckEmployeeLocation(employeeId);

                return(SeatData);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.BusinessLayer, CLASSNAME, "CheckEmployeeLocation", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
            }
        }
Ejemplo n.º 23
0
    /// <summary>
    /// //Check whether seat is empty or occupied.
    /// </summary>
    /// <param name="seatId"></param>
    /// <returns></returns>
    public bool CheckEmployeeOnSeat(string seatId)
    {
        bool Flag = false;

        try
        {
            objBLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

            //Instantiate the object of BusinessEntities.SeatAllocation to get fetched data.
            BusinessEntities.SeatAllocation fetchedSeatDetails = new BusinessEntities.SeatAllocation();

            //Instantiate the object of BusinessEntities.SeatAllocation to pass seat id as a parameter.
            seatDetails = new BusinessEntities.SeatAllocation();

            //Add the seat id to SeatAllocation BusinessEntities.
            seatDetails.SeatID = Convert.ToInt32(seatId);

            //Call the Business layer method.
            fetchedSeatDetails = objBLSeatAllocation.GetSeatDetailsByID(seatDetails);

            if (fetchedSeatDetails != null)
            {
                //If seat is not vaccant then return true.
                if (fetchedSeatDetails.EmployeeID != 0)
                {
                    Flag = true;
                }
            }
        }

        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "CheckEmployeeOnSeat", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
        return(Flag);
    }
Ejemplo n.º 24
0
        public bool SaveEmpDetails(BusinessEntities.SeatAllocation seat)
        {
            DataAccessClass DADetails = new DataAccessClass();

            try
            {
                DADetails.OpenConnection(DBConstants.GetDBConnectionString());

                SqlParameter[] sqlParam = new SqlParameter[3];
                sqlParam[0]       = new SqlParameter(SPParameter.SeatID, DbType.Int32);
                sqlParam[0].Value = seat.SeatID;
                sqlParam[1]       = new SqlParameter(SPParameter.ExtNo, DbType.Int32);
                sqlParam[1].Value = seat.ExtensionNo;
                sqlParam[2]       = new SqlParameter(SPParameter.Landmark, DbType.String);
                sqlParam[2].Value = seat.SeatLandmark;

                //update changes in the database.
                int shift = DADetails.ExecuteNonQuerySP(SPNames.SeatAllocation_SaveEmployeeDetails, sqlParam);

                if (shift != 0)
                {
                    result = true;
                }

                return(result);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "SaveEmpDetails", EventIDConstants.RAVE_HR_CONTRACT_DATA_ACCESS_LAYER);
            }
            finally
            {
                DADetails.CloseConncetion();
            }
        }
Ejemplo n.º 25
0
 public BusinessEntities.SeatAllocation getControldata()
 {
     try
     {
         SeatDetails              = new BusinessEntities.SeatAllocation();
         SeatDetails.SeatID       = Convert.ToInt32(hfSeatID.Value);
         SeatDetails.EmployeeID   = Convert.ToInt32(hfEmpID.Value);
         SeatDetails.SeatLandmark = tbLandmark.Text;
         if (tbExtension.Text != "No Extension Provided")
         {
             SeatDetails.ExtensionNo = Convert.ToInt32(tbExtension.Text);
         }
         return(SeatDetails);
     }
     catch (RaveHRException ex)
     {
         throw ex;
     }
     catch (Exception ex)
     {
         throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "getControldata", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
     }
 }
Ejemplo n.º 26
0
    /// <summary>
    /// Get the employee name by employee code.
    /// </summary>
    public void GetEmployeeName()
    {
        try
        {
            SeatDetails = new BusinessEntities.SeatAllocation();
            BusinessEntities.SeatAllocation Seat = new BusinessEntities.SeatAllocation();

            BLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();
            // SeatDetails.EmployeeCode = tbEmpCode.Text.Trim();
            SeatDetails.EmployeeCode = ddlEmployeeCode.SelectedItem.Text;
            Seat = BLSeatAllocation.GetEmployeeName(SeatDetails);

            hfEmpID.Value  = Seat.EmployeeID.ToString();
            tbEmpName.Text = Seat.EmployeeName;
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetEmployeeName", EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }
Ejemplo n.º 27
0
    /// <summary>
    /// Get the details of a seat.
    /// </summary>
    /// <param name="SeatInformation"></param>
    /// <returns></returns>
    public List <BusinessEntities.SeatAllocation> getSeatDetails(BusinessEntities.SeatAllocation SeatInformation)
    {
        List <BusinessEntities.SeatAllocation> SeatInfo = new List <BusinessEntities.SeatAllocation>();

        try
        {
            //Invoke the object of business layer to call BusinessLayer method.
            objBLSeatAllocation = new Rave.HR.BusinessLayer.SeatAllocation.SeatAllocation();

            //Call the method of business layer to get seat details
            raveHRCollection = objBLSeatAllocation.GetSeatDetails(SeatInformation);

            //Convert raveHRCollection to List<BusinessEntities.SeatAllocation>.
            for (int i = 0; i < raveHRCollection.Count; i++)
            {
                foreach (List <BusinessEntities.SeatAllocation> SeatDescription in raveHRCollection)
                {
                    foreach (BusinessEntities.SeatAllocation Seat in SeatDescription)
                    {
                        seatDetails = new BusinessEntities.SeatAllocation();
                        seatDetails = (BusinessEntities.SeatAllocation)Seat;
                        SeatInfo.Add(seatDetails);
                    }
                }
            }
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, SEATDETAILS, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
        return(SeatInfo);
    }
Ejemplo n.º 28
0
        /// <summary>
        /// This method will fetch records of seats from data base and return to business layer
        /// </summary>
        /// <param name="criteria"></param>
        /// <returns></returns>

        public RaveHRCollection GetSeatDetails(BusinessEntities.SeatAllocation SeatSection)
        {
            DataAccessClass objDASeatAllocation = new DataAccessClass();
            List <BusinessEntities.SeatAllocation> objListSeatAlloctaion = null;

            // Initialise Collection class object
            raveHRCollection = new BusinessEntities.RaveHRCollection();
            try
            {
                objDASeatAllocation.OpenConnection(DBConstants.GetDBConnectionString());
                SqlParameter[] sqlParam = new SqlParameter[2];
                sqlParam[0]       = new SqlParameter(SPParameter.SectionID, DbType.Int32);
                sqlParam[0].Value = SeatSection.SectionID;

                sqlParam[1]       = new SqlParameter(SPParameter.BranchID, DbType.Int32);
                sqlParam[1].Value = SeatSection.RaveBranchID;

                //--get result
                DataSet dsSeatDescription = objDASeatAllocation.GetDataSet(SPNames.SeatAllocation_GetSeatDetailsForBay, sqlParam);

                //--Create entities and add to list
                BusinessEntities.SeatAllocation objBESeatDetail = null;
                objListSeatAlloctaion = new List <BusinessEntities.SeatAllocation>();

                foreach (DataRow dr in dsSeatDescription.Tables[0].Rows)
                {
                    objBESeatDetail = new BusinessEntities.SeatAllocation();
                    if (dr[DbTableColumn.Seat_SectionID].ToString() != null)
                    {
                        objBESeatDetail.SectionID = Convert.ToInt32(dr[DbTableColumn.Seat_SectionID]);
                    }
                    if (dr[DbTableColumn.Seat_BayID].ToString() != null)
                    {
                        objBESeatDetail.BayID = Convert.ToInt32(dr[DbTableColumn.Seat_BayID]);
                    }
                    if (dr[DbTableColumn.Seat_SeatID].ToString() != null)
                    {
                        objBESeatDetail.SeatID = Convert.ToInt32(dr[DbTableColumn.Seat_SeatID]);
                    }
                    if (dr[DbTableColumn.Seat_SeatName].ToString() != null)
                    {
                        objBESeatDetail.SeatName = dr[DbTableColumn.Seat_SeatName].ToString();
                    }
                    if (dr[DbTableColumn.Seat_EmployeeID].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeID = Convert.ToInt32(dr[DbTableColumn.Seat_EmployeeID]);
                    }
                    else
                    {
                        objBESeatDetail.EmployeeID = 0;
                    }
                    if (dr[DbTableColumn.Seat_EmployeeName].ToString() != string.Empty)
                    {
                        objBESeatDetail.EmployeeName = dr[DbTableColumn.Seat_EmployeeName].ToString();
                    }
                    //--add to list
                    objListSeatAlloctaion.Add(objBESeatDetail);
                }

                raveHRCollection.Add(objListSeatAlloctaion);
                return(raveHRCollection);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "GetSeatDetails", EventIDConstants.RAVE_HR_SEATALLOCATION_DATA_ACCESS_LAYER);
            }
            finally
            {
                objDASeatAllocation.CloseConncetion();
            }
        }
Ejemplo n.º 29
0
    /// <summary>
    /// View the Seat details of respective employee.
    /// </summary>
    /// <param name="ID"></param>
    public void ViewInformation(int ID)
    {
        try
        {
            BusinessEntities.SeatAllocation SeatID = new BusinessEntities.SeatAllocation();
            SeatID.SeatID = ID;
            int EmpID = 0;
            if (hfEmpID.Value != string.Empty)
            {
                EmpID = Convert.ToInt32(hfEmpID.Value);
            }
            SeatID.EmployeeID = EmpID;

            SeatDetails = new BusinessEntities.SeatAllocation();
            SeatDetails = EmployeeDetailsAtSeat(SeatID);

            //If user has clicked on green seat.means want to view a deatils.
            if (SeatDetails.EmployeeName != null)
            {
                makeViewControlsVisible();
                BindDataForView(SeatDetails);

                //If department is project then project textbox should be visible, else department should be display.
                if (SeatDetails.DepartmentName != "Projects")
                {
                    tbProjectName.Visible  = false;
                    lblprojectName.Visible = false;
                }
                //check the roles for self & admin. only this guys can change extension and landmark of seat.
                if (CheckSelfAllocation(SeatDetails) || Rave.HR.BusinessLayer.SeatAllocation.SeatAllocationRoles.CheckRolesSeatAllocation())
                {
                    tbExtension.ReadOnly = false;
                    tbLandmark.ReadOnly  = false;
                    btnSave.Visible      = true;
                }
                else
                {
                    tbExtension.ReadOnly = true;
                    tbLandmark.ReadOnly  = true;
                    btnSave.Visible      = false;
                }

                hfEmpID.Value = SeatDetails.EmployeeID.ToString();
            }
            //for allocate condition.
            else
            {
                //Check the roles.
                if (Rave.HR.BusinessLayer.SeatAllocation.SeatAllocationRoles.CheckRolesSeatAllocation())
                {
                    UnhideSelection();
                }
                else
                {
                    hideSelection();
                    lblConfirmMessage.Visible = true;
                    lblConfirmMessage.Text    = "You are not authorised to Allocate a Employee.";
                }
            }
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, VIEWINFORMATION, EventIDConstants.RAVE_HR_SEATALLOCATION_PRESENTATION_LAYER);
        }
    }