public ActionResult Add(string messages, string title) { object result = ""; try { B_Messages bMessage = new B_Messages(); bMessage.Add(new M_Messages { CreateDate = DateTime.Now, messages = messages, title = title }); result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetTime(int DateId) { object result = ""; try { var date = new B_Pouriya_Date().GetDate(DateId); result = new List <object> { new { Hour = "8 تا 11", Id = (int)E_PublicCategory.SERVICE_TIME.Time_8_11, IsActive = isPast(date.Date, E_PublicCategory.SERVICE_TIME.Time_8_11) }, new { Hour = "11 تا 14", Id = (int)E_PublicCategory.SERVICE_TIME.Time_11_14, IsActive = isPast(date.Date, E_PublicCategory.SERVICE_TIME.Time_11_14) }, new { Hour = "14 تا 17", Id = (int)E_PublicCategory.SERVICE_TIME.Time_14_17, IsActive = isPast(date.Date, E_PublicCategory.SERVICE_TIME.Time_14_17) }, new { Hour = "17 تا 20", Id = (int)E_PublicCategory.SERVICE_TIME.Time_17_20, IsActive = isPast(date.Date, E_PublicCategory.SERVICE_TIME.Time_17_20) }, new { Hour = "20 تا 22", Id = (int)E_PublicCategory.SERVICE_TIME.Time_20_22, IsActive = isPast(date.Date, E_PublicCategory.SERVICE_TIME.Time_20_22) } }; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult ListenEar(string EarText) { object result = ""; try { M_ListenEar mEar = new M_ListenEar(); mEar.CreationDate = DateTime.Now; mEar.IsRead = false; mEar.UserId = CurrentUser.Id; mEar.Description = EarText; result = new B_ListenEar().AddListenEar(mEar); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetServiceMapPointes(int Id) { object result = ""; try { B_ServicesRequests bPersonel = new B_ServicesRequests(); var points = bPersonel.GetServiceMapPointes(Id); var objs = new List <object>(); foreach (var li in points) { objs.Add(new { popupContent = "<p></p>", center = new { lat = li.Split(',')[0].Trim(), lng = li.Split(',')[1].Trim() }, iconOpts = new { iconUrl = "/Areas/Admin/Images/MapMarkerNew.png", iconRetinaUrl = "/Areas/Admin/Images/MapMarkerNew.png", iconSize = new int[] { 30, 38 } } }); } result = objs; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult AddRole(M_PersonelRoles Role, List <string> Permissions) { object result = ""; try { B_PersonelRoles bPersonelRole = new B_PersonelRoles(); B_PersonelRoleValues bPersonelRoleValue = new B_PersonelRoleValues(); Role = bPersonelRole.Add(Role); if (!Role.HasFullControl) { foreach (var li in Permissions) { bPersonelRoleValue.Add(new M_PersonelRoleValues { AccessName = li, PersonelRoleId = Role.Id }); } } result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public bool SendRequestForBooth(object Request, int PersonelId) { try { var personel = Personels.Where(c => c.Id == PersonelId).ToList(); if (personel.Count == 0) { // Send SMS } else { Clients.Clients(personel.Select(c => c.ConnectionId).ToList()).AsignedRequest(Request); } return(true); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SIGNALR_HUB, E_LogType.ERROR, ex); if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; } L_Log.SubmitLog(exx); return(false); } }
public ActionResult RevertUser(int Id) { object result = ""; try { B_Personels bPersonel = new B_Personels(); var personel = bPersonel.GetPersonelById(Id); personel.IsDeleted = false; bPersonel.Edit(personel); result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public object LocationDriver(int RequestId) { try { var request = new B_ServicesRequests().GetServicesRequests(RequestId); if (request == null) { return(false); } var clientRecipment = Users.Where(c => c.Id == request.UserId).ToList(); if (clientRecipment == null) { return(false); } var cController = new ServicesRequestsController(); return(cController.getRequestDetail(request.Id, request.UserId)); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SIGNALR_HUB, E_LogType.ERROR, ex); if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; } L_Log.SubmitLog(exx); return(false); } }
public bool UpdateLocation(double Lat, double Lng, double Bearing) { try { var personel = Personels.Where(c => c.ConnectionId == Context.ConnectionId).FirstOrDefault(); if (personel == null) { return(false); } new B_Location().Add(new M_Location { Bearing = Bearing, Date = DateTime.Now, IsOld = false, Lat = Lat, Lng = Lng, PersonelId = personel.Id }); return(true); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SIGNALR_HUB, E_LogType.ERROR, ex); if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; } L_Log.SubmitLog(exx); return(false); } }
public bool RejectRequest(int RequestId, int UserId) { try { var user = Users.Where(c => c.Id == UserId).ToList(); if (user.Count == 0) { return(false); } foreach (var li in user) { Clients.Client(li.ConnectionId).RejectRequestForUser(RequestId); } return(true); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SIGNALR_HUB, E_LogType.ERROR, ex); if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; } L_Log.SubmitLog(exx); return(false); } }
public ActionResult Add(M_Personels Personel, M_CarInfo CareInfo, M_BoothInfo BoothInfo) { object result = ""; try { B_Personels bPersonel = new B_Personels(); var personel = bPersonel.Add(Personel); if (Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.DRIVER) { CareInfo.PersonelId = personel.Id; new B_CarInfo().Add(CareInfo); } else if (Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.INTEGRATION_CENTER || Personel.PersonelType == E_PublicCategory.PERSONEL_TYPE.SUM_CENER) { BoothInfo.PersonelId = personel.Id; new B_Booth().Add(BoothInfo); } result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Search(string SearchField) { object result = ""; try { if (string.IsNullOrEmpty(SearchField)) { result = new B_Learns().GetLearns().OrderByDescending(x => x.Id); } else { result = new B_Learns().GetLearns().Where(x => x.Title.Contains(SearchField)).ToList().OrderByDescending(x => x.Id); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetRequestHistory() { object result = ""; try { var obj = new List <object>(); var requests = new B_ServicesRequests().GetServicesRequests(CurrentUser.Id, null).Where(x => x.Status == E_PublicCategory.REQUEST_STATUS.CLOSED).ToList().OrderByDescending(x => x.CreateDate); if (requests.Count() > 0 && requests != null) { foreach (var li in requests) { obj.Add(new { Date = li.CreateDate.ConvertMiladiToShamsi(), Number = li.Id, Point = new B_ServicesRequestItems().GetItemsPoint(li.Id) }); } } result = obj; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult DeleteFavoriteAddress(int Id) { object result = ""; try { B_Addresses bAddress = new B_Addresses(); if (Id == 0) { throw F_ExeptionFactory.MakeExeption("شما مجاز به حذف آدرس منتخب نیستید", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "FavoriteAddress", Enums.Loging.E_LogType.SYSTEM_ERROR); } bAddress.Delete(Id); result = bAddress.GetAddresses(CurrentUser.Id, true); } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Modify(M_News News) { object result = ""; try { if (News.Id == 0) { new B_News().Add(News); } else { new B_News().Edit(News); } result = true; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetNearCars(double Lat, double Lng) { object result = ""; try { var cars = new B_Location().GetNearDrivers(Lat, Lng).ToList(); var markers = new List <object>(); foreach (var li in cars) { markers.Add(new { center = new { lat = li.Lat, lng = li.Lng }, iconOpts = new { iconUrl = "/Areas/User/Images/CarIcon.png", iconSize = new int[] { 30, 30 } } }); } var res = new Helper.ApiCall(@"https://api.cedarmaps.com/v1/geocode/cedarmaps.streets/" + Lat + "," + Lng + ".json?access_token=7775fb1e47034c4ae978aae1b3ac3f6f0b4ec6b3", "").CallApiGet(); result = new { markers = markers, Address = res }; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetLastRequestUser() { object result = ""; try { var temp = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, E_PublicCategory.REQUEST_STATUS.CLOSED); if (temp != null && (bool)temp.ShowRatingDialog == false && temp.PersonelId != null) { result = new { Request = temp, Point = new B_ServicesRequestItems().GetItemsPoint(temp.Id), Personel = new B_Personels().GetPersonelById((int)temp.PersonelId) } } ; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult UploadCoverFile() { object result = ""; try { string fileName = Guid.NewGuid().ToString().Replace("-", "") + "_" + Request.Files[0].FileName; HttpPostedFileBase file = Request.Files[0]; int fileSize = file.ContentLength; System.IO.Stream fileContent = file.InputStream; file.SaveAs(Server.MapPath("~/Areas/Admin/Images/Learns") + "/" + fileName); result = fileName; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult SearchOnMap(double Lat, double Lng, string SearchText) { object result = ""; try { if (string.IsNullOrEmpty(SearchText)) { throw F_ExeptionFactory.MakeExeption("مقدار فیلد جستجو خالی است", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } var res = new Helper.ApiCall(@"https://api.cedarmaps.com/v1/geocode/cedarmaps.streets/" + SearchText + "?location=" + Lat + "," + Lng + "&distance=50&access_token=7775fb1e47034c4ae978aae1b3ac3f6f0b4ec6b3", "").CallApiGet(); result = res; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Modify(M_Users User) { object result = ""; try { B_Users bUser = new B_Users(); var oldUser = bUser.GetUsers(User.Id); if (oldUser.ImageName.ToLower() != "default.jpg" && oldUser.ImageName.ToLower() != User.ImageName) { System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Images/Profile") + "/" + oldUser.ImageName); } bUser.Edit(User); result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult UploadProfileImage() { object result = ""; try { string fileName = Guid.NewGuid().ToString().Replace("-", "") + ".jpg"; HttpPostedFileBase file = Request.Files[0]; int fileSize = file.ContentLength; System.IO.Stream fileContent = file.InputStream; file.SaveAs(Server.MapPath("~/Areas/Admin/Images/Profile") + "/" + fileName); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1)); Response.Cache.SetNoStore(); result = fileName; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Delete(int Id) { object result = ""; try { B_ServicesCategories bServicesCategories = new B_ServicesCategories(); var oldServicesCategories = bServicesCategories.GetServicesCategories(Id); bServicesCategories.Delete(Id); try { System.IO.File.Delete(Server.MapPath("~/Images/Categories/xxxhdpi") + "/" + oldServicesCategories.ImageName); System.IO.File.Delete(Server.MapPath("~/Images/Categories/xxhdpi") + "/" + oldServicesCategories.ImageName); System.IO.File.Delete(Server.MapPath("~/Images/Categories/xhdpi") + "/" + oldServicesCategories.ImageName); System.IO.File.Delete(Server.MapPath("~/Images/Categories/hdpi") + "/" + oldServicesCategories.ImageName); System.IO.File.Delete(Server.MapPath("~/Images/Categories/mdpi") + "/" + oldServicesCategories.ImageName); } catch { } result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult UploadImage() { object result = ""; try { string fileName = Guid.NewGuid().ToString().Replace("-", "") + ".png"; HttpPostedFileBase file = Request.Files[0]; file.SaveAs(Server.MapPath("~/Areas/Admin/Images/Categories/xxxhdpi") + "/" + fileName); Image img = Image.FromStream(file.InputStream, true, true); img.ResizeImage(144, 144).Save(Server.MapPath("~/Areas/Admin/Images/Categories/xxhdpi") + "/" + fileName); img.ResizeImage(96, 96).Save(Server.MapPath("~/Areas/Admin/Images/Categories/xhdpi") + "/" + fileName); img.ResizeImage(72, 72).Save(Server.MapPath("~/Areas/Admin/Images/Categories/hdpi") + "/" + fileName); img.ResizeImage(48, 48).Save(Server.MapPath("~/Areas/Admin/Images/Categories/mdpi") + "/" + fileName); file.InputStream.Close(); result = fileName; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult Modify(M_ServicesRequests ServicesRequests, List <M_ServicesRequestItems> RequestList) { object result = ""; try { var request = new B_ServicesRequests().GetServicesRequests(ServicesRequests.Id); if (request != null) { request.Address = ServicesRequests.Address; request.Description = ServicesRequests.Description; request.ImmediatelyRequest = ServicesRequests.ImmediatelyRequest; request.PlaqueNumber = ServicesRequests.PlaqueNumber; request.UnitNumber = ServicesRequests.UnitNumber; request.UpdateDate = DateTime.Now; new B_ServicesRequests().Edit(request, false); } var bItems = new B_ServicesRequestItems(); var oldItems = bItems.GetItems(ServicesRequests.Id, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER); foreach (var li in oldItems) { bItems.Delete(li.Id); } foreach (var li in RequestList) { if (!li.CategoryId.HasValue) { throw F_ExeptionFactory.MakeExeption("مقادیر دسته بندی های انتخاب شده صحیح نیست لطفا مراتب را سریعتر به تیم فنی پروژه گزارش دهید", Enums.Loging.E_LogType.SYSTEM_ERROR); } var category = new B_ServicesCategories().GetServicesCategories(li.CategoryId.Value); li.CategoryId = category.Id; li.CreateDate = category.CreateDate; li.ImageName = category.ImageName; li.IsFailed = false; li.RequestId = ServicesRequests.Id; li.ScorePerUnit = category.ScorePerUnit; li.ScorePerUnitDriver = category.ScorePerUnitDriver; li.Title = category.Title; li.Unit = category.Unit; li.UserId = request.UserId; li.UserType = E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER; li.Id = 0; bItems.Add(li); } result = "Success"; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult DoneRequest(int Id) { object result = ""; try { var bReq = new B_ServicesRequests(); bReq.CloseRequestByPortal(Id); result = true; try { var req = bReq.GetServicesRequests(Id); var hubConnection = new HubConnection(url: SignalRUrl); var chat = hubConnection.CreateHubProxy(hubName: "Reqeust"); hubConnection.Start().Wait(); chat.Invoke <bool>("RequestChangedStatus", req, req.UserId); } catch { } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult GetLastRequest(string Type) { object result = ""; try { var temp = new B_ServicesRequests().GetUserLastRequest(CurrentUser.Id, Type); if (temp != null) { result = temp; } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult SendActivationCode(int Id) { object result = ""; try { B_SmsAuthorise bSms = new B_SmsAuthorise(); var sms = bSms.GetSmsDetails(Id); if (sms != null) { var code = new B_SmsAuthorise().AddCode(sms.PhoneNumber); new ApplicationHelper.Sms().SendSms(sms.PhoneNumber, code.ToString()); result = "Success"; } else { throw F_ExeptionFactory.MakeExeption("متاسفانه کد فعال سازی ارسال نشد. مجددا تلاش کنید", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationCode", E_LogType.SYSTEM_ERROR); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult ResetPasswordChangePassword(int Id, string NewPassword, string RetypeNewPassword) { object result = ""; try { if (string.IsNullOrEmpty(NewPassword)) { throw F_ExeptionFactory.MakeExeption("گذرواژه وارد شده صحیح نمی باشد", ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "Password", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (string.IsNullOrEmpty(RetypeNewPassword)) { throw F_ExeptionFactory.MakeExeption("گذرواژه وارد شده صحیح نمی باشد", ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "Password", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (NewPassword != RetypeNewPassword) { throw F_ExeptionFactory.MakeExeption("گذرواژه های وارد شده باید یکسان باشند", ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "Password", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (Id == 0) { throw F_ExeptionFactory.MakeExeption("اطلاعات ورودی معتبر نمیباشد", ((int)E_ErrorCodes.EMPTY_FIELD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationId", Enums.Loging.E_LogType.SYSTEM_ERROR); } var smsAuthorize = new B_SmsAuthorise().GetSmsDetails(Id); if (smsAuthorize == null) { throw F_ExeptionFactory.MakeExeption("اطلاعات ورودی معتبر نمیباشد", ((int)E_ErrorCodes.EMPTY_FIELD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationId", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (new B_Users().ChangePassword(smsAuthorize.PhoneNumber, NewPassword)) { result = "Success"; } else { throw F_ExeptionFactory.MakeExeption("خطا در تغییر گذرواژه", ((int)E_ErrorCodes.USERNAME_OR_PASSWORD) + S_Seprators.ErrorFieldNameSeprator.ToString() + "Password", Enums.Loging.E_LogType.SYSTEM_ERROR); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult EditRequest(int RequestId, List <M_ServicesRequestItems> RequestItems) { object result = ""; try { var bItem = new B_ServicesRequestItems(); var oldItems = bItem.GetItems(RequestId, E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER); var userId = new B_ServicesRequests().GetServicesRequests(RequestId).UserId; foreach (var li in oldItems) { bItem.Delete(li.Id); } if (RequestItems != null && RequestItems.Count > 0) { foreach (var li in RequestItems) { if (li.Value != 0) { var category = new B_ServicesCategories().GetServicesCategories(li.Id); if (category != null) { bItem.Add(new M_ServicesRequestItems { CreateDate = DateTime.Now, RequestId = RequestId, UserType = E_PublicCategory.SYSTEM_USER_TYPE.NORMAL_USER, Value = li.Value, ImageName = category.ImageName, ScorePerUnit = category.ScorePerUnit, Title = category.Title, Unit = category.Unit, IsFailed = false, UserId = userId, CategoryId = category.Id }); } } } } result = true; } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_BOOTH_RIDER_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }
public ActionResult ResetPasswordSendVerificationCode(string PhoneNumber) { object result = ""; try { if (string.IsNullOrEmpty(PhoneNumber)) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (PhoneNumber.Length != 11) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } var user = new B_Users().GetUsers(PhoneNumber); if (user == null) { throw F_ExeptionFactory.MakeExeption("شماره تلفن وارد شده در سیستم ثبت نشده است", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (user.IsDeleted == true) { throw F_ExeptionFactory.MakeExeption("چنین کاربری یافت نشد", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "User", Enums.Loging.E_LogType.SYSTEM_ERROR); } int code = new B_SmsAuthorise().AddCode(PhoneNumber); if (code != 0) { new ApplicationHelper.Sms().SendSms(PhoneNumber, code.ToString()); result = new B_SmsAuthorise().GetSmsDetailsId(PhoneNumber); } else { throw F_ExeptionFactory.MakeExeption("متاسفانه کد فعال سازی ارسال نشد. مجددا تلاش کنید", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "VerificationCode", E_LogType.SYSTEM_ERROR); } } catch (Exception ex) { M_SystemLog exx = new M_SystemLog(E_SystemType.SHAHRDARI_USER_WEB_APPLICATION, E_LogType.ERROR, ex); result = "Error"; if (ex.Source == E_LogType.SYSTEM_ERROR.ToString()) { exx.LogType = E_LogType.SYSTEM_ERROR; result = exx; } L_Log.SubmitLog(exx); } return(Json(result)); }