public JsonResult CheckExistingEmployeeId(EmpSignin check)
        {
            var res         = false;
            var messageType = "Succes";
            var message     = "EmployeeId Available.";

            try
            {
                if (ModelState.IsValid)
                {
                    EPBLL bll       = new EPBLL();
                    var   isSuccess = bll.CheckExistingEmployeeId(check);
                    if (isSuccess == true)
                    {
                        res         = isSuccess;
                        messageType = "failure";
                        message     = "EmployeeId Already Exist.";
                    }
                }
            }
            catch (Exception)
            {
                message = "EmployeeId Already Exist.";
            }
            return(Json(new { messageType = messageType, res = res, message = message }, JsonRequestBehavior.AllowGet));
        }
        //
        // GET: /ADO/


        /// <summary>
        /// Login Comtroller
        /// </summary>
        /// <param name="modal"></param>
        /// <returns></returns>
        public JsonResult SignIn(EmpSignin modal)
        {
            var res         = new LogId();
            var messageType = "error";
            var message     = "Error occured while signing in.";

            try
            {
                if (ModelState.IsValid)
                {
                    //ADOBLLWithQuery bll = new ADOBLLWithQuery();
                    EPBLL bll       = new EPBLL();
                    var   isSuccess = bll.SignIn(modal);
                    //if (isSuccess.LoginId==new LogId())
                    //{
                    res         = isSuccess;
                    messageType = "success";
                    message     = "Signed in Successfully.";
                    //}
                }
                else
                {
                    res = new LogId();
                }
            }
            catch (Exception)
            {
                //message = "Exception occurred while performing operation.";
            }

            return(Json(new { messageType = messageType, res = res, message = message }, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// graph to total points earned
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public JsonResult PointsGraph(EmpSignin Id)
        {
            var res         = new List <GraphPoints>();
            var messageType = "error";
            var message     = "Error occured while getting reward Points.";

            try
            {
                if (ModelState.IsValid)
                {
                    EPBLL bll       = new EPBLL();
                    var   isSuccess = bll.PointsGraph(Id);
                    if (isSuccess.Count != 0)
                    {
                        res         = isSuccess;
                        messageType = "success";
                        message     = "Reward Points.";
                    }
                }
            }
            catch (Exception)
            {
                message = "No Reward Points.";
            }
            return(Json(new { messageType = messageType, res = res, message = message }, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public LogId SignIn(EmpSignin SigninData)
        {
            //var employeesList = new List<EmployeeList>();
            try
            {
                InitializeConnection();
                using (SqlCommand cmd = new SqlCommand("spSignin", con))
                {
                    cmd.Parameters.AddWithValue("@EmployeeId", SigninData.EmployeeId);
                    cmd.Parameters.AddWithValue("@Password", SigninData.Password);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataSet        ds = new DataSet();
                    da.Fill(ds);

                    var dt = ds.Tables[0];

                    return(dt.AsEnumerable().Select(a => new LogId
                    {
                        LoginId = Convert.ToInt64(a["LoginId"])
                    }).FirstOrDefault());
                }
            }
            catch (Exception)
            {
                return(new LogId());
            }
        }
Beispiel #5
0
        public bool CheckExistingEmployeeId(EmpSignin check)
        {
            try
            {
                InitializeConnection();
                con.Open();
                using (SqlCommand cmd = new SqlCommand("spCheckByEmployeeId", con))
                {
                    cmd.CommandType = CommandType.StoredProcedure;

                    cmd.Parameters.AddWithValue("@EmployeeId", check.EmployeeId);

                    //Int32 count = Convert.ToInt32(cmd.ExecuteScalar());
                    object o = cmd.ExecuteScalar();
                    if (o != null)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }
            finally
            {
                con.Close();
            }
        }
Beispiel #6
0
        public List <GraphPoints> PointsGraph(EmpSignin Id)
        {
            try
            {
                InitializeConnection();
                using (SqlCommand cmd = new SqlCommand("spPointsGraph", con))
                {
                    cmd.Parameters.AddWithValue("@ToEmployeeId", Id.EmployeeId);
                    cmd.CommandType = CommandType.StoredProcedure;

                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    DataSet        ds = new DataSet();
                    da.Fill(ds);

                    var dt = ds.Tables[0];

                    return(dt.AsEnumerable().Select(a => new GraphPoints
                    {
                        DateGiven = Convert.ToDateTime(a["DateGiven"]),
                        Points = Convert.ToInt64(a["TotalPoints"])
                    }).ToList());
                }
            }
            catch (Exception)
            {
                return(new List <GraphPoints>());
            }
        }
Beispiel #7
0
 public bool CheckExistingEmployeeId(EmpSignin check)
 {
     return(epObj.CheckExistingEmployeeId(check));
 }
Beispiel #8
0
 public bool CheckExistingContact(EmpSignin check)
 {
     return(epObj.CheckExistingContact(check));
 }
Beispiel #9
0
 public bool CheckExistingEmail(EmpSignin check)
 {
     return(epObj.CheckExistingEmail(check));
 }
Beispiel #10
0
 public List <GraphPoints> PointsGraph(EmpSignin Id)
 {
     return(epObj.PointsGraph(Id));
 }
Beispiel #11
0
 public LogId SignIn(EmpSignin modal)
 {
     return(epObj.SignIn(modal));
 }