Пример #1
0
        public JsonResult MSIDfinder(string Prefix)
        {
            ApplyLeave app      = new ApplyLeave();
            var        MSIDList = app.SearchMSIDByName(Prefix);

            return(Json(MSIDList, JsonRequestBehavior.AllowGet));
        }
Пример #2
0
 private static void BuildPages()
 {
     ApplyLeave     = new ApplyLeave();
     C1MarginReport = new C1MarginReport();
     CustomerBalanceAgeingAnalysis = new CustomerBalanceAgeingAnalysis();
     ConvertPurchaseRequestToOrder = new ConvertPurchaseRequestToOrder();
     CreateExpenseInvoice          = new CreateExpenseInvoice();
     CreateVoucher         = new CreateVoucher();
     CreatePurchaseRequest = new CreatePurchaseRequest();
     EditExpenseInvoice    = new EditExpenseInvoice();
     EditPurchaseOrder     = new EditPurchaseOrder();
     EditPurchaseRequest   = new EditPurchaseRequest();
     EditVoucher           = new EditVoucher();
     ExpenseInvoiceTaxCalculationSummary = new ExpenseInvoiceTaxCalculationSummary();
     Login                          = new Login();
     ManageRequest                  = new ManageRequest();
     PRAdditionalDetails            = new PRAdditionalDetails();
     SelectPurchaseOrder            = new SelectPurchaseOrder();
     SelfServiceHome                = new SelfServiceHome();
     SpecifyPOPRCoverage            = new SpecifyPOPRCoverage();
     SpecifyTermsAndCondition       = new SpecifyTermsAndCondition();
     SpecifyScheduleAndDistribution = new SpecifyScheduleAndDistribution();
     TaxCalculationSummary          = new TaxCalculationSummary();
     ViewPurchaseOrder              = new ViewPurchaseOrder();
     ViewPurchaseRequest            = new ViewPurchaseRequest();
 }
        public async Task <IActionResult> Edit(int id, [Bind("Applyid,EmpId,LeaveType,LeavestartDate,LeaveEndDate,LeaveReason,LeaveId,StatusId,Status")] ApplyLeave applyLeave)
        {
            if (id != applyLeave.Applyid)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(applyLeave);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ApplyLeaveExists(applyLeave.Applyid))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["EmpId"]   = new SelectList(_context.EmployeeDetails, "EmpId", "EmpEmail", applyLeave.EmpId);
            ViewData["LeaveId"] = new SelectList(_context.BalanceAvailables, "LeaveId", "LeaveId", applyLeave.LeaveId);
            return(View(applyLeave));
        }
        public async Task <IActionResult> Create([Bind("Applyid,EmpId,LeaveType,LeavestartDate,LeaveEndDate,LeaveReason,LeaveId,StatusId,Status")] ApplyLeave applyLeave)
        {
            //Not Working as some SSL SOcket Connection Problem
            //using (var httpClient = new HttpClient())
            //{
            //    StringContent content = new StringContent(JsonConvert.SerializeObject(employeeDetail), Encoding.UTF8, "application/json");
            //    using (var response = await httpClient.PostAsync("http://localhost:44349/api/EmployeeDetailsAdd/EmpAdd", content))
            //    {
            //        string apiResponse = await response.Content.ReadAsStringAsync();
            //        EmployeeDetail Emplo = JsonConvert.DeserializeObject<EmployeeDetail>(apiResponse);
            //    }
            //}



            applyLeave.LeaveId = applyLeave.EmpId;
            if (ModelState.IsValid)
            {
                _context.Add(applyLeave);
                await _context.SaveChangesAsync();

                // return RedirectToAction(nameof(Index));
                return(RedirectToAction("EmployeePortal", "EmployeeManagement"));
            }
            ViewData["EmpId"]   = new SelectList(_context.EmployeeDetails, "EmpId", "EmpEmail", applyLeave.EmpId);
            ViewData["LeaveId"] = new SelectList(_context.BalanceAvailables, "LeaveId", "LeaveId", applyLeave.LeaveId);
            return(View(applyLeave));
        }
Пример #5
0
        public ActionResult applyOOOForOthersUser(string msad)
        {
            string msidOwn = Session["MSID"].ToString();
            bool   flag    = false;
            bool   result  = false;

            byte[]     dummy         = new byte[0];
            DateTime   todayData     = DateTime.Now;
            ApplyLeave applyLeaveObj = new ApplyLeave();

            flag = applyLeaveObj.ApplyLeaves(msad, todayData, todayData, "Sick/UnPlanned", 1, "", "Approval Pending", dummy);
            Dictionary <string, string> toGetEmailandNameDetails          = applyLeaveObj.toGetEmailandNameDetailsFromDB(msad);
            Dictionary <string, string> toGetSupervisorEmailandNameDetail = applyLeaveObj.toGetNameEmailSupDetails(msad);
            Dictionary <string, string> msidOwnEmail = applyLeaveObj.toGetSelfEmailIDOOO(msidOwn);

            result = emailForOOO(toGetEmailandNameDetails, toGetSupervisorEmailandNameDetail, msidOwnEmail, applyLeaveObj);
            if (flag == true && result == true)
            {
                return(Content("Leave Applied Succesfully"));
            }
            else
            {
                return(Content("Something went Wrong"));
            }
        }
Пример #6
0
        public ActionResult ScreenShot(int Id)
        {
            ApplyLeave obj = new ApplyLeave();

            obj = ApplyLeave.getLeaveInfo(Id);
            return(View("ScreenShot", obj));
        }
        public IActionResult PutApplyLeave(int id, ApplyLeave applyLeave)
        {
            if (id != applyLeave.Applyid)
            {
                return(BadRequest());
            }



            try
            {
                _log4net.Info("Leave Update Details Getting Added");
                if (ModelState.IsValid)
                {
                    var res = _LeaveRepository.PutApplyLeave(id, applyLeave);


                    return(Ok());
                }
                return(BadRequest());
            }
            catch
            {
                _log4net.Error("Error in Updating Leaves Details");
                return(new NoContentResult());
            }
        }
Пример #8
0
        public ApplyLeave PostLeavesAdd(ApplyLeave applyLeave)
        {
            var result = _context.ApplyLeave.Add(applyLeave);

            var a = _context.SaveChanges();

            return(applyLeave);
        }
Пример #9
0
        public ApplyLeave PutApplyLeave(int id, ApplyLeave applyLeave)
        {
            var res = _context.Entry(applyLeave).State = EntityState.Modified;


            _context.SaveChangesAsync();
            return(applyLeave);
        }
Пример #10
0
        public ActionResult viewInfo()
        {
            string     MSID        = Session["MSID"].ToString();
            ApplyLeave viewInfoObj = new ApplyLeave();

            viewInfoObj.userInfoDetails = viewInfoObj.viewUserInfo(MSID);
            return(View(viewInfoObj));
        }
Пример #11
0
        public ActionResult ViewLeaves1()
        {
            ApplyLeave obj = new ApplyLeave();

            obj.LeaveList       = obj.getLeaveList(Session["MSID"].ToString());
            TempData["Success"] = "Leave Updated Successfully";
            return(View(obj));
        }
Пример #12
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));
        }
Пример #13
0
        public ApplyLeave DeleteApplyLeave(int id)
        {
            ApplyLeave applyLeave = _context.ApplyLeave.Find(id);


            _context.ApplyLeave.Remove(applyLeave);
            _context.SaveChanges();

            return(applyLeave);
        }
Пример #14
0
        public ActionResult ViewLeaves()
        {
            int        i   = 0;
            ApplyLeave obj = new ApplyLeave();
            //ViewData["MSID"] = Session["MSID"];
            string MSID = Session["MSID"].ToString();

            obj.LeaveList = obj.getLeaveList(Session["MSID"].ToString());
            //obj.LeaveList = obj.getLeaveList(MSID);
            return(View(obj));
        }
        public IActionResult Post([FromBody] ApplyLeave applyLeave)
        {
            _log4net.Info("Employee Details Getting Added");
            if (ModelState.IsValid)
            {
                var res = _LeaveRepository.PostLeavesAdd(applyLeave);


                return(Ok());
            }
            return(BadRequest());
        }
Пример #16
0
        public ActionResult checkLeave(string SD)
        {
            string MSID = Session["MSID"].ToString();

            if (ApplyLeave.toCheckLeave_OOO(MSID, SD) == true)
            {
                return(Content("Your Leave is already applied. Go to view leave and update the screenshot"));
            }
            else
            {
                return(Content(""));
            }
        }
Пример #17
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);
        }
Пример #18
0
        public ActionResult ViewLeavesByAdmin()
        {
            ApplyLeave obj    = new ApplyLeave();
            string     Branch = Session["Branch"].ToString();
            // added by me for testing
            string Project = Session["Project"].ToString();
            string SubArea = Session["SubArea"].ToString();
            string MSID    = Session["MSID"].ToString();

            //  string MSIDsupervisor = obj.findSupervisorByMSID(MSID);
            obj.LeaveList = obj.getLeave(SubArea);
            //ApproveLeavesByAdmin(obj);
            return(View(obj));
        }
Пример #19
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));
        }
Пример #20
0
        public ActionResult ExportToExcelForUser()
        {
            // string ProjName = Session["ProjName"].ToString();
            ApplyLeave applyLeaveObj = new ApplyLeave();

            applyLeaveObj.ExportToExcelForUserList = applyLeaveObj.ExportToExcelForUser();

            //Response.AddHeader("Content-Type", "application/vnd.ms-excel");
            //string filename = string.Empty;
            //string PresentFilename = string.Empty;
            //filename = DateTime.Today.ToString();
            //PresentFilename = filename.Substring(0,5) + " Leave Tracker Report";
            //Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
            Response.AddHeader("content-disposition", "attachment; filename=" + DateTime.Today.ToString().Substring(0, 5) + " MSID FirstName and LastName list" + "");
            Response.ContentType = "application/excel";

            return(View(applyLeaveObj));
        }
Пример #21
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));
        }
Пример #22
0
        public ActionResult addScreenShot(ApplyLeave applyLeave, HttpPostedFileBase file)
        {
            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();
            }
            return(View());
        }
Пример #23
0
        public ActionResult deleteLeaves(int id)
        {
            ApplyLeave obj = new ApplyLeave();

            obj = ApplyLeave.getLeaveInfo(id);
            if (obj.StartDate.Date > DateTime.Now.Date || obj.Status == "Approval Pending")
            {
                if (ApplyLeave.deleteLeave(id))
                {
                    return(RedirectToAction("ViewLeaves", "ApplyLeave"));
                }
                else
                {
                    return(RedirectToAction("Index", "LTLogin"));
                }
            }
            else
            {
                return(RedirectToAction("ViewLeaves", "ApplyLeave"));
            }
        }
Пример #24
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"));
            }
        }
        public ActionResult DeleteApplyLeavee(int id)
        {
            ApplyLeave applyLeave = _LeaveRepository.DeleteApplyLeave(id);

            return(Ok());
        }
Пример #26
0
        public static bool emailToSupervisor(Dictionary <string, string> toGetEmailDetails, Dictionary <string, string> toGetNameDetails, ApplyLeave applyLeave)
        {
            string      fullName       = string.Empty;
            string      supervisorName = string.Empty;
            MailMessage mail           = new MailMessage();
            SmtpClient  SmtpServer     = new SmtpClient("mta-hub.ms.com");


            foreach (KeyValuePair <string, string> emailDetails in toGetEmailDetails)
            {
                mail.From = new MailAddress(emailDetails.Key);
                mail.To.Add(emailDetails.Value);
                mail.CC.Add("*****@*****.**");
            }

            foreach (KeyValuePair <string, string> nameDetails in toGetNameDetails)
            {
                fullName       = nameDetails.Key.ToString();
                supervisorName = nameDetails.Value.ToString();
            }
            mail.CC.Add("*****@*****.**");

            mail.Subject    = "Request to Approve my Leaves";
            mail.IsBodyHtml = true;

            string emailBody = @"<table> <tr> Hi " + supervisorName + ",</tr>" +
                               "<tr>  " +
                               "<tr> Could you please approve my leaves? </tr>" +
                               " <tr> MSID : " + applyLeave.MSID + "</tr> " +
                               "<tr> Start Date : " + applyLeave.StartDate.ToShortDateString() + "  </tr> " +
                               "<tr> End Date : " + applyLeave.EndDate.ToShortDateString() + "  </tr> " +
                               "<tr> Total Days : " + applyLeave.TotalLeaves + "  </tr> " +
                               "<tr> Reason : " + applyLeave.Reason + "  </tr>" +
                               "</ tr > " +
                               "<tr> Leave Tracker link :  http://vmvpc091397.msad.ms.com:8080/sampleMVC/ </tr>" +
                               "<tr>  " +
                               "<tr> Key points to note before you start using this ‘Leave Tracker Application’: </tr>" +
                               "<tr>  " +
                               "<tr> •	Please read the user guide attached before applying leave sent before. </tr>"+
                               "<tr> •	This application works best in Google Chrome. </tr>"+
                               "<tr> •	Please attach Ultimatix leave snapshot while attaching the file which is mandatory i.e.apply leaves in Ultimatix first </tr>"+
                               "<tr>•	You can reach out to Sanchit Nakra(sanchn) for any app related issues. </tr>"+
                               "<tr>  " +
                               "<tr> This is automated generated email, Please don't reply to this !! </tr>" +
                               "<tr>" +
                               "<tr>" +
                               "<tr>" + fullName + "</tr>" +

                               "<tr>" + "Thanks and Regards</tr>" +
                               "</tr>" +
                               "</tr> " +
                               "</table>";

            mail.Body              = emailBody;
            SmtpServer.Port        = 25;
            SmtpServer.Credentials = new System.Net.NetworkCredential();
            SmtpServer.Send(mail);
            return(true);
        }
Пример #27
0
        public static bool emailForPlannedLeave(Dictionary <string, string> toGetEmailandNameDetails, Dictionary <string, string> toGetSupervisorEmailandNameDetails, Dictionary <string, string> toGetMSIDOwn, ApplyLeave applyLeave)
        {
            string      fullName = string.Empty, supervisorName = string.Empty;
            string      todayDate  = DateTime.Now.ToShortDateString();
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient("mta-hub.ms.com");


            foreach (KeyValuePair <string, string> emailDetails in toGetEmailandNameDetails)
            {
                fullName  = emailDetails.Key;
                mail.From = new MailAddress("Sanchit.Nakra@morganstanley");
                mail.To.Add(emailDetails.Value);
            }
            foreach (KeyValuePair <string, string> emailSupervisorDetails in toGetSupervisorEmailandNameDetails)
            {
                supervisorName = emailSupervisorDetails.Key;
                mail.CC.Add(emailSupervisorDetails.Value);
                mail.CC.Add("*****@*****.**");
            }

            foreach (KeyValuePair <string, string> MSIDOwn in toGetMSIDOwn)
            {
                mail.CC.Add(MSIDOwn.Value);
            }


            //  mail.CC.Add(emailTO);
            //mail.CC.Add("*****@*****.**");
            //mail.CC.Add("*****@*****.**");
            //mail.CC.Add("*****@*****.**");

            mail.Subject    = fullName + " <Planned Leave>";
            mail.IsBodyHtml = true;

            string emailBody = @"<table> <tr> Hi " + fullName + ",</tr>" +
                               "<tr>  " +
                               "<tr>  " +
                               "<tr> Your Planned leave has been applied from " + applyLeave.StartDate.ToShortDateString() + " to " + applyLeave.EndDate.ToShortDateString() + " in Leave Tracker application. </tr>" +
                               "<tr> Please update the Planned leave with Screenshot. </tr>" +
                               "<tr>  " +
                               "<tr> Leave Tracker link :  http://vmvpc091397.msad.ms.com:8080/sampleMVC/ </tr>" +
                               "<tr>  " +
                               "<tr> Key points to note before you start using this ‘Leave Tracker Application’: </tr>" +
                               "<tr>  " +
                               "<tr> •	Please read the user guide attached before applying leave sent before. </tr>"+
                               "<tr> •	This application works best in Google Chrome. </tr>"+
                               "<tr> •	Please attach Ultimatix leave snapshot while attaching the file which is mandatory i.e.apply leaves in Ultimatix first </tr>"+
                               "<tr>•	You can reach out to Sanchit Nakra(sanchn) for any app related issues. </tr>"+
                               "<tr>  " +
                               "<tr> This is automated generated email, Please don't reply to this !! </tr>" +
                               "<tr>  " +
                               "<tr>  " +
                               "<tr>" + "Thanks and Regards</tr>" +
                               "</tr>" +
                               "<tr>" + "Sanchit Nakra</tr>" +
                               "</tr>" +
                               "<tr>" + "Leave Tracker Team</tr>" +
                               "</tr> " +
                               "</table>";

            mail.Body              = emailBody;
            SmtpServer.Port        = 25;
            SmtpServer.Credentials = new System.Net.NetworkCredential();
            SmtpServer.Send(mail);
            return(true);
        }
Пример #28
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));
                }
            }
        }