public string GetDueDate(string Code, string InvDate = "") { try { string DuePaymentDueDateFormatted; SPAccounts.DataAccessObject.DTO.Common com = new SPAccounts.DataAccessObject.DTO.Common(); DateTime Datenow = com.GetCurrentDateTime(); PaymentTermsViewModel payTermsObj = Mapper.Map <PaymentTerms, PaymentTermsViewModel>(_paymentTermsBusiness.GetPayTermDetails(Code)); if (InvDate == "") { DuePaymentDueDateFormatted = Datenow.AddDays(payTermsObj.NoOfDays).ToString("dd-MMM-yyyy"); } else { DuePaymentDueDateFormatted = Convert.ToDateTime(InvDate).AddDays(payTermsObj.NoOfDays).ToString("dd-MMM-yyyy"); } return(JsonConvert.SerializeObject(new { Result = "OK", Records = DuePaymentDueDateFormatted })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string InsertUpdateFollowUp(CustomerExpeditingListViewModel customerObj) { try { AppUA _appUA = Session["AppUA"] as AppUA; customerObj.followUpObj.commonObj = new CommonViewModel(); SPAccounts.DataAccessObject.DTO.Common _comonObj = new SPAccounts.DataAccessObject.DTO.Common(); customerObj.followUpObj.commonObj.CreatedBy = _appUA.UserName; customerObj.followUpObj.commonObj.CreatedDate = _comonObj.GetCurrentDateTime(); customerObj.followUpObj.commonObj.UpdatedDate = _comonObj.GetCurrentDateTime(); customerObj.followUpObj.commonObj.UpdatedBy = _appUA.UserName; FollowUpViewModel followupObj = Mapper.Map <FollowUp, FollowUpViewModel>(_paymentFollowupBusiness.InsertUpdateFollowUp(Mapper.Map <FollowUpViewModel, FollowUp>(customerObj.followUpObj))); if (customerObj.followUpObj.ID == Guid.Empty) { return(JsonConvert.SerializeObject(new { Result = "OK", Records = followupObj, Message = "Insertion successfull" })); } else { return(JsonConvert.SerializeObject(new { Result = "OK", Records = followupObj, Message = "Updation successfull" })); } } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string InsertUpdateOtherExpense(OtherExpenseViewModel otherExpenseViewModel) { if (ModelState.IsValid) { try { //removiing combined code int len = otherExpenseViewModel.AccountCode.IndexOf(':'); otherExpenseViewModel.AccountCode = otherExpenseViewModel.AccountCode.Remove(len); // AppUA appUA = Session["AppUA"] as AppUA; otherExpenseViewModel.commonObj = new CommonViewModel(); SPAccounts.DataAccessObject.DTO.Common common = new SPAccounts.DataAccessObject.DTO.Common(); otherExpenseViewModel.commonObj.CreatedBy = appUA.UserName; otherExpenseViewModel.commonObj.CreatedDate = common.GetCurrentDateTime(); otherExpenseViewModel.commonObj.UpdatedBy = appUA.UserName; otherExpenseViewModel.commonObj.UpdatedDate = common.GetCurrentDateTime(); OtherExpenseViewModel otherExpenseVM = null; switch (otherExpenseViewModel.ID == Guid.Empty) { //INSERT case true: otherExpenseVM = Mapper.Map <OtherExpense, OtherExpenseViewModel>(_otherExpenseBusiness.InsertOtherExpense(Mapper.Map <OtherExpenseViewModel, OtherExpense>(otherExpenseViewModel))); return(JsonConvert.SerializeObject(new { Result = "OK", Record = otherExpenseVM })); default: //Getting UA otherExpenseVM = Mapper.Map <OtherExpense, OtherExpenseViewModel>(_otherExpenseBusiness.UpdateOtherExpense(Mapper.Map <OtherExpenseViewModel, OtherExpense>(otherExpenseViewModel))); return(JsonConvert.SerializeObject(new { Result = "OK", Record = otherExpenseVM })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } } //Model state errror else { List <string> modelErrors = new List <string>(); foreach (var modelState in ModelState.Values) { foreach (var modelError in modelState.Errors) { modelErrors.Add(modelError.ErrorMessage); } } return(JsonConvert.SerializeObject(new { Result = "VALIDATION", Message = string.Join(",", modelErrors) })); } }
public string GetRecentFollowUpCount() { try { //AppUA _appUA = Session["AppUAOffice"] as AppUA; // DateTime? Date = string.IsNullOrEmpty(_appUA.DateTime) ? (DateTime?)null : DateTime.Parse(Today); SPAccounts.DataAccessObject.DTO.Common comonObj = new SPAccounts.DataAccessObject.DTO.Common(); List <FollowUpViewModel> followupObj = Mapper.Map <List <FollowUp>, List <FollowUpViewModel> >(_paymentFollowupBusiness.GetRecentFollowUpCount(comonObj.GetCurrentDateTime())); return(JsonConvert.SerializeObject(new { Result = "OK", Records = followupObj })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string GetCustomerPaymentExpeditingDetails(string toDate, string filter, string company, string[] customer, string outstanding, string search) { try { AppUA _appUA = Session["AppUA"] as AppUA; SPAccounts.DataAccessObject.DTO.Common _comonObj = new SPAccounts.DataAccessObject.DTO.Common(); DateTime?Date = _comonObj.GetCurrentDateTime(); DateTime?TDate = string.IsNullOrEmpty(toDate) ? (DateTime?)null : DateTime.Parse(toDate); CustomerExpeditingListViewModel result = new CustomerExpeditingListViewModel(); result.customerExpeditingDetailsList = Mapper.Map <List <CustomerExpeditingReport>, List <CustomerExpeditingReportViewModel> >(_paymentFollowupBusiness.GetCustomerExpeditingDetail(Date, TDate, filter, company, customer != null ? string.Join(",", customer) : "ALL", outstanding, search)); return(JsonConvert.SerializeObject(new { Result = "OK", Records = result })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = ex.Message })); } }
public string UpdateValueInSettings(string Value) { try { AppUA appUA = Session["AppUA"] as AppUA; SysSettingsViewModel sysSettings = new SysSettingsViewModel(); sysSettings.Name = "OE-LIMIT"; sysSettings.Value = Value; sysSettings.CommonObj = new CommonViewModel(); SPAccounts.DataAccessObject.DTO.Common common = new SPAccounts.DataAccessObject.DTO.Common(); sysSettings.CommonObj.UpdatedBy = appUA.UserName; sysSettings.CommonObj.UpdatedDate = common.GetCurrentDateTime(); string actionMessage = _otherExpenseBusiness.UpdateValueInSettings(Mapper.Map <SysSettingsViewModel, SysSettings>(sysSettings)); return(JsonConvert.SerializeObject(new { Result = "OK", Message = actionMessage })); } catch (Exception Ex) { AppConstMessage cm = c.GetMessage(Ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string SendNotification(OtherExpenseViewModel otherExpenseVM) { try { AppUA appUA = Session["AppUA"] as AppUA; SPAccounts.DataAccessObject.DTO.Common common = new SPAccounts.DataAccessObject.DTO.Common(); otherExpenseVM.commonObj = new CommonViewModel(); otherExpenseVM.commonObj.UpdatedBy = appUA.UserName; otherExpenseVM.commonObj.UpdatedDate = common.GetCurrentDateTime(); bool result = _otherExpenseBusiness.NotifyOtherExpense(otherExpenseVM.ID); string titleString = "Expense Approval"; string descriptionString = otherExpenseVM.RefNo + ", Expense: " + otherExpenseVM.AccountCode + ", Amount: " + otherExpenseVM.Amount + ", Notes: " + otherExpenseVM.Description; Boolean isCommon = true; string customerID = ""; _commonBusiness.SendToFCM(titleString, descriptionString, isCommon, customerID); return(JsonConvert.SerializeObject(new { Result = "OK", Message = (result ? c.NotificationSuccess : "Failed") })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public string InsertUpdateEmployee(EmployeeViewModel _employeeObj) { object result = null; try { AppUA appUA = Session["AppUA"] as AppUA; _employeeObj.commonObj = new CommonViewModel(); SPAccounts.DataAccessObject.DTO.Common common = new SPAccounts.DataAccessObject.DTO.Common(); _employeeObj.commonObj.CreatedBy = appUA.UserName; _employeeObj.commonObj.CreatedDate = appUA.DateTime; _employeeObj.commonObj.UpdatedBy = appUA.UserName; _employeeObj.commonObj.UpdatedDate = common.GetCurrentDateTime(); _employeeObj.IsActive = true; result = _employeeBusiness.InsertUpdateEmployee(Mapper.Map <EmployeeViewModel, Employee>(_employeeObj)); return(JsonConvert.SerializeObject(new { Result = "OK", Records = result })); } catch (Exception ex) { AppConstMessage cm = c.GetMessage(ex.Message); return(JsonConvert.SerializeObject(new { Result = "ERROR", Message = cm.Message })); } }
public void OnAuthentication(AuthenticationContext filterContext) { //var controllerName = filterContext.RouteData.Values["controller"]; //var actionName = filterContext.RouteData.Values["action"]; // if (filterContext.HttpContext.Request.IsAjaxRequest()) // { if ((filterContext.HttpContext.Session == null) || (filterContext.HttpContext.Session["TvmValid"] == null)) { filterContext.Result = new HttpUnauthorizedResult(); return; } var authCookie = filterContext.HttpContext.Request.Cookies[FormsAuthentication.FormsCookieName]; if (authCookie == null) { // Unauthorized filterContext.Result = new HttpUnauthorizedResult(); return; } // Get the forms authentication ticket. FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); if (authTicket == null) { filterContext.Result = new HttpUnauthorizedResult(); // mark unauthorized*/ } else { filterContext.HttpContext.User = new System.Security.Principal.GenericPrincipal( new System.Security.Principal.GenericIdentity(authTicket.Name, "Forms"), authTicket.UserData.Split(',').Select(t => t.Trim()).ToArray()); UA _ua = (UA)filterContext.HttpContext.Session["TvmValid"]; AppUA appUA = new AppUA(); appUA.RolesCSV = authTicket.UserData; appUA.UserName = _ua.UserName; LoggedUserName = appUA.UserName; SPAccounts.DataAccessObject.DTO.Common common = new SPAccounts.DataAccessObject.DTO.Common(); appUA.DateTime = common.GetCurrentDateTime(); appUA.AppID = _ua.AppID; filterContext.HttpContext.Session.Add("AppUA", appUA); } //} //NON AJAX CALL //else //{ // if ((filterContext.HttpContext.Session == null) || (filterContext.HttpContext.Session["TvmValid"] == null)) // { // filterContext.Result = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary() { { "controller", "Account" }, { "action", "Index" } }); // return; // } // //// // var authCookie = filterContext.HttpContext.Request.Cookies[FormsAuthentication.FormsCookieName]; // if (authCookie == null) // { // filterContext.Result = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary() { { "controller", "Account" }, { "action", "Index" } }); // return; // } // // Get the forms authentication ticket. // FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value); // // object usercookie = JsonConvert.DeserializeObject(authTicket.UserData); // Up to you to write this Deserialize method -> it should be the reverse of what you did in your Login action // if (authTicket == null) // { // filterContext.Result = new RedirectToRouteResult(new System.Web.Routing.RouteValueDictionary() { { "controller", "Account" }, { "action", "Index" } }); // } // else // { // filterContext.HttpContext.User = new System.Security.Principal.GenericPrincipal( // new System.Security.Principal.GenericIdentity(authTicket.Name, "Forms"), authTicket.UserData.Split(',').Select(t => t.Trim()).ToArray()); // } //} }