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 AddFavoriteAddress(M_Addresses Address) { object result = ""; try { if (string.IsNullOrEmpty(Address.Title)) { throw F_ExeptionFactory.MakeExeption("عنوان وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (string.IsNullOrEmpty(Address.Address)) { throw F_ExeptionFactory.MakeExeption("آدرس وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (Address.Unit == 0 || Address.Unit == null) { throw F_ExeptionFactory.MakeExeption("شماره واحد وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } if (Address.Plaque == "0" || string.IsNullOrEmpty(Address.Plaque)) { throw F_ExeptionFactory.MakeExeption("شماره پلاک وارد شده صحیح نیست", ((int)E_ErrorCodes.NOT_FOUND) + S_Seprators.ErrorFieldNameSeprator.ToString() + "PhoneNumber", Enums.Loging.E_LogType.SYSTEM_ERROR); } B_Addresses bAddress = new B_Addresses(); Address.UserId = CurrentUser.Id; Address.IsFavorite = true; bAddress.Add(Address); 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 GetFavoriteAddress(int Id) { object result = ""; try { result = new B_Addresses().GetAddress(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 EditFavoriteAddress(M_Addresses Address) { object result = ""; try { B_Addresses bAddress = new B_Addresses(); bAddress.Edit(Address); 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)); }