public void Add(Guid key, DataStructure.EnterpriseNode obj) { if (base[key.ToString()] == null) { base.Add(key.ToString(), obj); } }
public ActionResult CreateEnterPriseNode() { var enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode { RealEnterpriseNode = new RealEnterpriseNode(), LegalEnterpriseNode = new LegalEnterpriseNode() }; var name = Request.QueryString["name"]; if (!string.IsNullOrEmpty(name)) { if (enterpriseNode.RealEnterpriseNode != null) { enterpriseNode.RealEnterpriseNode.FirstName = name; } else { enterpriseNode.LegalEnterpriseNode.Title = name; } } var family = Request.QueryString["family"]; if (!string.IsNullOrEmpty(family)) { if (enterpriseNode.RealEnterpriseNode != null) { enterpriseNode.RealEnterpriseNode.LastName = family; } else { enterpriseNode.LegalEnterpriseNode.RegisterNo = name; } } var nationalId = Request.QueryString["nid"]; if (!string.IsNullOrEmpty(nationalId)) { if (enterpriseNode.RealEnterpriseNode != null) { enterpriseNode.RealEnterpriseNode.NationalCode = nationalId; } else { enterpriseNode.LegalEnterpriseNode.NationalId = nationalId; } } var etype = Request.QueryString["Etype"]; if (!string.IsNullOrEmpty(etype)) { enterpriseNode.EnterpriseNodeTypeId = (etype == "R" ? (byte)Radyn.EnterpriseNode.Tools.Enums.EnterpriseNodeType.RealEnterPriseNode : (byte)Radyn.EnterpriseNode.Tools.Enums.EnterpriseNodeType.LegalEnterPriseNode); } return(View(enterpriseNode)); }
public ActionResult GenerateEnterpriseNodeModify(string state, Guid id, string type = "n", bool ShowParent = false, bool ShowPicture = true, Guid?ParentId = null) { var objectState = state.ToEnum <Radyn.Common.Definition.ObjectState>(); ViewBag.EnterpriseNodeType = new SelectList(EnterpriseNodeComponent.Instance.EnterpriseNodeTypeFacade.GetAll(), "Id", "Title"); Radyn.EnterpriseNode.DataStructure.EnterpriseNode enterpriseNode = null; ViewBag.PrefixTitleList = new SelectList(EnterpriseNodeComponent.Instance.PrefixTitleFacade.GetAll(), "Id", "DescriptionField"); switch (objectState) { case Radyn.Common.Definition.ObjectState.Create: enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); if (ParentId != null) { enterpriseNode.EnterpriseNodeParentId = ParentId; } break; case Radyn.Common.Definition.ObjectState.Edit: enterpriseNode = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Get(id); break; case Radyn.Common.Definition.ObjectState.Details: enterpriseNode = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Get(id); break; case Radyn.Common.Definition.ObjectState.Delete: enterpriseNode = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Get(id); break; case Radyn.Common.Definition.ObjectState.List: break; default: throw new ArgumentOutOfRangeException("state"); } ViewBag.Type = type; ViewBag.ShowParent = ShowParent; ViewBag.ShowPicture = ShowPicture; ViewBag.State = state; if (state == "Delete" || state == "Details") { return(PartialView("EnterpriseNodeDetails", enterpriseNode)); } return(PartialView("EnterpriseNodeModify", enterpriseNode)); }
public ActionResult CreateEnterPriseNode(FormCollection collection) { try { var enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode, collection); var type = collection["type"]; if (string.IsNullOrEmpty(collection["EnterpriseNodeTypeId"])) { if (string.IsNullOrEmpty(type)) { return(null); } enterpriseNode.EnterpriseNodeTypeId = type == "r" ? 1 : 2; } else { enterpriseNode.EnterpriseNodeTypeId = collection["EnterpriseNodeTypeId"].ToInt(); } if (enterpriseNode.EnterpriseNodeTypeId == 1) { enterpriseNode.RealEnterpriseNode = new RealEnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode.RealEnterpriseNode, collection); } else if (enterpriseNode.EnterpriseNodeTypeId == 2) { enterpriseNode.LegalEnterpriseNode = new LegalEnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode.LegalEnterpriseNode, collection); } var file = Session["Image"]; if (EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Insert(enterpriseNode, (HttpPostedFileBase)file)) { object obj = new { id = enterpriseNode.Id, title = enterpriseNode.Title() }; return(Json(obj, JsonRequestBehavior.AllowGet)); } return(null); } catch (Exception ex) { ShowExceptionMessage(ex); return(null); } }
public ActionResult GenerateEnterpriseNodeDetails(string state, Guid id, string type = "n") { try { var objectState = state.ToEnum <Radyn.Common.Definition.ObjectState>(); Radyn.EnterpriseNode.DataStructure.EnterpriseNode enterpriseNode = null; switch (objectState) { case Radyn.Common.Definition.ObjectState.Create: enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); break; case Radyn.Common.Definition.ObjectState.Edit: break; case Radyn.Common.Definition.ObjectState.Details: enterpriseNode = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Get(id); break; case Radyn.Common.Definition.ObjectState.Delete: enterpriseNode = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Get(id); break; case Radyn.Common.Definition.ObjectState.List: break; default: throw new ArgumentOutOfRangeException("state"); } ViewBag.Type = type; ViewBag.State = state; return(PartialView("EnterpriseNodeDetails", enterpriseNode)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Create(FormCollection collection) { var enterprise = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); try { this.RadynTryUpdateModel(enterprise); HttpPostedFileBase file = null; if (Session["Image"] != null) { file = (HttpPostedFileBase)Session["Image"]; Session.Remove("Image"); } switch (enterprise.EnterpriseNodeTypeId) { case 1: enterprise.RealEnterpriseNode = new RealEnterpriseNode(); this.RadynTryUpdateModel(enterprise.RealEnterpriseNode); break; case 2: enterprise.LegalEnterpriseNode = new LegalEnterpriseNode(); this.RadynTryUpdateModel(enterprise.LegalEnterpriseNode); break; } if (EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Insert(enterprise, file)) { ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed); return(RedirectToAction("Index")); } return(View(enterprise)); } catch (Exception exception) { ShowExceptionMessage(exception); return(View(enterprise)); } }
public JsonResult SearchEn(FormCollection collection) { var filter = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); switch (collection["state"]) { case "a": filter.LegalEnterpriseNode = new LegalEnterpriseNode { Title = collection["title"] }; filter.RealEnterpriseNode = new RealEnterpriseNode() { FirstName = collection["title"], LastName = collection["title"] }; ViewBag.Title = collection["title"]; break; case "s": var type = collection["type"]; if (!string.IsNullOrEmpty(type)) { switch (type) { case "r": filter.EnterpriseNodeTypeId = 1; filter.RealEnterpriseNode = new RealEnterpriseNode { FirstName = collection["fname"].Trim(), LastName = collection["lname"].Trim(), NationalCode = collection["nationalId"].Trim() }; break; case "l": filter.EnterpriseNodeTypeId = 2; filter.LegalEnterpriseNode = new LegalEnterpriseNode { Title = collection["legalTitle"].Trim(), NationalId = collection["nationalCode"].Trim(), RegisterNo = collection["registerNo"].Trim() }; break; } } break; } var result = new List <object> { new { id = "", title = "عنوان", type = "نوع شخص", nationalCode = "كد/شناسه ملي", registerNo = "شماره شناسنامه/ شماره ثبت" } }; try { var enterpriseNodes = EnterpriseNodeComponent.Instance.EnterpriseNodeFacade.Search(filter).ToList(); if (enterpriseNodes.Any()) { foreach (var node in enterpriseNodes) { result.Add(new { id = node.Id.ToString(), title = node.Title(), type = node.EnterpriseNodeTypeId == 1 ? "حقيقي" : "حقوقي", nationalCode = node.LegalEnterpriseNode != null ? node.LegalEnterpriseNode.NationalId : node.RealEnterpriseNode.NationalCode, registerNo = node.LegalEnterpriseNode != null ? node.LegalEnterpriseNode.RegisterNo : node.RealEnterpriseNode.IDNumber }); } } else { var messageText = string.Format("{0}<br/><br/><a href='{2}'><font color='green'>{1}</font></a>", Resources.Common.No_results_found, Resources.EnterPriseNode.DeclareNewEnterprisenode, string.Format( "/EnterpriseNode/EnterpriseNode/CreateEnterPriseNode?Etype={0}&name={1}&family={2}&nid={3}", (collection["type"]), (filter.RealEnterpriseNode != null ? filter.RealEnterpriseNode.FirstName : filter.LegalEnterpriseNode.Title), (filter.RealEnterpriseNode != null ? filter.RealEnterpriseNode.LastName : filter.LegalEnterpriseNode.RegisterNo), (filter.RealEnterpriseNode != null ? filter.RealEnterpriseNode.NationalCode : filter.LegalEnterpriseNode.NationalId))); ShowMessage(messageText, Resources.Common.Search, new[] { Resources.Common.Cancel, "" }); } } catch { } return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Validate(FormCollection collection) { var messageStack = new List <string>(); var Id = collection["Id"].ToGuid(); var user = new User(); var enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode { RealEnterpriseNode = new RealEnterpriseNode() }; this.RadynTryUpdateModel(user); this.RadynTryUpdateModel(enterpriseNode); this.RadynTryUpdateModel(enterpriseNode.RealEnterpriseNode); if (string.IsNullOrEmpty(user.Username)) { messageStack.Add(Resources.Congress.PleaseInsertUserName); } if (Id == Guid.Empty) { if (string.IsNullOrEmpty(user.Password)) { messageStack.Add(Resources.Congress.Please_Enter_Password); } if (string.IsNullOrEmpty(collection["RepeatPassword"])) { messageStack.Add(Resources.Congress.Please_Enter_Password_Repeat); } else if (!string.IsNullOrEmpty(user.Password) && !string.IsNullOrEmpty(collection["RepeatPassword"])) { if (user.Password != collection["RepeatPassword"]) { messageStack.Add(Resources.Congress.Password_and_Repeat_Not_Equal); } } } else { if (!string.IsNullOrEmpty(user.Password)) { if (string.IsNullOrEmpty(collection["RepeatPassword"])) { messageStack.Add(Resources.Congress.Please_Enter_Password_Repeat); } else if (!string.IsNullOrEmpty(user.Password) && !string.IsNullOrEmpty(collection["RepeatPassword"])) { if (user.Password != collection["RepeatPassword"]) { messageStack.Add(Resources.Congress.Password_and_Repeat_Not_Equal); } } } } if (user.Password != null && !string.IsNullOrEmpty(user.Password) && user.Password.Length < 6) { messageStack.Add(Resources.Congress.MinimumPasswordCharacter); } var list = new List <Guid>(); var firstOrDefault = collection.AllKeys.FirstOrDefault(s => s.Equals("SelectedCongress")); if (!string.IsNullOrEmpty(firstOrDefault)) { var strings = collection[firstOrDefault].Split(','); foreach (var s in strings) { if (string.IsNullOrEmpty(s)) { continue; } list.Add(s.ToGuid()); } } if (!list.Any()) { messageStack.Add("لطفا همایشی را انتخاب کنید"); } var messageBody = messageStack.Aggregate("", (current, item) => current + Tag.Li(item)); if (messageBody != "") { ShowMessage(messageBody, Resources.Common.Attantion, messageIcon: MessageIcon.Warning); return(Content("false")); } return(Content("true")); }
public ActionResult RegisterGuest(FormCollection collection) { try { var messageStack = new List <string>(); var enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode); HttpPostedFileBase file = null; if (Session["Image"] != null) { file = (HttpPostedFileBase)Session["Image"]; Session.Remove("Image"); } switch (enterpriseNode.EnterpriseNodeTypeId) { case 1: enterpriseNode.RealEnterpriseNode = new RealEnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode.RealEnterpriseNode); if (string.IsNullOrEmpty(enterpriseNode.RealEnterpriseNode.FirstName)) { messageStack.Add(Resources.Congress.Please_Enter_YourName); } if (string.IsNullOrEmpty(enterpriseNode.RealEnterpriseNode.LastName)) { messageStack.Add(Resources.Congress.Please_Enter_YourLastName); } if (string.IsNullOrEmpty(enterpriseNode.Cellphone)) { messageStack.Add(Resources.Congress.Please_Enter_YourMobile); } if (enterpriseNode.RealEnterpriseNode.Gender == null) { messageStack.Add(Resources.Congress.Please_Enter_YourGender); } if (string.IsNullOrEmpty(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.PleaseEnterYourEmail); } else { if (!Utils.IsEmail(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.UnValid_Enter_Email); } } break; case 2: enterpriseNode.LegalEnterpriseNode = new LegalEnterpriseNode(); this.RadynTryUpdateModel(enterpriseNode.LegalEnterpriseNode); if (string.IsNullOrEmpty(enterpriseNode.Cellphone)) { messageStack.Add(Resources.Congress.Please_Enter_YourMobile); } if (string.IsNullOrEmpty(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.PleaseEnterYourEmail); } else { if (!Utils.IsEmail(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.UnValid_Enter_Email); } } break; } var listboothId = new List <Guid>(); foreach (var key in collection.AllKeys.Where(s => s.StartsWith("CheckSelect-"))) { if (string.IsNullOrEmpty(collection[key])) { continue; } listboothId.Add(collection[key].ToGuid()); } var config = this.Homa.Configuration; if (listboothId.Count == 0) { messageStack.Add(Resources.Congress.NoSelectedBoothItem); } var transactionDiscountAttaches = Payment.Tools.AppExtentions.FillTransactionDiscount(collection); if (transactionDiscountAttaches.Count > config.DisscountCount) { messageStack.Add(Resources.Congress.YouCanNotUseDiscoutOverThanMax + Tag.NewLine + Resources.Congress.DiscountCount + config.DisscountCount); } var postFormData = this.PostForFormGenerator(collection); if (!string.IsNullOrEmpty(postFormData.FillErrors)) { messageStack.Add(postFormData.FillErrors); } var messageBody = messageStack.Aggregate("", (current, item) => current + Tag.Li(item)); if (messageBody != "") { ShowMessage(messageBody, Resources.Common.Attantion, messageIcon: MessageIcon.Warning); return(View()); } var insertGuest = CongressComponent.Instance.BaseInfoComponents.UserBoothFacade.InsertGuest(enterpriseNode, listboothId, file, transactionDiscountAttaches, "/Congress/Guest/UpdateStatusAfterTransaction?Id=", postFormData, this.Homa.Id); if (insertGuest.Key) { Session.Remove("BoothOfficers"); if (insertGuest.Value != Guid.Empty) { return(Redirect("~" + Extentions.PrepaymenyUrl(insertGuest.Value))); } ShowMessage(Resources.Common.InsertSuccessMessage, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Succeed); return(Redirect("~/Congress/Guest/ReservDetail?Id=" + enterpriseNode.Id)); } ShowMessage(Resources.Common.ErrorInInsert, Resources.Common.MessaageTitle, messageIcon: MessageIcon.Error); return(View()); } catch (Exception exception) { ShowExceptionMessage(exception); return(View()); } }
public ActionResult Validate(FormCollection collection) { var messageStack = new List <string>(); var Id = collection["Id"].ToGuid(); var user = new User(); var enterpriseNode = new Radyn.EnterpriseNode.DataStructure.EnterpriseNode { RealEnterpriseNode = new RealEnterpriseNode() }; this.RadynTryUpdateModel(user); this.RadynTryUpdateModel(enterpriseNode); this.RadynTryUpdateModel(enterpriseNode.RealEnterpriseNode); if (Id == Guid.Empty) { if (string.IsNullOrEmpty(user.Password)) { messageStack.Add(Resources.Congress.Please_Enter_Password); } if (string.IsNullOrEmpty(collection["RepeatPassword"])) { messageStack.Add(Resources.Congress.Please_Enter_Password_Repeat); } else if (!string.IsNullOrEmpty(user.Password) && !string.IsNullOrEmpty(collection["RepeatPassword"])) { if (user.Password != collection["RepeatPassword"]) { messageStack.Add(Resources.Congress.Password_and_Repeat_Not_Equal); } } } else { if (!string.IsNullOrEmpty(user.Password)) { if (string.IsNullOrEmpty(collection["RepeatPassword"])) { messageStack.Add(Resources.Congress.Please_Enter_Password_Repeat); } else if (!string.IsNullOrEmpty(user.Password) && !string.IsNullOrEmpty(collection["RepeatPassword"])) { if (user.Password != collection["RepeatPassword"]) { messageStack.Add(Resources.Congress.Password_and_Repeat_Not_Equal); } } } } if (user.Password != null && !string.IsNullOrEmpty(user.Password) && user.Password.Length < 6) { messageStack.Add(Resources.Congress.MinimumPasswordCharacter); } if (string.IsNullOrEmpty(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.PleaseEnterYourEmail); } else { if (!Utility.Utils.IsEmail(enterpriseNode.Email)) { messageStack.Add(Resources.Congress.UnValid_Enter_Email); } } if (string.IsNullOrEmpty(user.Username)) { messageStack.Add(Resources.Congress.PleaseInsertUserName); } if (string.IsNullOrEmpty(enterpriseNode.RealEnterpriseNode.FirstName)) { messageStack.Add(Resources.Congress.Please_Enter_YourName); } if (string.IsNullOrEmpty(enterpriseNode.RealEnterpriseNode.LastName)) { messageStack.Add(Resources.Congress.Please_Enter_YourLastName); } if (string.IsNullOrEmpty(enterpriseNode.Cellphone)) { messageStack.Add(Resources.Congress.Please_Enter_YourMobile); } else { if (!string.IsNullOrEmpty(enterpriseNode.Cellphone) && ((!enterpriseNode.Cellphone.StartsWith("09") && !enterpriseNode.Cellphone.StartsWith("+") && !enterpriseNode.Cellphone.StartsWith("00")) || ((enterpriseNode.Cellphone.Length < 11) && (enterpriseNode.Cellphone.Length > 15)) || enterpriseNode.Cellphone.ToLong() == 0)) { messageStack.Add(Resources.Congress.MobileNumberIsNotValid); } } if (enterpriseNode.RealEnterpriseNode.Gender == null) { messageStack.Add(Resources.Congress.Please_Enter_YourGender); } if (!string.IsNullOrEmpty(enterpriseNode.RealEnterpriseNode.NationalCode) && !Radyn.Utility.Utils.ValidNationalID(enterpriseNode.RealEnterpriseNode.NationalCode)) { messageStack.Add(Resources.Congress.PleaseEnterRightNationalCode); } var postFormData = this.PostForFormGenerator(collection); if (!string.IsNullOrEmpty(postFormData.FillErrors)) { ShowMessage(postFormData.FillErrors, Resources.Common.Attantion, messageIcon: MessageIcon.Warning); return(Content("false")); } var messageBody = messageStack.Aggregate("", (current, item) => current + Tag.Li(item)); if (messageBody != "") { ShowMessage(messageBody, Resources.Common.Attantion, messageIcon: MessageIcon.Warning); return(Content("false")); } return(Content("true")); }