Esempio n. 1
0
        public ActionResult applyOtherPlannedLeave()
        {
            ApplyLeave obj = new ApplyLeave();

            obj.MSID = Session["MSID"].ToString();
            var list = obj.getTypeOfLeave();

            obj.TOL = obj.GetSelectListItem(list);
            return(View(obj));
        }
Esempio n. 2
0
        public ActionResult ApplyLeavesForSS(HttpPostedFileBase file)
        {
            byte[]     imageData = null;
            int        id        = Convert.ToInt32(Session["ID"]);
            ApplyLeave obj       = new ApplyLeave();
            var        list      = obj.getTypeOfLeave();

            obj.TOL = obj.GetSelectListItem(list);
            string name = Path.GetExtension(file.FileName).ToLower();

            obj             = obj.UpdateeditScreenShot(id);
            Session["MSID"] = obj.MSID;
            if (file.ContentLength > 0 && (name.Equals(".jpg") || name.Equals(".jpeg") || name.Equals(".png")))
            {
                using (var binaryReader = new BinaryReader(file.InputStream))
                {
                    imageData = binaryReader.ReadBytes(file.ContentLength);
                }
                //applyLeave.MSID = Session["MSID"].ToString();
                //applyLeave.StartDate = Convert.ToDateTime(Session["StartDate"]);
                //applyLeave.EndDate = Convert.ToDateTime(Session["EndDate"]);
                //applyLeave.TypeOfLeaves = Session["TypeOfLeaves"].ToString();
                //applyLeave.TotalLeaves = Convert.ToInt32(Session["TotalLeaves"]);
                //if (ModelState.IsValid)
                //{
                if (obj.ApplyLeavesSS(id, obj.Reason, imageData))
                //if (obj.ApplyLeavesSS(ob imageData))
                {
                    ViewBag.Message = "Success";
                    ApplyLeave applyLeaves = new ApplyLeave();
                    Dictionary <string, string> toGetEmailDetails = applyLeaves.toGetEmailDetails(obj.MSID);
                    Dictionary <string, string> toGetNameDetails  = applyLeaves.toGetNameDetails(obj.MSID);
                    mailSent = emailToSupervisor(toGetEmailDetails, toGetNameDetails, obj);
                    return(RedirectToAction("ViewLeaves", "ApplyLeave"));
                }
                else
                {
                    ViewBag.Message = "Invalid input";
                    return(View(obj));
                }
            }
            else
            {
                return(View(obj));
            }
            //}

            //else
            //    return View(obj);
        }
Esempio n. 3
0
        public ActionResult editLeaves(int id)
        {
            Session["id"] = id;
            ApplyLeave obj = new ApplyLeave();

            obj = ApplyLeave.getLeaveInfoForEditing(id);
            var list = obj.getTypeOfLeave();

            obj.TOL              = obj.GetSelectListItem(list);
            Session["MSID"]      = obj.MSID;
            Session["FirstName"] = obj.FirstName;
            Session["LastName"]  = obj.LastName;

            return(View(obj));
        }
Esempio n. 4
0
        public ActionResult editLeavesScreenShot(int id)
        {
            ApplyLeave obj = new ApplyLeave();

            obj.editScreenShotTLList = ApplyLeave.editScreenSHotForEditing(id);
            var list = obj.getTypeOfLeave();

            obj.TOL         = obj.GetSelectListItem(list);
            Session["MSID"] = obj.MSID;
            //Session["FirstName"] = obj.FirstName;
            //Session["LastName"] = obj.LastName;
            Session["StartDate"]    = obj.StartDate;
            Session["EndDate"]      = obj.EndDate;
            Session["TypeOfLeaves"] = obj.TypeOfLeaves;
            Session["TotalLeaves"]  = obj.TotalLeaves;
            Session["ID"]           = id;
            return(View(obj));
        }
Esempio n. 5
0
        public ActionResult updateLeaves(ApplyLeave applyLeave, HttpPostedFileBase file)
        {
            int id = 0;

            id = Convert.ToInt32(Session["id"]);
            int rowAffected = 0;

            byte[]     imageData = null;
            ApplyLeave obj       = new ApplyLeave();
            var        list      = obj.getTypeOfLeave();

            obj.TOL = obj.GetSelectListItem(list);
            string name = Path.GetExtension(file.FileName).ToLower();

            if (file.ContentLength > 0 && (name.Equals(".jpg") || name.Equals(".jpeg") || name.Equals(".png")))
            {
                using (var binaryReader = new BinaryReader(file.InputStream))
                {
                    imageData = binaryReader.ReadBytes(file.ContentLength);
                }
                applyLeave.MSID = Session["MSID"].ToString();
                rowAffected     = ApplyLeave.updateLeavesToDB(applyLeave.MSID, applyLeave.StartDate, applyLeave.EndDate, applyLeave.TypeOfLeaves, applyLeave.TotalLeaves, applyLeave.Reason, applyLeave.Status, imageData, id);
            }
            if (rowAffected == 1)
            {
                ViewBag.Message = "Success";
                ApplyLeave applyLeaves = new ApplyLeave();
                Dictionary <string, string> toGetEmailDetails = applyLeaves.toGetEmailDetails(applyLeave.MSID);
                Dictionary <string, string> toGetNameDetails  = applyLeaves.toGetNameDetails(applyLeave.MSID);
                mailSent = emailToSupervisor(toGetEmailDetails, toGetNameDetails, applyLeave);
                var message = " Leave Updated Successfully ";

                return(RedirectToAction("ViewLeaves1", "ApplyLeave", new { whatever = message }));
            }
            else
            {
                return(RedirectToAction("ViewLeaves", "ApplyLeave"));
            }
        }
Esempio n. 6
0
        public ActionResult ApplyLeaves(ApplyLeave applyLeave, HttpPostedFileBase file)
        {
            byte[]     imageData = null;
            ApplyLeave obj       = new ApplyLeave();
            var        list      = obj.getTypeOfLeave();

            obj.TOL = obj.GetSelectListItem(list);
            if (file != null)
            {
                string name = Path.GetExtension(file.FileName).ToLower();
                applyLeave.MSID = Session["MSID"].ToString();
                if (file.ContentLength > 0 && (name.Equals(".jpg") || name.Equals(".jpeg") || name.Equals(".png")))
                {
                    using (var binaryReader = new BinaryReader(file.InputStream))
                    {
                        imageData = binaryReader.ReadBytes(file.ContentLength);
                    }

                    if (applyLeave.ApplyLeaves(applyLeave.MSID, applyLeave.StartDate, applyLeave.EndDate, applyLeave.TypeOfLeaves, applyLeave.TotalLeaves, applyLeave.Reason, applyLeave.Status, imageData))
                    {
                        ViewBag.Message = "Success";
                        ApplyLeave applyLeaves = new ApplyLeave();
                        Dictionary <string, string> toGetEmailDetails = applyLeaves.toGetEmailDetails(applyLeave.MSID);
                        Dictionary <string, string> toGetNameDetails  = applyLeaves.toGetNameDetails(applyLeave.MSID);
                        mailSent = emailToSupervisor(toGetEmailDetails, toGetNameDetails, applyLeave);
                        return(RedirectToAction("ViewLeaves", "ApplyLeave"));
                    }
                    else
                    {
                        ViewBag.Message = "Invalid input";
                        return(View(obj));
                    }
                }

                else
                {
                    return(View(obj));
                }
            }
            else
            {
                byte[] dummy = new byte[0];
                applyLeave.TotalLeaves = SampleOther(applyLeave.StartDate, applyLeave.EndDate);
                if (applyLeave.ApplyLeaves(applyLeave.MSID, applyLeave.StartDate, applyLeave.EndDate, "Planned", applyLeave.TotalLeaves, applyLeave.Reason, applyLeave.Status, dummy))
                {
                    bool   result  = false;
                    string msidOwn = Session["MSID"].ToString();
                    Dictionary <string, string> toGetEmailandNameDetails          = applyLeave.toGetEmailandNameDetailsFromDB(applyLeave.MSID);
                    Dictionary <string, string> toGetSupervisorEmailandNameDetail = applyLeave.toGetNameEmailSupDetails(applyLeave.MSID);
                    Dictionary <string, string> msidOwnEmail = applyLeave.toGetSelfEmailIDOOO(msidOwn);
                    result = emailForPlannedLeave(toGetEmailandNameDetails, toGetSupervisorEmailandNameDetail, msidOwnEmail, applyLeave);
                    if (result == true)
                    {
                        return(RedirectToAction("ViewLeaves"));
                    }
                    else
                    {
                        return(Content("Something went Wrong"));
                    }
                }
                else
                {
                    ViewBag.Message = "Invalid input";
                    return(View(obj));
                }
            }
        }