Esempio n. 1
0
        private List <ControlCardBlank> GetChildren(SqlTransaction trans)
        {
            List <ControlCardBlank> cards = new List <ControlCardBlank>();

            DataTable cTable = GetChildren(trans, ID);

            foreach (DataRow row in cTable.Rows)
            {
                int controlCardID     = (int)row["ControlCardID"];
                ControlCardBlank card = new ControlCardBlank(trans, controlCardID, UserName);
                cards.Add(card);
            }

            return(cards);
        }
Esempio n. 2
0
        public new static List <ControlCardBlank> GetWorkerCards(SqlTransaction trans, int documentID, int workerId, string userName)
        {
            List <ControlCardBlank> cards = new List <ControlCardBlank>();

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

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

            DataTable cTable = SPHelper.ExecuteDataset(trans, SpNames.GetWorkerCards, prms).Tables[0];

            foreach (DataRow row in cTable.Rows)
            {
                int controlCardID     = (int)row["ControlCardID"];
                ControlCardBlank card = new ControlCardBlank(trans, controlCardID, userName);
                cards.Add(card);
            }

            return(cards);
        }
Esempio n. 3
0
        private int InsertGroup(SqlTransaction trans, ControlCardBlank controlCardBlank)
        {
            if (!CanInsert(UserName))
            {
                throw new AccessException(UserName, "Insert");
            }

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

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

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

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

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

            prms[5]       = new SqlParameter("@StartDate", SqlDbType.DateTime);
            prms[5].Value = controlCardBlank.StartDate;

            prms[6]       = new SqlParameter("@EndDate", SqlDbType.DateTime);
            prms[6].Value = controlCardBlank.EndDate;

            prms[7] = new SqlParameter("@ControlResponseDate", SqlDbType.DateTime);
            if (controlCardBlank.ControlResponseDate > (DateTime)SqlDateTime.MinValue)
            {
                prms[7].Value = controlCardBlank.ControlResponseDate;
            }
            else
            {
                prms[7].Value = DBNull.Value;
            }
            prms[7].IsNullable = true;

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

            prms[9]       = new SqlParameter("@HeadResponseID", SqlDbType.Int);
            prms[9].Value = controlCardBlank.HeadResponseID;

            prms[10]       = new SqlParameter("@FixedWorkerID", SqlDbType.Int);
            prms[10].Value = controlCardBlank.FixedWorkerID;

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

            prms[12]       = new SqlParameter("@IsSpeciallyControlled", SqlDbType.Bit);
            prms[12].Value = controlCardBlank.IsSpeciallyControlled;

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

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

            prms[15]       = new SqlParameter("@IsDecisionOfSession", SqlDbType.Bit);
            prms[15].Value = controlCardBlank.IsDecisionOfSession;

            prms[16]       = new SqlParameter("@IsDecisionOfExecutiveCommittee", SqlDbType.Bit);
            prms[16].Value = controlCardBlank.IsDecisionOfExecutiveCommittee;

            prms[17]       = new SqlParameter("@IsOrderOfHeader", SqlDbType.Bit);
            prms[17].Value = controlCardBlank.IsOrderOfHeader;

            prms[18]       = new SqlParameter("@IsActionWorkPlan", SqlDbType.Bit);
            prms[18].Value = controlCardBlank.IsActionWorkPlan;

            prms[19]       = new SqlParameter("@IsSendResponse", SqlDbType.Bit);
            prms[19].Value = controlCardBlank.IsSendResponse;

            prms[20]       = new SqlParameter("@IsSendInterimResponse", SqlDbType.Bit);
            prms[20].Value = controlCardBlank.IsSendInterimResponse;

            prms[21]       = new SqlParameter("@IsLeftToWorker", SqlDbType.Bit);
            prms[21].Value = controlCardBlank.IsLeftToWorker;

            prms[22]       = new SqlParameter("@IsAcquaintedWorker", SqlDbType.Bit);
            prms[22].Value = controlCardBlank.IsAcquaintedWorker;

            prms[23]       = new SqlParameter("@ExecutiveDepartmentID", SqlDbType.Int);
            prms[23].Value = controlCardBlank.ExecutiveDepartmentID;

            prms[24]       = new SqlParameter("@IsContinuation", SqlDbType.Bit);
            prms[24].Value = controlCardBlank.IsContinuation;

            prms[25]            = new SqlParameter("@ParentControlCardID", SqlDbType.Int);
            prms[25].IsNullable = true;
            if (controlCardBlank.ParentControlCardID > 0)
            {
                prms[25].Value = controlCardBlank.ParentControlCardID;
            }
            else
            {
                prms[25].Value = DBNull.Value;
            }

            prms[26]       = new SqlParameter("@InnerNumber", SqlDbType.NVarChar, 50);
            prms[26].Value = controlCardBlank.InnerNumber;

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

            prms[28]            = new SqlParameter("@GroupID", SqlDbType.Int);
            prms[28].Direction  = ParameterDirection.InputOutput;
            prms[28].IsNullable = true;
            if (GroupID > 0)
            {
                prms[28].Value = GroupID;
            }
            else
            {
                prms[28].Value = DBNull.Value;
            }


            if (trans == null)
            {
                SPHelper.ExecuteNonQuery("usp_ControlCard_InsertGroup", prms);
            }
            else
            {
                SPHelper.ExecuteNonQuery(trans, "usp_ControlCard_InsertGroup", prms);
            }

            ID = (int)prms[0].Value;
            if (prms[28].Value != DBNull.Value)
            {
                GroupID = (int?)prms[28].Value;
            }

            return(ID);
        }