Beispiel #1
0
        public IActionResult DepartmentLeaveRequest(DeptLeaveRequestViewModel objModel, string EmployeeName1, string Shift, string empphoneNo1)
        {
            string msg = "";

            try
            {
                if (Shift == null)
                {
                    Shift = "";
                }
                objModel.EmployeeName = EmployeeName1;
                objModel.empphoneNo   = empphoneNo1;
                objModel.PA           = HttpContext.Session.GetString(Constant.PersonalArea);
                objModel.PSA          = HttpContext.Session.GetString(Constant.PersonalSubArea);
                if (objModel.EmployeeID.Length != 8)
                {
                    objModel.EmployeeID = objModel.EmployeeID.ToString().PadLeft(8, '0');
                }
                if (ModelState.IsValid)
                {
                    if (objModel.FileToUpload == null || objModel.FileToUpload.Length == 0)
                    {
                        objModel.UploadFileName = null;
                    }
                    else
                    {
                        string dateformate = DateTime.Now.ToString("ddMMyyyyhhmmss");
                        string FilePath    = objModel.FileToUpload.FileName;
                        string FileName    = Path.GetFileNameWithoutExtension(FilePath);//Without Extension
                        var    objFile     = HttpContext.Session.GetString(Constant.EmployeeID) + '_' + FileName + '_' + dateformate + ".pdf";
                        var    path        = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/FileUpload", objFile);
                        HttpContext.Session.SetString(Constant.FileName, FilePath);
                        using (var stream = new FileStream(path, FileMode.Create))
                        {
                            objModel.FileToUpload.CopyToAsync(stream);

                            objModel.UploadFileName = objFile;
                        }
                    }
                    if (objModel.ApproverName != null || objModel.ApproverName != string.Empty || objModel.ApproverName != "")
                    {
                        string[] arrApproverName = objModel.ApproverName.Split('_');
                        int      objArrCount     = arrApproverName.Length;
                        if (objArrCount > 1)
                        {
                            var objApproverId   = arrApproverName[0].ToString();
                            var objApproverName = arrApproverName[1].ToString();
                            objModel.ApproverId   = objApproverId;
                            objModel.ApproverName = objApproverName;
                        }
                    }
                    string startDateInText = objModel.FromDate;
                    string endDateInText   = objModel.ToDate;
                    if (objModel.Remarks == null)
                    {
                        objModel.Remarks = "";
                    }
                    System.DateTime startDate    = DateTime.ParseExact(startDateInText, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture);
                    System.DateTime endDate      = DateTime.ParseExact(endDateInText, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture);
                    var             diffdate     = (endDate - startDate).TotalDays;
                    var             totalleave   = diffdate + 1;
                    double          objToalLeave = Convert.ToDouble(totalleave);
                    if (objModel.LeaveShift == "F" || objModel.LeaveShift == "S")
                    {
                        objToalLeave = (totalleave) - 0.5;
                    }
                    objModel.TotalAppliedLeave = Convert.ToDouble(objToalLeave);

                    objModel.BalanceLeave = 0;
                    objModel.CreatedBy    = HttpContext.Session.GetString(Constant.AdminID);
                    objModel.AdminID      = HttpContext.Session.GetString(Constant.AdminID);
                    objModel.LeaveShift   = Shift;
                    Tuple <string, int> Result = _IDeptLeaveRequestViewService.SaveLeaveRequest(Mapper.Map <DeptLeaveRequestViewtServiceModel>(objModel));
                    if (Result.Item2 == 1)
                    {
                        #region Message fro Employee
                        string strmobileNo = objModel.empphoneNo;
                        var    msgText     =
                            "You submitted below leaves" + Environment.NewLine +
                            "Employee No:-" + objModel.EmployeeID + Environment.NewLine +
                            "Request:-" + objModel.LeaveCategory + Environment.NewLine +
                            "From Date:-" + objModel.FromDate + Environment.NewLine +
                            "To Date:-" + objModel.ToDate + Environment.NewLine +
                            "Days:-" + objModel.TotalAppliedLeave + " days";
                        try
                        {
                            _SMSUtility.SendSMS(strmobileNo, msgText);
                        }
                        catch (Exception)
                        {
                        }
                        #endregion

                        #region for APprovermessage
                        //For Approver
                        ////string strapprovermobileNo = HttpContext.Session.GetString(Constant.ApproverMobileNo);
                        ////var msgTextapprover =
                        ////     "Below leaves / attendance requests have been submitted for your action. Please review and approve, reject accordingly." + Environment.NewLine +
                        ////     "Employee No:-" + HttpContext.Session.GetString(Constant.EmployeeID) + Environment.NewLine +
                        ////     "Request:-" + objModel.LeaveCategory + Environment.NewLine +
                        ////     "From Date:-" + objModel.FromDate + Environment.NewLine +
                        ////     "To Date:-" + objModel.ToDate + Environment.NewLine +
                        ////     "Days:-" + objModel.TotalAppliedLeave + "days";
                        ////var sms1 = _SMSUtility.SendSMS(strapprovermobileNo, msgTextapprover);
                        ////if (sms1 == true)
                        ////{
                        ////    strapprovermobileNo = Convert.ToString(1);
                        ////}
                        ////else
                        ////{
                        ////    strapprovermobileNo = Convert.ToString(0);
                        ////}
                        #endregion
                        if (Result.Item2 == 1)
                        {
                            msg = "success" + "~" + Result.Item1;
                        }
                        else
                        {
                            msg = "danger" + "~" + Result.Item1;
                        }
                    }
                    else
                    {
                        _logger.LogError("Error", Result.Item1);
                        msg = "danger" + "~" + "Error occured while processing leave request..";
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                msg = "danger" + "~" + "Error occured while processing leave request...............";
            }
            TempData["Messages"] = msg;

            return(RedirectToAction("DepartmentLeaveRequest"));
        }
Beispiel #2
0
        public string SaveDataToSAP(LeaveApprovalModelViewModel modellist, string status)
        {
            bool   valid = false;
            string msg   = "";

            try
            {
                string  Mobileno   = "";
                string  MobilenoR  = "";
                string  Approverid = (HttpContext.Session.GetString(Constant.ApproverID));
                dynamic indicator  = "";
                dynamic errormsg   = "";
                if (status == "Approved")
                {
                    try
                    {
                        foreach (var model in modellist.leaveApprovals)
                        {
                            bool   error    = false;
                            string deletion = "";
                            if (model.OldStatus == "Pending Withdrawal")
                            {
                                status   = "Withdrawal";
                                deletion = "X";
                            }
                            else
                            {
                                deletion = "";
                            }
                            model.FromDateString = model.FromDateString.Replace('-', '/');
                            model.ToDateString   = model.ToDateString.Replace('-', '/');
                            string esbfromdate = model.FromDateString.Split("/")[1] + "/" + model.FromDateString.Split("/")[0] + "/" + model.FromDateString.Split("/")[2];
                            string esbtodate   = model.ToDateString.Split("/")[1] + "/" + model.ToDateString.Split("/")[0] + "/" + model.ToDateString.Split("/")[2];

                            string param = "leaves?pernr_001=" + model.EmployeeID + "&subty_006="
                                           + model.LeaveCode + "&begda_007=" + esbfromdate + "&endda_008=" + esbtodate + "&full_first_sec=" + model.LeaveShift + "&simulation=" + "" + "&Deletion=" + deletion;
                            using (HttpClient client = new HttpClient())
                            {
                                string apiUrl = _rfcconfig.GetSection("MySettings").GetSection("WebApiBaseUrl").Value + param;
                                client.BaseAddress = new Uri(apiUrl);
                                client.Timeout     = TimeSpan.FromMinutes(5);
                                client.DefaultRequestHeaders.Accept.Clear();
                                client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
                                var responsecli = client.GetAsync(apiUrl);
                                var data        = responsecli.Result;
                                if (data.IsSuccessStatusCode)
                                {
                                    var readTask = data.Content.ReadAsStringAsync();
                                    LEAVEREQUESTDETAILS leaveRequestDetails = JsonConvert.DeserializeObject <LEAVEREQUESTDETAILS>(readTask.Result);
                                    if (leaveRequestDetails != null && leaveRequestDetails.IT_ERROR_TEXT != null)
                                    {
                                        foreach (var detail in leaveRequestDetails.IT_ERROR_TEXT)
                                        {
                                            if (detail.IND == "E")
                                            {
                                                error     = true;
                                                errormsg  = detail.TEXT;
                                                indicator = detail.IND;
                                            }
                                        }
                                        if (error == false)
                                        {
                                            errormsg  = "Successfully updated in SAP";
                                            indicator = "S";
                                        }
                                    }
                                }
                                else
                                {
                                    _logger.LogError("Gateway Timeout Error" + model.EmployeeID);
                                }
                            }
                            model.ErrorMsg   = errormsg;
                            model.Indicator  = indicator;
                            model.ApproverId = Approverid;
                            model.Status     = error == true ? "Error" : status;
                        }
                        Tuple <string, int> result     = _iLeaveapprovalService.SaveLeaveApproval(Mapper.Map <LeaveApprovalServiceViewModel>(modellist));
                        LeaveApprovalModel  leavemodel = new LeaveApprovalModel();
                        if (result.Item2 != -99)
                        {
                            if (status == "Approved" || status == "Withdrawal")
                            {
                                foreach (var model in modellist.leaveApprovals)
                                {
                                    // Mobileno = model.empmobileno;//mobileno add
                                    #region Message for Approved record to Employee
                                    if (result.Item2 != -99)
                                    {
                                        var msgTextapprover = "";
                                        if (model.OldStatus == "Pending Withdrawal")
                                        {
                                            msgTextapprover = "Your Subordinate wants to cancel/ withdraw below leave/attendance requests which were approved in the system." + Environment.NewLine +
                                                              "Please approve / reject the request accordingly" + Environment.NewLine;
                                            Mobileno = model.ApproverMobNo;// "8149102368";
                                        }
                                        else
                                        {
                                            msgTextapprover = "Your below mentioned leaves/attendance requests submitted have been approved." + Environment.NewLine;
                                            Mobileno        = model.empmobileno;//mobileno add "8149102368";//
                                        }
                                        var mesg = msgTextapprover + Environment.NewLine +

                                                   "Employee No:-" + model.EmployeeID + Environment.NewLine +
                                                   "Request:-" + model.LeaveCategory + Environment.NewLine +
                                                   "From Date:-" + model.FromDateString + Environment.NewLine +
                                                   "To Date:-" + model.ToDateString + Environment.NewLine +
                                                   "Days:-" + model.TotalLeaves + " days";
                                        try
                                        {
                                            _SMSUtility.SendSMS(Mobileno, mesg);
                                        }
                                        catch (Exception)
                                        {
                                        }
                                    }
                                }
                            }
                            #endregion
                        }
                        if (result.Item2 != -99)
                        {
                            if (status == "Approved" || status == "Withdrawal")
                            {
                                msg = "LeaveRequest has been Approved  successfully.... ";
                            }
                            else
                            {
                                msg = "LeaveRequest has been Rejected  successfully.... ";
                            }
                            valid = true;
                        }
                        else
                        {
                            msg   = "Error Occured while processing the request....";
                            valid = false;
                        }
                    }
                    catch (Exception ex)
                    {
                        valid = false;
                        msg   = "Error Occured while processing the request....";
                        _logger.LogError(ex, ex.Message);
                    }
                }
                //for reject code
                else
                {
                    foreach (var model in modellist.leaveApprovals)
                    {
                        model.ErrorMsg   = "";
                        model.Indicator  = "W";
                        model.ApproverId = Approverid;
                        if (status == "Rejected" && model.OldStatus == "Pending Withdrawal")
                        {
                            model.Status = "Withdrawal Rejected";
                        }
                        else
                        {
                            model.Status = status;
                        }
                    }
                    Tuple <string, int> result = _iLeaveapprovalService.SaveLeaveApproval(Mapper.Map <LeaveApprovalServiceViewModel>(modellist));

                    LeaveApprovalModel leavemodel = new LeaveApprovalModel();

                    if (result.Item2 != -99)
                    {
                        foreach (var model in modellist.leaveApprovals)
                        {
                            if (result.Item2 != -99)
                            {
                                MobilenoR = model.empmobileno;//mobileno add
                                #region Message for Reject record
                                var msgTextapprover =
                                    "Your below mentioned leaves / attendance requests have been rejected." + Environment.NewLine +
                                    "Employee No:-" + model.EmployeeID + Environment.NewLine +
                                    "Request:-" + model.LeaveCategory + Environment.NewLine +
                                    "From Date:-" + model.FromDateString + Environment.NewLine +
                                    "To Date:-" + model.ToDateString + Environment.NewLine +
                                    "Days:-" + model.TotalLeaves + " days";
                                try
                                {
                                    _SMSUtility.SendSMS(MobilenoR.ToString(), msgTextapprover);
                                }
                                catch (Exception)
                                {
                                }
                            }
                        }

                        #endregion
                        msg   = "LeaveRequest has been Rejected  successfully.... ";
                        valid = true;
                    }
                    else
                    {
                        msg   = "Error Occured while processing the request....";
                        valid = false;
                    }
                }
            }
            catch (Exception ex)
            {
                valid = false;
                msg   = "Error Occured while processing the request....";
                _logger.LogError(ex, ex.Message);
            }
            return(valid + "~" + msg);
        }
Beispiel #3
0
        public IActionResult CreateLeaveRequest(LeaveRequestViewModel objModel)
        {
            string msg = "";

            try
            {
                objModel.EmployeeName = HttpContext.Session.GetString(Constant.SessionUserName);
                objModel.PA           = HttpContext.Session.GetString(Constant.PersonalArea);
                objModel.PSA          = HttpContext.Session.GetString(Constant.PersonalSubArea);
                objModel.Category     = HttpContext.Session.GetString(Constant.Category);
                if (objModel.ApproverName != null || objModel.ApproverName != string.Empty || objModel.ApproverName != "")
                {
                    string[] arrApproverName = objModel.ApproverName.Split('_');
                    int      objArrCount     = arrApproverName.Length;
                    if (objArrCount > 1)
                    {
                        var objApproverId   = arrApproverName[0].ToString();
                        var objApproverName = arrApproverName[1].ToString();
                        objModel.ApproverId   = objApproverId;
                        objModel.ApproverName = objApproverName;
                    }
                }
                if (objModel.LeaveShift == null)
                {
                    objModel.LeaveShift = "";
                }
                if (objModel.Remarks == null)
                {
                    objModel.Remarks = "";
                }
                else
                {
                    objModel.Remarks = HttpUtility.HtmlEncode(objModel.Remarks);
                }
                if (objModel.FileToUpload == null)
                {
                    objModel.UploadFileName = null;
                }
                else
                {
                    var Filesize = 2 * 1024 * 1024; // Size Limit 2 MB.
                    if (objModel.FileToUpload == null || objModel.FileToUpload.Length == 0)
                    {
                        msg = "danger" + "~" + "Please select file Or file can not be empty";
                        TempData["Messages"] = msg;
                        return(RedirectToAction("LeaveDashboard", "LeaveDashboard"));
                    }
                    else if (objModel.FileToUpload.Length > Filesize)
                    {
                        msg = "danger" + "~" + "File size should not more than 2 MB";
                        TempData["Messages"] = msg;
                        return(RedirectToAction("LeaveDashboard", "LeaveDashboard"));
                    }
                    string dateformate = DateTime.Now.ToString("ddMMyyyyhhmmss");
                    string FilePath    = objModel.FileToUpload.FileName;
                    if (Path.GetExtension(FilePath).ToLower() != ".pdf")
                    {
                        msg = "danger" + "~" + "Please upload only PDF File";
                        TempData["Messages"] = msg;
                        return(RedirectToAction("LeaveDashboard", "LeaveDashboard"));
                    }
                    string FileName = Path.GetFileNameWithoutExtension(FilePath);//Without Extension
                    var    objFile  = HttpContext.Session.GetString(Constant.EmployeeID) + '_' + FileName + '_' + dateformate + ".pdf";
                    var    path     = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot/FileUpload", objFile);
                    HttpContext.Session.SetString(Constant.FileName, FilePath);
                    using (var stream = new FileStream(path, FileMode.Create))
                    {
                        objModel.FileToUpload.CopyToAsync(stream);
                        objModel.UploadFileName = objFile;
                    }
                }
                objModel.EmployeeID = HttpContext.Session.GetString(Constant.EmployeeID);
                string          startDateInText = objModel.FromDate;
                string          endDateInText   = objModel.ToDate;
                System.DateTime startDate       = DateTime.ParseExact(startDateInText, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture);
                System.DateTime endDate         = DateTime.ParseExact(endDateInText, "dd/MM/yyyy", System.Globalization.CultureInfo.CurrentCulture);
                var             diffdate        = (endDate - startDate).TotalDays;
                var             totalleave      = diffdate + 1;
                double          objToalLeave    = Convert.ToDouble(totalleave);
                if (objModel.LeaveShift == "F" || objModel.LeaveShift == "S")
                {
                    objToalLeave = (totalleave) - 0.5;
                }
                objModel.TotalAppliedLeave = objToalLeave;
                objModel.CreatedBy         = HttpContext.Session.GetString(Constant.SessionUserName);
                Tuple <string, int> Result = _ILeaveRequestViewService.SaveLeaveRequest(Mapper.Map <LeaveRequestViewtServiceModel>(objModel));
                if (Result.Item2 == 1 || Result.Item2 == 2)
                {
                    if (Result.Item2 == 1)
                    {
                        msg = "success" + "~" + Result.Item1;
                        #region Message   to Employee
                        string strmobileNo = HttpContext.Session.GetString(Constant.MobileNo);
                        var    msgText     =
                            "You submitted below leaves/attendance " + Environment.NewLine +
                            "Employee No:-" + HttpContext.Session.GetString(Constant.EmployeeID) + Environment.NewLine +
                            "Request:-" + objModel.LeaveCategory + Environment.NewLine +
                            "From Date:-" + objModel.FromDate + Environment.NewLine +
                            "To Date:-" + objModel.ToDate + Environment.NewLine +
                            "Days:-" + objModel.TotalAppliedLeave + " days";
                        try
                        {
                            _SMSUtility.SendSMS(strmobileNo, msgText);
                        }
                        catch (Exception)
                        {
                        }

                        #endregion
                    }
                    else
                    {
                        msg = "danger" + "~" + Result.Item1;
                    }
                }
                else
                {
                    _logger.LogError("Error", Result.Item1);
                    msg = "danger" + "~" + "Error occured while processing leave request..";
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
                msg = "danger" + "~" + "Error occured while processing leave request...............";
            }
            TempData["Messages"] = msg;
            return(RedirectToAction("LeaveDashboard", "LeaveDashboard"));
        }
Beispiel #4
0
        public IActionResult LeaveWithdrawal(LeaveWithdrawalModel model)
        {
            int  result    = 0;
            var  msgText   = "";
            bool returnres = false;

            try
            {
                if (ModelState.IsValid)
                {
                    if (model.LeaveAppliedFrom == "T" || model.LeaveAppliedFrom == "E")
                    {
                        if (model.LeaveShift == "First Half")
                        {
                            model.LeaveShift = "F";
                        }
                        else if (model.LeaveShift == "First Half")
                        {
                            model.LeaveShift = "S";
                        }
                        else
                        {
                            model.LeaveShift = "";
                        }
                        bool retresult = DeleteLeaveFromSAP(model);
                        return(Json(retresult));
                    }
                    string Approverid     = (HttpContext.Session.GetString(Constant.EmployeeID));
                    var    EmployeeName   = HttpContext.Session.GetString(Constant.SessionUserName);
                    string EmployeeId     = HttpContext.Session.GetString(Constant.EmployeeID);
                    string strmobileNo    = HttpContext.Session.GetString(Constant.MobileNo);
                    string strmobileNoapp = HttpContext.Session.GetString(Constant.ApproverMobileNo);
                    if (model.Status == "Pending" || model.Status == "Approved")
                    {
                        result = _iLeavewithdrawalService.SaveLeaveWithdrawal(Mapper.Map <LeaveWithdrawalServiceModel>(model));
                        if (result == 1)
                        {
                            returnres = true;
                            #region For Message to Employee
                            if (model.Status == "Approved")
                            {
                                msgText =
                                    //"Your Subordinate wants to cancel/ withdraw below leave/attendance requests which were approved in the system." + Environment.NewLine +
                                    "You have submitted a request for cancellation / withdrawal of below mentioned leaves / attendance.Your request has been sent to your superior for further action." + Environment.NewLine +
                                    "Employee No:-" + HttpContext.Session.GetString(Constant.EmployeeID) + Environment.NewLine +
                                    "Request:-" + model.LeaveCategory + Environment.NewLine +
                                    "From Date:-" + model.FromDateString + Environment.NewLine +
                                    "To Date:-" + model.ToDateString + Environment.NewLine +
                                    "Days:-" + model.TotalLeaves + " days";
                            }
                            else if (model.Status == "Pending")
                            {
                                msgText =
                                    "You have submitted a request for cancellation/ withdrawal of below non- approved leaves / attendance which has been processed and submitted entry has been deleted." + Environment.NewLine +
                                    "Employee No:-" + HttpContext.Session.GetString(Constant.EmployeeID) + Environment.NewLine +
                                    "Request:-" + model.LeaveCategory + Environment.NewLine +
                                    "From Date:-" + model.FromDateString + Environment.NewLine +
                                    "To Date:-" + model.ToDateString + Environment.NewLine +
                                    "Days:-" + model.TotalLeaves + " days";
                            }
                            try
                            {
                                _SMSUtility.SendSMS(strmobileNo, msgText);
                            }
                            catch (Exception)
                            {
                            }



                            #endregion
                            #region For Message to Approver(Supervisor)
                            //var msgTextApp = "";
                            //if (model.Status == "Pending")
                            //{
                            //    msgTextApp =
                            //         "Your Subordinate has cancelled below non-Approved leave/attendance requests. This is for your information." + Environment.NewLine +
                            //         "Employee No:-" + HttpContext.Session.GetString(Constant.EmployeeID) + Environment.NewLine +
                            //         "Request:-" + model.LeaveCategory + Environment.NewLine +
                            //         "From Date:-" + model.FromDate + Environment.NewLine +
                            //         "To Date:-" + model.ToDate + Environment.NewLine +
                            //         "Days:-" + model.TotalLeaves + "days";
                            //}

                            //var smsapp = _SMSUtility.SendSMS(strmobileNoapp, msgTextApp);

                            //if (smsapp == true)
                            //{
                            //    strmobileNoapp = Convert.ToString(1);
                            //}
                            //else
                            //{
                            //    strmobileNoapp = Convert.ToString(0);
                            //}
                            #endregion
                        }
                    }
                    else
                    {
                        returnres = false;
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, ex.Message);
            }
            return(Json(returnres));
        }
Beispiel #5
0
        public long GenerateOtp(string employeeid, long mobileno)
        {
            LoginViewServiceModel l = new LoginViewServiceModel();
            // var responseList = Mapper.Map < LoginViewServiceModel >( _igenerateotprepositary.GetMobileno(employeeid));
            //           var responseList = _igenerateotprepositary.Getsingledata(employeeid);
            //var Mobileno = responseList.Select(x => x.MobileNO).ToList().Distinct().ToList() ;
            //OTP generation code
            long msgsent = 0;



            char[] charArr        = "0123456789".ToCharArray();
            string strrandom      = string.Empty;
            Random objran         = new Random();
            int    noofcharacters = 4; //Convert.ToInt32(txtCharacters.Text);

            for (int i = 0; i < noofcharacters; i++)
            {
                int pos = objran.Next(1, charArr.Length);
                if (!strrandom.Contains(charArr.GetValue(pos).ToString()))
                {
                    strrandom += charArr.GetValue(pos);
                }
                else
                {
                    i--;
                }
            }
            var strotp = strrandom;

            // var item = responseList.FirstOrDefault();
            //               msgsent = item.MobileNO;
            msgsent = mobileno;
            string msgotp = smsd.Otpgeneratesms;

            msgotp = msgotp.Replace("+", strotp);

            //Code for save otp ,empid,otpstarrttime n endtime in table
            var saveotplist = new List <tbl_OTPG>();
            var savedata    = new tbl_OTPG
            {
                EmployeeID = Convert.ToString(employeeid),
                OTP        = Convert.ToInt32(strotp),
            };

            //uncomment this code for save otp
            saveotplist.Add(savedata);
            var savetorep = _igenerateotprepositary.SaveOTP(saveotplist);
            var ret       = savetorep.Item2;

            // temperory comment code as sms utility gets error u should uncomment this for sending sms and make m = 0
            if (ret == 1)
            {
                var sms = _SMSUtility.SendSMS(msgsent.ToString(), msgotp);
                //  var sms = "0";
                if (sms != null)
                {
                    msgsent = 1;
                }
                else
                {
                    msgsent = 0;
                }
            }
            else if (ret == -1)
            {
                msgsent = -1;
            }
            else
            {
                msgsent = 0;
            }
            //}
            return(msgsent);
        }