예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #5
0
        public override bool Insert(IConnectionHandler connectionHandler, AdvertisementHistory obj)
        {
            var id = obj.Id;

            BOUtility.GetGuidForId(ref id);
            obj.Id = id;
            return(base.Insert(connectionHandler, obj));
        }
예제 #6
0
        public override bool Insert(Role obj)
        {
            var id = obj.Id;

            BOUtility.GetGuidForId(ref id);
            obj.Id = id;
            return(base.Insert(obj));
        }
예제 #7
0
        public override bool Insert(IConnectionHandler connectionHandler, DiscountTypeAutoCode obj)
        {
            var id = obj.Id;

            BOUtility.GetGuidForId(ref id);
            obj.Id = id;
            return(base.Insert(connectionHandler, obj));
        }
예제 #8
0
        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));
        }
예제 #9
0
        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));
        }
예제 #10
0
        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));
        }
예제 #11
0
        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));
        }
예제 #12
0
        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));
        }
예제 #13
0
        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));
        }
예제 #14
0
        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));
        }
예제 #15
0
        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);
        }
예제 #16
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));
        }
예제 #17
0
        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));
        }
예제 #18
0
        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);
        }
예제 #19
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);
            }
        }
예제 #20
0
        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));
        }
예제 #21
0
        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));
        }
예제 #22
0
        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));
        }
예제 #23
0
        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));
        }
예제 #24
0
        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);
        }
예제 #25
0
        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));
        }
예제 #26
0
        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));
        }
예제 #27
0
        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));
        }
예제 #28
0
        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));
        }
예제 #29
0
        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);
            }
        }
예제 #30
0
        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);
        }