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 M_BoothInfo Add(M_BoothInfo BoothInfo) { BoothInfo.IsDelete = false; var db = new DatabaseContext(); BoothInfo = db.BoothInfo.Add(BoothInfo); db.SaveChanges(); return(BoothInfo); }
public ActionResult Modify(M_Personels Personel, M_CarInfo CareInfo, M_BoothInfo BoothInfo) { object result = ""; try { B_Personels bPersonel = new B_Personels(); var oldPersonel = bPersonel.GetPersonelById(Personel.Id); if (oldPersonel.ImageName.ToLower() != "default.jpg" && oldPersonel.ImageName.ToLower() != Personel.ImageName) { System.IO.File.Delete(Server.MapPath("~/Areas/Admin/Images/Profile") + "/" + oldPersonel.ImageName); } bPersonel.Edit(Personel); if (CareInfo != null) { if (CareInfo.Id == 0) { CareInfo.PersonelId = Personel.Id; new B_CarInfo().Add(CareInfo); } else { new B_CarInfo().Edit(CareInfo); } } if (BoothInfo != null) { if (BoothInfo.Id == 0) { BoothInfo.PersonelId = Personel.Id; new B_Booth().Add(BoothInfo); } else { new B_Booth().Edit(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 void Edit(M_BoothInfo BoothInfo) { var db = new DatabaseContext(); db.BoothInfo.Where(c => c.Id == BoothInfo.Id).Load(); db.BoothInfo.Local[0].Address = BoothInfo.Address; db.BoothInfo.Local[0].Capacity = BoothInfo.Capacity; db.BoothInfo.Local[0].Description = BoothInfo.Description; db.BoothInfo.Local[0].ImageName = BoothInfo.ImageName; db.BoothInfo.Local[0].Lat = BoothInfo.Lat; db.BoothInfo.Local[0].Lng = BoothInfo.Lng; db.BoothInfo.Local[0].Name = BoothInfo.Name; db.SaveChanges(); }
private string getMapPupWindow(M_BoothInfo Stations) { var personel = new B_Personels().GetPersonelById(Stations.PersonelId); return($"<table class=\"tbList\" StationId=\"{Stations.Id}\">" + $"<tr style=\"background:#FFF;text-align: center;\">" + $"<td>{Stations.Name}</td>" + $"</tr>" + $"<tr style=\"background:#FFF;text-align: center;\">" + $"<td>{personel.FirstName + " " + personel.LastName}</td>" + $"</tr>" + $"<tr style=\"background:#FFF;text-align: center;\">" + $"<td>ظرفیت : {Stations.Capacity}</td>" + $"</tr>" + $"<tr style=\"background:#FFF;text-align: center;\">" + $"<td><input type=\"button\" class=\"btn btnGreen\" onclick=\"SelectStation({Stations.Id});\" value=\"انتخاب\"/></td>" + $"</tr>" + $"</table>"); }