Exemplo n.º 1
0
        private void Init(SqlTransaction trans, short cityObjectTypeID)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@CityObjectTypeID", SqlDbType.SmallInt);
            prms[0].Value = cityObjectTypeID;

            prms[1]           = new SqlParameter("@CityObjectTypeName", SqlDbType.NVarChar, 25);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@CityObjectTypeShortName", SqlDbType.NVarChar, 25);
            prms[2].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID        = cityObjectTypeID;
            Name      = (string)prms[1].Value;
            ShortName = (string)prms[2].Value;
        }
Exemplo n.º 2
0
        public int Insert(SqlTransaction trans)
        {
            if (!CanInsert(UserName))
            {
                throw new AccessException(UserName, "Insert");
            }

            SqlParameter[] prms = new SqlParameter[13];
            prms[0]           = new SqlParameter("@CitizenID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]       = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50);
            prms[1].Value = FirstName;

            prms[2]       = new SqlParameter("@MiddleName", SqlDbType.NVarChar, 50);
            prms[2].Value = MiddleName;

            prms[3]       = new SqlParameter("@LastName", SqlDbType.NVarChar, 50);
            prms[3].Value = LastName;

            prms[4]       = new SqlParameter("@Address", SqlDbType.NVarChar, 100);
            prms[4].Value = Address;

            prms[5]       = new SqlParameter("@PhoneNumber", SqlDbType.NVarChar, 50);
            prms[5].Value = PhoneNumber;

            prms[6]       = new SqlParameter("@CityObjectID", SqlDbType.Int);
            prms[6].Value = CityObjectID;

            prms[7]       = new SqlParameter("@HouseNumber", SqlDbType.NVarChar, 50);
            prms[7].Value = HouseNumber;

            prms[8]       = new SqlParameter("@Corps", SqlDbType.NVarChar, 50);
            prms[8].Value = Corps;

            prms[9]       = new SqlParameter("@ApartmentNumber", SqlDbType.NVarChar, 50);
            prms[9].Value = ApartmentNumber;

            prms[10]       = new SqlParameter("@Work", SqlDbType.NVarChar, 100);
            prms[10].Value = Work;

            prms[11]       = new SqlParameter("@Sex", SqlDbType.Int);
            prms[11].Value = Sex;

            prms[12]       = new SqlParameter("@SocialStatusID", SqlDbType.Int);
            prms[12].Value = SocialStatusID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Insert, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Insert, prms);
            }

            ID = (int)prms[0].Value;

            return(ID);
        }
Exemplo n.º 3
0
        public int Insert(SqlTransaction trans)
        {
            if (!CanInsert(UserName))
            {
                throw new AccessException(UserName, "Insert");
            }

            SqlParameter[] prms = new SqlParameter[2];
            prms[0]           = new SqlParameter("@QuestionTypeID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            prms[1].Value = Name;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Insert, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Insert, prms);
            }

            ID = (int)prms[0].Value;

            return(ID);
        }
Exemplo n.º 4
0
        public static Guid GetObjectID(SqlTransaction trans, int departmentId)
        {
            SqlParameter[] prms = new SqlParameter[5];
            prms[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[0].Value = departmentId;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@ShortName", SqlDbType.NVarChar, 50);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]           = new SqlParameter("@ObjectID", SqlDbType.UniqueIdentifier);
            prms[3].Direction = ParameterDirection.Output;

            prms[4]           = new SqlParameter("@ParrentDepartmentID", SqlDbType.Int);
            prms[4].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            return((Guid)prms[3].Value);
        }
Exemplo n.º 5
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@SocialCategoryListID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@CitizenID", SqlDbType.Int);
            prms[1].Value = CitizenID;

            prms[2]       = new SqlParameter("@SocialCategoryID", SqlDbType.Int);
            prms[2].Value = SocialCategoryID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 6
0
        public static int GetDepartmentID(SqlTransaction trans, int postId)
        {
            SqlParameter[] prms = new SqlParameter[5];
            prms[0]       = new SqlParameter("@PostID", SqlDbType.Int);
            prms[0].Value = postId;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]           = new SqlParameter("@IsVacant", SqlDbType.Bit);
            prms[3].Direction = ParameterDirection.Output;

            prms[4]           = new SqlParameter("@PostTypeID", SqlDbType.Int);
            prms[4].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(StoredProcedures.GetPost, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, StoredProcedures.GetPost, prms);
            }

            return((int)prms[2].Value);
        }
Exemplo n.º 7
0
        private void Init(SqlTransaction trans, Guid objectID)
        {
            SqlParameter[] prms = new SqlParameter[5];
            prms[0]           = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@ShortName", SqlDbType.NVarChar, 50);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]       = new SqlParameter("@ObjectID", SqlDbType.UniqueIdentifier);
            prms[3].Value = objectID;

            prms[4]           = new SqlParameter("@ParrentDepartmentID", SqlDbType.Int);
            prms[4].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.GetByObjectID, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.GetByObjectID, prms);
            }

            ID                  = (int)prms[0].Value;
            Name                = (string)prms[1].Value;
            ShortName           = (string)prms[2].Value;
            ObjectID            = objectID;
            ParrentDepartmentID = (int)prms[4].Value;
        }
Exemplo n.º 8
0
        public override void Init(SqlTransaction trans, int organizationId)
        {
            base.Init(trans, organizationId);

            SqlParameter[] prms = new SqlParameter[5];
            prms[0]       = new SqlParameter("@OrganizationID", SqlDbType.Int);
            prms[0].Value = organizationId;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@OrganizationTypeID", SqlDbType.Int);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]           = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[3].Direction = ParameterDirection.Output;

            prms[4]           = new SqlParameter("@WorkerID", SqlDbType.Int);
            prms[4].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID   = organizationId;
            Name = (string)prms[1].Value;
            OrganizationTypeID = (int)prms[2].Value;
            DepartmentID       = (int)prms[3].Value;
            WorkerID           = (int)prms[4].Value;
        }
Exemplo n.º 9
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[4];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@CreationDate", SqlDbType.DateTime);
            prms[1].Value = CreationDate;

            prms[2]       = new SqlParameter("@ExternalNumber", SqlDbType.NVarChar, 50);
            prms[2].Value = Number;

            prms[3]       = new SqlParameter("@OrganizationID", SqlDbType.Int);
            prms[3].Value = OrganizationID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 10
0
        public override int Insert(SqlTransaction trans)
        {
            base.Insert(trans);

            SqlParameter[] prms = new SqlParameter[5];
            prms[0]           = new SqlParameter("@OrganizationID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            prms[1].Value = Name;

            prms[2]       = new SqlParameter("@OrganizationTypeID", SqlDbType.Int);
            prms[2].Value = OrganizationTypeID;

            prms[3]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[3].Value = DepartmentID;

            prms[4]       = new SqlParameter("@WorkerID", SqlDbType.Int);
            prms[4].Value = WorkerID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Insert, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Insert, prms);
            }

            ID = (int)prms[0].Value;

            return(ID);
        }
Exemplo n.º 11
0
        public static Organization GetByName(SqlTransaction trans, string name, string userName)
        {
            Organization org = null;

            SqlParameter[] sps = new SqlParameter[3];
            sps[0]           = new SqlParameter("@OrganizationID", SqlDbType.Int);
            sps[0].Direction = ParameterDirection.Output;

            sps[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            sps[1].Value = name;

            sps[2]           = new SqlParameter("@OrganizationTypeID", SqlDbType.Int);
            sps[2].Direction = ParameterDirection.Output;

            SPHelper.ExecuteNonQuery(trans, SpNames.GetByName, sps);
            if (sps[0].Value != DBNull.Value)
            {
                org      = new Organization(userName);
                org.ID   = (int)sps[0].Value;
                org.Name = (string)sps[1].Value;
                org.OrganizationTypeID = (int)sps[2].Value;
            }

            return(org);
        }
Exemplo n.º 12
0
        private void Init(SqlTransaction trans, int branchListId)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@BranchListID", SqlDbType.Int);
            prms[0].Value = branchListId;

            prms[1]           = new SqlParameter("@DocStatementID", SqlDbType.Int);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@BranchTypeID", SqlDbType.Int);
            prms[2].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID             = branchListId;
            DocStatementID = (int)prms[1].Value;
            BranchTypeID   = (int)prms[2].Value;
        }
Exemplo n.º 13
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@BranchListID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@DocStatementID", SqlDbType.Int);
            prms[1].Value = DocStatementID;

            prms[2]       = new SqlParameter("@BranchTypeID", SqlDbType.Int);
            prms[2].Value = BranchTypeID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 14
0
        public static ControlCard GetLastCard(SqlTransaction trans, int documentID, int departmentId, string userName)
        {
            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = documentID;

            prms[1]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[1].Value = departmentId;

            prms[2]           = new SqlParameter("@ControlCardID", SqlDbType.Int);
            prms[2].Direction = ParameterDirection.Output;

            SPHelper.ExecuteNonQuery(trans, SpNames.GetLast, prms);

            int controlCardID = 0;

            if (prms[2].Value != DBNull.Value)
            {
                controlCardID = (int)prms[2].Value;
            }

            if (controlCardID <= 0)
            {
                return(null);
            }

            return(new ControlCard(trans, controlCardID, userName));
        }
Exemplo n.º 15
0
        public static int GetPostID(SqlTransaction trans, int workerId)
        {
            SqlParameter[] prms = new SqlParameter[6];
            prms[0]       = new SqlParameter("@WorkerID", SqlDbType.Int);
            prms[0].Value = workerId;

            prms[1]           = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@MiddleName", SqlDbType.NVarChar, 50);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]           = new SqlParameter("@LastName", SqlDbType.NVarChar, 50);
            prms[3].Direction = ParameterDirection.Output;

            prms[4]           = new SqlParameter("@PostID", SqlDbType.Int);
            prms[4].Direction = ParameterDirection.Output;

            prms[5]           = new SqlParameter("@IsDismissed", SqlDbType.Bit);
            prms[5].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            return((int)prms[4].Value);
        }
Exemplo n.º 16
0
        public static bool IsExist(SqlTransaction trans, int id)
        {
            bool result = false;

            if (id > 0)
            {
                var arParams = new SqlParameter[2];

                arParams[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
                arParams[0].Value = id;

                arParams[1]           = new SqlParameter("@Result", SqlDbType.Bit);
                arParams[1].Direction = ParameterDirection.Output;

                if (trans == null)
                {
                    SPHelper.ExecuteNonQuery(SpNames.IsExist, arParams);
                }
                else
                {
                    SPHelper.ExecuteNonQuery(trans, SpNames.IsExist, arParams);
                }

                if (arParams[1].Value != DBNull.Value)
                {
                    result = (bool)arParams[1].Value;
                }
            }
            return(result);
        }
Exemplo n.º 17
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[5];
            prms[0]       = new SqlParameter("@PostID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, -1);
            prms[1].Value = Name;

            prms[2]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[2].Value = DepartmentID;

            prms[3]       = new SqlParameter("@IsVacant", SqlDbType.Bit);
            prms[3].Value = IsVacant;

            prms[4]       = new SqlParameter("@PostTypeID", SqlDbType.Int);
            prms[4].Value = PostTypeID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(StoredProcedures.UpdatePost, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, StoredProcedures.UpdatePost, prms);
            }
        }
Exemplo n.º 18
0
        private void Init(SqlTransaction trans, int documentId)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[4];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = documentId;

            prms[1]           = new SqlParameter("@CreationDate", SqlDbType.DateTime);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@ExternalNumber", SqlDbType.NVarChar, 50);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]           = new SqlParameter("@OrganizationID", SqlDbType.Int);
            prms[3].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID             = documentId;
            CreationDate   = (DateTime)prms[1].Value;
            Number         = (string)prms[2].Value;
            OrganizationID = (int)prms[3].Value;
        }
Exemplo n.º 19
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@DocumentCodeID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            prms[1].Value = Name;

            prms[2]       = new SqlParameter("@Code", SqlDbType.NVarChar, 50);
            prms[2].Value = Code;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 20
0
        public new static ControlCardBlank GetLastCard(SqlTransaction trans, int documentID, int departmentId, string userName)
        {
            SqlParameter[] arParams = new SqlParameter[3];
            arParams[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            arParams[0].Value = documentID;

            arParams[1]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            arParams[1].Value = departmentId;

            arParams[2]           = new SqlParameter("@ControlCardID", SqlDbType.Int);
            arParams[2].Direction = ParameterDirection.Output;

            SPHelper.ExecuteNonQuery(trans, "usp_ControlCard_GetLast", arParams);

            int controlCardID = 0;

            if (arParams[2].Value != DBNull.Value)
            {
                controlCardID = (int)arParams[2].Value;
            }

            if (controlCardID <= 0)
            {
                return(null);
            }

            return(new ControlCardBlank(trans, controlCardID, userName));
        }
Exemplo n.º 21
0
        public void Update(SqlTransaction trans)
        {
            SqlParameter[] prms = new SqlParameter[5];
            prms[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            prms[1].Value = Name;

            prms[2]       = new SqlParameter("@ShortName", SqlDbType.NVarChar, 50);
            prms[2].Value = ShortName;

            prms[3]       = new SqlParameter("@ObjectID", SqlDbType.UniqueIdentifier);
            prms[3].Value = ObjectID;

            prms[4]       = new SqlParameter("@ParrentDepartmentID", SqlDbType.Int);
            prms[4].Value = ParrentDepartmentID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 22
0
        private void Init(SqlTransaction trans, Guid objectId)
        {
            if (!CanView(UserName, objectId))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[4];
            prms[0]           = new SqlParameter("@MenuTemplateID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 50);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@SystemName", SqlDbType.NVarChar, 50);
            prms[2].Direction = ParameterDirection.Output;

            prms[3]       = new SqlParameter("@ObjectID", SqlDbType.UniqueIdentifier);
            prms[3].Value = objectId;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.GetByObjectID, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.GetByObjectID, prms);
            }

            ID         = (int)prms[0].Value;
            Name       = (string)prms[1].Value;
            SystemName = (string)prms[2].Value;
            ObjectID   = objectId;
        }
Exemplo n.º 23
0
        public int Insert(SqlTransaction trans)
        {
            if (!CanInsert(UserName))
            {
                throw new AccessException(UserName, "Insert");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]           = new SqlParameter("@SocialCategoryListID", SqlDbType.Int);
            prms[0].Direction = ParameterDirection.Output;

            prms[1]       = new SqlParameter("@CitizenID", SqlDbType.Int);
            prms[1].Value = CitizenID;

            prms[2]       = new SqlParameter("@SocialCategoryID", SqlDbType.Int);
            prms[2].Value = SocialCategoryID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Insert, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Insert, prms);
            }

            ID = (int)prms[0].Value;

            return(ID);
        }
Exemplo n.º 24
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName, ObjectID))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[4];
            prms[0]       = new SqlParameter("@MenuTemplateID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@Name", SqlDbType.NVarChar, 50);
            prms[1].Value = Name;

            prms[2]       = new SqlParameter("@SystemName", SqlDbType.NVarChar, 50);
            prms[2].Value = SystemName;

            prms[3]       = new SqlParameter("@ObjectID", SqlDbType.UniqueIdentifier);
            prms[3].Value = ObjectID;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 25
0
        private void Init(SqlTransaction trans, int socialCategoryListID)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@SocialCategoryListID", SqlDbType.Int);
            prms[0].Value = socialCategoryListID;

            prms[1]           = new SqlParameter("@CitizenID", SqlDbType.Int);
            prms[1].Direction = ParameterDirection.Output;

            prms[2]           = new SqlParameter("@SocialCategoryID", SqlDbType.Int);
            prms[2].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID               = socialCategoryListID;
            CitizenID        = (int)prms[1].Value;
            SocialCategoryID = (int)prms[2].Value;
        }
Exemplo n.º 26
0
        public int Insert(SqlTransaction trans)
        {
            if (!CanInsert(this.UserName))
            {
                throw new AccessException(this.UserName, "Insert");
            }

            AccessObject aObject = new AccessObject(ConstantCode.CONNECTION_STRING);

            aObject.Id            = Guid.NewGuid();
            aObject.Name          = this._name;
            aObject.ObjectTypeId  = ObjectTypeID;
            aObject.ObjectStateId = StateIDAll;
            this._objectID        = aObject.Insert(trans);

            string spName = "usp_CityObjects_Insert";
            CityObjectsParamsHelper helper = new CityObjectsParamsHelper(this);

            helper.InitParamsForSP(spName);
            SqlParameter[] parameters = helper.ParamList.Params;
            SPHelper.ExecuteNonQuery(trans, spName, parameters);
            helper.SetPropValues();

            return(this._id);
        }
Exemplo n.º 27
0
        public void Update(SqlTransaction trans)
        {
            if (!CanUpdate(UserName))
            {
                throw new AccessException(UserName, "Update");
            }

            SqlParameter[] prms = new SqlParameter[6];
            prms[0]       = new SqlParameter("@CityObjectID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@CityObjectTypeID", SqlDbType.SmallInt);
            prms[1].Value = TypeID;

            prms[2]       = new SqlParameter("@CityObjectName", SqlDbType.NVarChar, 100);
            prms[2].Value = Name;

            prms[3]       = new SqlParameter("@CityObjectOldName", SqlDbType.NVarChar, 100);
            prms[3].Value = OldName;

            prms[4]       = new SqlParameter("@CityObjectSearchName", SqlDbType.NVarChar, 100);
            prms[4].Value = SearchName;

            prms[5]       = new SqlParameter("@IsReal", SqlDbType.Bit);
            prms[5].Value = IsReal;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 28
0
        public override void Update(SqlTransaction trans)
        {
            base.Update(trans);

            SqlParameter[] prms = new SqlParameter[6];
            prms[0]       = new SqlParameter("@WorkerID", SqlDbType.Int);
            prms[0].Value = ID;

            prms[1]       = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50);
            prms[1].Value = FirstName;

            prms[2]       = new SqlParameter("@MiddleName", SqlDbType.NVarChar, 50);
            prms[2].Value = MiddleName;

            prms[3]       = new SqlParameter("@LastName", SqlDbType.NVarChar, 50);
            prms[3].Value = LastName;

            prms[4]       = new SqlParameter("@PostID", SqlDbType.Int);
            prms[4].Value = PostID;

            prms[5]       = new SqlParameter("@IsDismissed", SqlDbType.Bit);
            prms[5].Value = IsDismissed;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Update, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Update, prms);
            }
        }
Exemplo n.º 29
0
        private void Init(SqlTransaction trans, int questionTypeId)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

            SqlParameter[] prms = new SqlParameter[2];
            prms[0]       = new SqlParameter("@QuestionTypeID", SqlDbType.Int);
            prms[0].Value = questionTypeId;

            prms[1]           = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            prms[1].Direction = ParameterDirection.Output;

            if (trans == null)
            {
                SPHelper.ExecuteNonQuery(SpNames.Get, prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, SpNames.Get, prms);
            }

            ID   = questionTypeId;
            Name = (string)prms[1].Value;
        }
Exemplo n.º 30
0
        public static bool IsExist(SqlTransaction trans, int documentId, int departmentId)
        {
            bool result = false;

            if (documentId > 0)
            {
                var arParams = new SqlParameter[3];

                arParams[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
                arParams[0].Value = documentId;

                arParams[1]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
                arParams[1].Value = departmentId;

                arParams[2]           = new SqlParameter("@Result", SqlDbType.Bit);
                arParams[2].Direction = ParameterDirection.Output;

                SPHelper.ExecuteNonQuery(trans, SpNames.IsExist, arParams);

                if (arParams[2].Value != DBNull.Value)
                {
                    result = (bool)arParams[2].Value;
                }
            }
            return(result);
        }