internal bool Insert(IConnectionHandler connectionHandler1, IConnectionHandler enterpriseNodeconnection, Referee referee, System.Web.HttpPostedFileBase fileBase = null, List <Guid> pivots = null) { var id = referee.Id; BOUtility.GetGuidForId(ref id); referee.Id = id; referee.EnterpriseNode.Id = referee.Id; if (Any(connectionHandler1, x => x.EnterpriseNode.Email == referee.EnterpriseNode.Email && x.CongressId == referee.CongressId)) { throw new Exception(Resources.Congress.RefereeEmailIsRepeat); } if (Any(connectionHandler1, x => x.Username == referee.Username.ToLower() && x.CongressId == referee.CongressId)) { throw new Exception(Resources.Congress.RefereeUserNameIsRepeat); } if (!EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(enterpriseNodeconnection).Insert(referee.EnterpriseNode, fileBase)) { throw new Exception(Resources.Congress.ErrorInSaveReferee); } if (!string.IsNullOrEmpty(referee.Password)) { referee.Password = StringUtils.HashPassword(referee.Password); } if (!base.Insert(connectionHandler1, referee)) { throw new Exception(Resources.Congress.ErrorInSaveReferee); } var refereePivotBo = new RefereePivotBO(); refereePivotBo.Insert(connectionHandler1, referee.Id, pivots); return(true); }
public bool AddFlow(IConnectionHandler connectionHandler, IConnectionHandler filemanagerConnectionHandler, Guid sender, Guid?reciverId, Guid articleId, byte?status = null, string comments = "", HttpPostedFileBase fileBase = null) { var flow = new ArticleFlow { ArticleId = articleId, SenderId = sender, ReceiverId = reciverId, SaveDate = DateTime.Now.ShamsiDate(), SaveTime = DateTime.Now.GetTime(), Remark = comments, Status = status }; if (fileBase != null) { flow.AttachmentFileId = FileManagerComponent.Instance.FileTransactionalFacade(filemanagerConnectionHandler).Insert(fileBase); } var id = flow.Id; BOUtility.GetGuidForId(ref id); flow.Id = id; if (!this.Insert(connectionHandler, flow)) { throw new Exception(Resources.Congress.ErrorInSaveArticleFlow); } return(true); }
public override bool Insert(IConnectionHandler connectionHandler, Resource obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, GroupRegisterDiscount obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, AdvertisementHistory obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(Role obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; return(base.Insert(obj)); }
public override bool Insert(IConnectionHandler connectionHandler, DiscountTypeAutoCode obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, FormStructure structure) { structure.CreateDate = DateTime.Now; var id = structure.Id; BOUtility.GetGuidForId(ref id); structure.Id = id; return(base.Insert(connectionHandler, structure)); }
public override bool Insert(IConnectionHandler connectionHandler, WebSite obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.RegisterDate = DateTime.Now.ShamsiDate(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, DataStructure.Log obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.Date = DateTime.Now; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, ChipsFood obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.BaseCapacity = obj.Capacity; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Menu obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.Url = obj.Url.ToLower(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, DataStructure.Gallery obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.CreateDate = DateTime.Now.ShamsiDate(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, UserRegisterPaymentType obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.BaseCapacity = obj.Capacity; return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, DataStructure.File obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; var da = new FileDA(connectionHandler); return(da.Insert(obj) > 0); }
public override bool Insert(IConnectionHandler connectionHandler, FormData obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.SaveDate = DateTime.Now; obj.RefId = obj.RefId.ToLower(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, ArticleUserComment obj) { Guid id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.SaveDate = DateTime.Now.ShamsiDate(); obj.SaveTime = DateTime.Now.GetTime(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, File obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.SaveDate = DateTime.Now; var da = new FileDA(connectionHandler); return(da.Insert(obj) > 0); }
public bool Insert(VIP vip, HttpPostedFileBase fileResume, HttpPostedFileBase file) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadUncommitted); this.FileManagerConnection.StartTransaction(IsolationLevel.ReadUncommitted); var id = vip.Id; BOUtility.GetGuidForId(ref id); vip.Id = id; vip.EnterpriseNode.Id = vip.Id; if (fileResume != null) { vip.ResumeFileId = FileManagerComponent.Instance.FileTransactionalFacade(this.FileManagerConnection) .Insert(fileResume); } if ( !EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(this.EnterpriseNodeConnection) .Insert(vip.EnterpriseNode, file)) { return(false); } if (!new VIPBO().Insert(this.ConnectionHandler, vip)) { throw new Exception(Resources.Congress.ErrorInSaveSpecialGuest); } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); this.FileManagerConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); this.FileManagerConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public override bool Insert(IConnectionHandler connectionHandler, ChairType obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (string.IsNullOrEmpty(obj.RefId)) { obj.RefId = obj.Id.ToString(); } return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Photo obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (obj.UploadDate == null || string.IsNullOrEmpty(obj.UploadDate.Trim())) { obj.UploadDate = DateTime.Now.ShamsiDate(); } return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Menu obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (obj.Order == 0) { obj.Order = this.GetMaxOrder(connectionHandler) + 1; } return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, User obj) { Guid id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (!string.IsNullOrEmpty(obj.Password)) { obj.Password = StringUtils.HashPassword(obj.Password); } return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Hall obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (!base.Insert(connectionHandler, obj)) { throw new Exception(Resources.Reservation.ErrorInSaveHall); } if (!this.AddNewChairs(connectionHandler, obj)) { throw new Exception(Resources.Reservation.ErrorInSaveHall); } return(true); }
public override bool Insert(IConnectionHandler connectionHandler, Transaction obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.Done = false; if (obj.PayDate == DateTime.MinValue) { obj.PayDate = DateTime.Now; } if (string.IsNullOrEmpty(obj.CallBackUrl)) { throw new Exception(Resources.Payment.ErrorInSaveTransaction); } return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Homa obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (string.IsNullOrEmpty(CongressConfiguration.Key)) { throw new Exception(Resources.Congress.YouCanNotAddNewCongress); } if (!AllowAdd(connectionHandler, ObjectState.New, obj)) { throw new Exception(Resources.Congress.YouCanNotAddNewCongress); } obj.CreateDate = DateTime.Now.ShamsiDate(); return(base.Insert(connectionHandler, obj)); }
public override bool Insert(IConnectionHandler connectionHandler, Supporter obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (obj.Sort == 0) { obj.Sort = (short)(this.Max(connectionHandler, x => x.Sort) + 1); } if (!obj.WebSite.Contains("http") && !obj.WebSite.Contains("https")) { obj.WebSite = "http://" + obj.WebSite; } return(base.Insert(connectionHandler, obj)); }
public override Task <bool> InsertAsync(IConnectionHandler connectionHandler, Author obj) { var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; var exist = base.Any(connectionHandler, x => x.Email.ToLower() == obj.Email.ToLower()); if (exist) { throw new KnownException("کابر دیگری با این ایمیل در سیستم موجود میباشد "); } if (obj.Password != obj.RepeatPassword) { throw new KnownException("رمز عبور و تکرار آن مطابقت ندارند"); } obj.Password = StringUtils.HashPassword(obj.Password); return(base.InsertAsync(connectionHandler, obj)); }
public bool Insert(User obj, HttpPostedFileBase image) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); this.EnterpriseNodeConnection.StartTransaction(IsolationLevel.ReadCommitted); var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; obj.EnterpriseNode.Id = obj.Id; if ( !EnterpriseNodeComponent.Instance.EnterpriseNodeTransactionalFacade(this.EnterpriseNodeConnection) .Insert(obj.EnterpriseNode, image)) { throw new Exception("خطایی در ذخیره اطلاعات کاربری وجود دارد"); } if (!new UserBO().Insert(this.ConnectionHandler, obj)) { throw new Exception("خطایی در ذخیره کاربر وجود دارد"); } this.ConnectionHandler.CommitTransaction(); this.EnterpriseNodeConnection.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); this.EnterpriseNodeConnection.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public override bool Insert(IConnectionHandler connectionHandler, DataStructure.EnterpriseNode obj) { if ((obj.LegalEnterpriseNode != null && obj.RealEnterpriseNode != null) || (obj.LegalEnterpriseNode == null && obj.RealEnterpriseNode == null)) { throw new KnownException("نوع شخص (حقیقی/حقوقی) قابل شناسایی نمی باشد."); } var id = obj.Id; BOUtility.GetGuidForId(ref id); obj.Id = id; if (obj.LegalEnterpriseNode != null) { obj.EnterpriseNodeTypeId = (int)Enums.EnterpriseNodeType.LegalEnterPriseNode; } if (obj.RealEnterpriseNode != null) { obj.EnterpriseNodeTypeId = (int)Enums.EnterpriseNodeType.RealEnterPriseNode; } if (!base.Insert(connectionHandler, obj)) { throw new KnownException("خطا در ثبت اطلاعات شخص"); } if (obj.LegalEnterpriseNode != null) { obj.LegalEnterpriseNode.Id = id; if (!new LegalEnterpriseNodeBO().Insert(connectionHandler, obj.LegalEnterpriseNode)) { throw new KnownException("خطا در ثبت اطلاعات شخص حقوقی"); } } if (obj.RealEnterpriseNode != null) { obj.RealEnterpriseNode.Id = id; if (!new RealEnterpriseNodeBO().Insert(connectionHandler, obj.RealEnterpriseNode)) { throw new KnownException("خطا در ثبت اطلاعات شخص حقیقی"); } } return(true); }