Ejemplo n.º 1
0
        public static DataSet SearchCode(SqlTransaction trans, string name, int departmentId, int templateId)
        {
            SqlParameter[] sps = new SqlParameter[3];
            sps[0]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            sps[0].Value = name;

            sps[1] = new SqlParameter("@DepartmentID", SqlDbType.Int);
            if (departmentId <= 0)
            {
                sps[1].Value = DBNull.Value;
            }
            else
            {
                sps[1].Value = departmentId;
            }

            sps[2] = new SqlParameter("@TemplateID", SqlDbType.Int);
            if (templateId <= 0)
            {
                sps[2].Value = DBNull.Value;
            }
            else
            {
                sps[2].Value = templateId;
            }

            return(SPHelper.ExecuteDataset(trans, SpNames.SearchCode, sps));
        }
Ejemplo n.º 2
0
        public static DataTable GetPage(SqlTransaction trans, PageSettings pageSettings, string userName, int departmentID)
        {
            SqlParameter[] sps = new SqlParameter[5];
            sps[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[0].Value = departmentID;

            sps[1]       = new SqlParameter("@LastName", SqlDbType.NVarChar, 50);
            sps[1].Value = pageSettings.Where.HasRule("LastName")
                                ? pageSettings.Where.GetRule("LastName").Data
                                : String.Empty;

            sps[2]       = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50);
            sps[2].Value = pageSettings.Where.HasRule("FirstName")
                                ? pageSettings.Where.GetRule("FirstName").Data
                                : String.Empty;

            sps[3]       = new SqlParameter("@MiddleName", SqlDbType.NVarChar, 50);
            sps[3].Value = pageSettings.Where.HasRule("MiddleName")
                                ? pageSettings.Where.GetRule("MiddleName").Data
                                : String.Empty;

            sps[4]       = new SqlParameter("@PostName", SqlDbType.NVarChar, 256);
            sps[4].Value = pageSettings.Where.HasRule("PostName")
                                ? pageSettings.Where.GetRule("PostName").Data
                                : String.Empty;

            DataTable dt = SPHelper.ExecuteDataset(trans, "usp_Worker_List", sps).Tables[0];

            pageSettings.TotalRecords = dt.Rows.Count;

            return(dt);
        }
Ejemplo n.º 3
0
        public static List <Department> GetList(SqlTransaction trans, string userName)
        {
            /*if (!CanView(userName))
             * {
             *  throw new AccessException(userName, "Get list");
             * }*/
            List <Department> dl = new List <Department>();
            DataTable         dt;

            if (trans == null)
            {
                dt = SPHelper.ExecuteDataset("usp_Department_List").Tables[0];
            }
            else
            {
                dt = SPHelper.ExecuteDataset(trans, "usp_Department_List").Tables[0];
            }

            foreach (DataRow dr in dt.Rows)
            {
                Department department = new Department(userName);
                department.ID        = (int)dr["DepartmentID"];
                department.Name      = (string)dr["Name"];
                department.ShortName = (string)dr["ShortName"];
                department.ObjectID  = (Guid)dr["ObjectID"];

                dl.Add(department);
            }

            return(dl);
        }
Ejemplo n.º 4
0
        public static DataSet Search(SqlTransaction trans, string organizationName, int organizationTypeID, int departmentId)
        {
            SqlParameter[] sps = new SqlParameter[3];
            sps[0]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            sps[0].Value = organizationName;

            sps[1] = new SqlParameter("@OrganizationTypeID", SqlDbType.Int);
            if (organizationTypeID > 0)
            {
                sps[1].Value = organizationTypeID;
            }
            else
            {
                sps[1].Value = DBNull.Value;
            }

            sps[2] = new SqlParameter("@DepartmentID", SqlDbType.Int);
            if (departmentId > 0)
            {
                sps[2].Value = departmentId;
            }
            else
            {
                sps[2].Value = DBNull.Value;
            }

            if (trans == null)
            {
                return(SPHelper.ExecuteDataset(SpNames.Search, sps));
            }
            return(SPHelper.ExecuteDataset(trans, SpNames.Search, sps));
        }
Ejemplo n.º 5
0
        public static DataSet GetControlled(SqlTransaction trans, int departmentID, DateTime creationDate, DateTime endDate)
        {
            SqlParameter[] sps = new SqlParameter[3];

            sps[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[0].Value = departmentID;

            sps[1] = new SqlParameter("@CreationDate", SqlDbType.DateTime);
            if (creationDate >= SqlDateTime.MinValue && creationDate <= SqlDateTime.MaxValue)
            {
                sps[1].Value = creationDate;
            }
            else
            {
                sps[1].Value = SqlDateTime.MinValue;
            }

            sps[2] = new SqlParameter("@EndDate", SqlDbType.DateTime);
            if (endDate >= SqlDateTime.MinValue && endDate <= SqlDateTime.MaxValue)
            {
                sps[2].Value = endDate;
            }
            else
            {
                sps[2].Value = SqlDateTime.MaxValue;
            }

            return(SPHelper.ExecuteDataset(trans, "usp_DocStatement_GetControlled", sps));
        }
Ejemplo n.º 6
0
        public static DataTable GetReplayPage(SqlTransaction trans, PageSettings pageSettings, Guid userId, int parentDocumentId)
        {
            SqlParameter[] sps = new SqlParameter[6];
            sps[0]       = new SqlParameter("@PageIndex", SqlDbType.Int);
            sps[0].Value = pageSettings.PageIndex;

            sps[1]       = new SqlParameter("@SortColumnName", SqlDbType.VarChar, 50);
            sps[1].Value = pageSettings.SortColumn;

            sps[2]       = new SqlParameter("@SortOrderBy", SqlDbType.VarChar, 4);
            sps[2].Value = pageSettings.SortOrder;

            sps[3]       = new SqlParameter("@NumberOfRows", SqlDbType.Int);
            sps[3].Value = pageSettings.PageSize;

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

            sps[5]       = new SqlParameter("@ParentDocumentID", SqlDbType.Int);
            sps[5].Value = parentDocumentId;

            DataTable dt = SPHelper.ExecuteDataset(trans, SpNames.ReplayPage, sps).Tables[0];

            pageSettings.TotalRecords = sps[4].Value != DBNull.Value ? Convert.ToInt32(sps[4].Value) : 0;

            return(dt);
        }
Ejemplo n.º 7
0
        public static DataSet GetStatisticsByBranchType(SqlTransaction trans, int departmentID, DateTime startDate, DateTime endDate, int branchTypeID)
        {
            SqlParameter[] sps = new SqlParameter[4];

            sps[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[0].Value = departmentID;

            sps[1] = new SqlParameter("@StartDate", SqlDbType.DateTime);
            if (startDate >= SqlDateTime.MinValue && startDate <= SqlDateTime.MaxValue)
            {
                sps[1].Value = startDate;
            }
            else
            {
                sps[1].Value = SqlDateTime.MinValue;
            }

            sps[2] = new SqlParameter("@EndDate", SqlDbType.DateTime);
            if (endDate >= SqlDateTime.MinValue && endDate <= SqlDateTime.MaxValue)
            {
                sps[2].Value = endDate;
            }
            else
            {
                sps[2].Value = SqlDateTime.MaxValue;
            }

            sps[3]       = new SqlParameter("@BranchTypeID", SqlDbType.Int);
            sps[3].Value = branchTypeID;

            return(SPHelper.ExecuteDataset(trans, "usp_DocStatement_GetStatisticsByBranchType", sps));
        }
Ejemplo n.º 8
0
        public static List <DocumentComment> GetList(int documentId)
        {
            List <DocumentComment> comments = new List <DocumentComment>();

            DataTable dcTable = SPHelper.ExecuteDataset(SpNames.List, documentId).Tables[0];

            foreach (DataRow row in dcTable.Rows)
            {
                DocumentComment comment = new DocumentComment();
                comment.ID                      = (int)row["DocumentCommentID"];
                comment.DocumentID              = (int)row["DocumentID"];
                comment.WorkerID                = (int)row["WorkerID"];
                comment.BehalfWorkerID          = (int)row["BehalfWorkerID"];
                comment.Content                 = row["Content"].ToString();
                comment.DocumentCommentTypeID   = (int)row["DocumentCommentTypeID"];
                comment.ControlCardID           = row["ControlCardID"] == DBNull.Value ? null : (int?)row["ControlCardID"];
                comment.ParentDocumentCommentID = row["ParentDocumentCommentID"] == DBNull.Value ? null : (int?)row["ParentDocumentCommentID"];
                comment.CreateDate              = (DateTime)row["CreateDate"];
                comment.LastUpdateDate          = (DateTime)row["LastUpdateDate"];
                Worker worker = new Worker();
                worker.ID         = comment.WorkerID;
                worker.FirstName  = row["WorkerFirstName"].ToString();
                worker.LastName   = row["WorkerLastName"].ToString();
                worker.MiddleName = row["WorkerMiddleName"].ToString();
                comment.Worker    = worker;
                comments.Add(comment);
            }

            return(comments);
        }
Ejemplo n.º 9
0
        public static DataTable FindCard(SqlTransaction trans, int documentID, int?cardStatusID, bool?isSpeciallyControlled)
        {
            SqlParameter[] prms = new SqlParameter[3];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = documentID;
            prms[1]       = new SqlParameter("@CardStatusID", SqlDbType.Int);
            if (cardStatusID != null)
            {
                prms[1].Value = cardStatusID;
            }
            else
            {
                prms[1].Value = DBNull.Value;
            }
            prms[2] = new SqlParameter("@IsSpeciallyControlled", SqlDbType.Int);
            if (isSpeciallyControlled != null)
            {
                prms[2].Value = isSpeciallyControlled;
            }
            else
            {
                prms[2].Value = DBNull.Value;
            }

            return(SPHelper.ExecuteDataset(trans, SpNames.Find, prms).Tables[0]);
        }
Ejemplo n.º 10
0
        public static List <MenuTemplate> GetList(SqlTransaction trans, string userName)
        {
            /*if (!CanView(userName))
             * {
             *  throw new AccessException(userName, "Get list");
             * }*/
            List <MenuTemplate> dl = new List <MenuTemplate>();
            DataTable           dt;

            if (trans == null)
            {
                dt = SPHelper.ExecuteDataset(SpNames.List).Tables[0];
            }
            else
            {
                dt = SPHelper.ExecuteDataset(trans, SpNames.List).Tables[0];
            }

            foreach (DataRow dr in dt.Rows)
            {
                MenuTemplate menuTemplate = new MenuTemplate(userName);
                menuTemplate.ID         = (int)dr["MenuTemplateID"];
                menuTemplate.Name       = (string)dr["Name"];
                menuTemplate.SystemName = (string)dr["SystemName"];
                menuTemplate.ObjectID   = (Guid)dr["ObjectID"];

                dl.Add(menuTemplate);
            }

            return(dl);
        }
Ejemplo n.º 11
0
 public static DataTable GetList(SqlTransaction trans, int docStatementID)
 {
     if (trans == null)
     {
         return(SPHelper.ExecuteDataset(SpNames.List, docStatementID).Tables[0]);
     }
     return(SPHelper.ExecuteDataset(trans, SpNames.List, docStatementID).Tables[0]);
 }
Ejemplo n.º 12
0
        public static DataTable GetChildren(SqlTransaction trans, int controlCardID)
        {
            SqlParameter[] prms = new SqlParameter[1];
            prms[0]       = new SqlParameter("@ControlCardID", SqlDbType.Int);
            prms[0].Value = controlCardID;

            return(SPHelper.ExecuteDataset(trans, SpNames.Children, prms).Tables[0]);
        }
Ejemplo n.º 13
0
        public static DataSet Search(SqlTransaction trans, string organizationName)
        {
            SqlParameter[] sps = new SqlParameter[1];
            sps[0]       = new SqlParameter("@Name", SqlDbType.NVarChar, 100);
            sps[0].Value = organizationName;

            return(SPHelper.ExecuteDataset(trans, SpNames.Search, sps));
        }
Ejemplo n.º 14
0
        public static DataSet GetDocumentIDsList(SqlTransaction trans, int fileId)
        {
            SqlParameter[] sps = new SqlParameter[1];

            sps[0]       = new SqlParameter("@FileID", SqlDbType.Int);
            sps[0].Value = fileId;

            return(SPHelper.ExecuteDataset(trans, SpNames.ListDocumentIDs, sps));
        }
Ejemplo n.º 15
0
        public static DataSet Search(SqlTransaction trans, string docTypeName, int documentCodeID)
        {
            SqlParameter[] sps = new SqlParameter[2];
            sps[0]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            sps[0].Value = docTypeName;

            sps[1]       = new SqlParameter("@DocumentCodeID", SqlDbType.Int);
            sps[1].Value = documentCodeID;

            return(SPHelper.ExecuteDataset(trans, SpNames.Search, sps));
        }
Ejemplo n.º 16
0
        public static DataTable GetDepartmentTop(SqlTransaction trans, int documentID, int departmentId)
        {
            SqlParameter[] prms = new SqlParameter[2];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = documentID;

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

            return(SPHelper.ExecuteDataset(trans, SpNames.DepartmentTop, prms).Tables[0]);
        }
Ejemplo n.º 17
0
        public static DataTable GetAll(int departmentID, int postID)
        {
            SqlParameter[] sps = new SqlParameter[2];
            sps[0]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[0].Value = departmentID;

            sps[1]       = new SqlParameter("@PostID", SqlDbType.Int);
            sps[1].Value = postID;

            return(SPHelper.ExecuteDataset(SpNames.ListByPost, sps).Tables[0]);
        }
Ejemplo n.º 18
0
 public static DataTable GetList(SqlTransaction trans, int citizenID)
 {
     if (trans == null)
     {
         return(SPHelper.ExecuteDataset(SpNames.List, citizenID).Tables[0]);
     }
     else
     {
         return(SPHelper.ExecuteDataset(trans, SpNames.List, citizenID).Tables[0]);
     }
 }
Ejemplo n.º 19
0
        public static DataSet GetPage(SqlTransaction trans, PageSettings pageSettings)
        {
            SqlParameter[] sps = new SqlParameter[8];
            sps[0]       = new SqlParameter("@PageIndex", SqlDbType.Int);
            sps[0].Value = pageSettings.PageIndex;

            sps[1]       = new SqlParameter("@SortColumnName", SqlDbType.VarChar, 50);
            sps[1].Value = pageSettings.SortColumn;

            sps[2]       = new SqlParameter("@SortOrderBy", SqlDbType.VarChar, 4);
            sps[2].Value = pageSettings.SortOrder;

            sps[3]       = new SqlParameter("@NumberOfRows", SqlDbType.Int);
            sps[3].Value = pageSettings.PageSize;

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

            sps[5]       = new SqlParameter("@Name", SqlDbType.NVarChar, 256);
            sps[5].Value = pageSettings.Where.HasRule("Name")
                                ? pageSettings.Where.GetRule("Name").Data
                                : String.Empty;

            sps[6] = new SqlParameter("@OrganizationTypeID", SqlDbType.Int);
            int organizationTypeID;

            if (pageSettings.Where.HasRule("OrganizationTypeID") && Int32.TryParse(pageSettings.Where.GetRule("OrganizationTypeID").Data, out organizationTypeID))
            {
                sps[6].Value = organizationTypeID;
            }
            else
            {
                sps[6].Value = DBNull.Value;
            }

            sps[7] = new SqlParameter("@DepartmentID", SqlDbType.Int);
            int departmentId;

            if (pageSettings.Where.HasRule("DepartmentID") && Int32.TryParse(pageSettings.Where.GetRule("DepartmentID").Data, out departmentId))
            {
                sps[7].Value = departmentId;
            }
            else
            {
                sps[7].Value = DBNull.Value;
            }

            DataSet ds = SPHelper.ExecuteDataset(trans, SpNames.Page, sps);

            pageSettings.TotalRecords = sps[4].Value != DBNull.Value ? Convert.ToInt32(sps[4].Value) : 0;

            return(ds);
        }
Ejemplo n.º 20
0
        public static DataTable GetList(SqlTransaction trans, int documentId)
        {
            SqlParameter[] prms = new SqlParameter[2];
            prms[0]       = new SqlParameter("@DocumentID", SqlDbType.Int);
            prms[0].Value = documentId;

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

            if (trans == null)
            {
                return(SPHelper.ExecuteDataset(SpNames.List, prms).Tables[0]);
            }
            return(SPHelper.ExecuteDataset(trans, SpNames.List, prms).Tables[0]);
        }
Ejemplo n.º 21
0
        public static int GetNextNumber(SqlTransaction trans, string userName, int departmentID, int documentCodeID)
        {
            Department department = new Department(trans, departmentID, userName);

            if (!Permission.IsUserPermission(trans, userName, department.ObjectID, (int)Department.ActionType.View))
            {
                throw new AccessException(userName, "Get document template");
            }

            int      number       = 1;
            DateTime starYearDate = new DateTime(DateTime.Now.Year, 1, 1, 1, 0, 0);
            DateTime endYearDate  = new DateTime(DateTime.Now.Year, 12, 31, 23, 0, 0);

            SqlParameter[] sps = new SqlParameter[5];
            sps[0]       = new SqlParameter("@Count", SqlDbType.Int);
            sps[0].Value = 300;

            sps[1]       = new SqlParameter("@DocumentCodeID", SqlDbType.Int);
            sps[1].Value = documentCodeID;

            sps[2]       = new SqlParameter("@CreationDateStart", SqlDbType.DateTime);
            sps[2].Value = starYearDate;

            sps[3]       = new SqlParameter("@CreationDateEnd", SqlDbType.DateTime);
            sps[3].Value = endYearDate;

            sps[4]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[4].Value = departmentID;


            DataTable dt = SPHelper.ExecuteDataset(trans, "usp_DocAdminService_GetLastNumberList", sps).Tables[0];

            if (dt.Rows.Count > 0)
            {
                List <int> numbers = new List <int>();
                foreach (DataRow row in dt.Rows)
                {
                    numbers.Add(Convert.ToInt32((string)row["Number"]));
                }
                numbers.Sort();
                number = numbers[numbers.Count - 1] + 1;
            }

            return(number);
        }
Ejemplo n.º 22
0
        public static DataSet Search(SqlTransaction trans, string name, int departmentId)
        {
            SqlParameter[] sps = new SqlParameter[2];
            sps[0]       = new SqlParameter("@Name", SqlDbType.NVarChar, 50);
            sps[0].Value = name;

            sps[1]            = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[1].IsNullable = true;
            if (departmentId > 0)
            {
                sps[1].Value = departmentId;
            }
            else
            {
                sps[1].Value = DBNull.Value;
            }

            return(SPHelper.ExecuteDataset(trans, "usp_Department_Search", sps));
        }
Ejemplo n.º 23
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);
        }
Ejemplo n.º 24
0
        public static DataSet Search(SqlTransaction trans, int?departmentId, string lastName)
        {
            SqlParameter[] sps = new SqlParameter[4];
            sps[0] = new SqlParameter("@DepartmentID", SqlDbType.Int);
            if (departmentId != null)
            {
                sps[0].Value = departmentId;
            }
            else
            {
                sps[0].Value = DBNull.Value;
            }

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

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

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

            return(SPHelper.ExecuteDataset(trans, "usp_Worker_Search", sps));
        }
Ejemplo n.º 25
0
 public static DataTable GetAll()
 {
     return(SPHelper.ExecuteDataset(SpNames.List).Tables[0]);
 }
Ejemplo n.º 26
0
 public static DataTable GetAll()
 {
     return(SPHelper.ExecuteDataset("usp_ExternalNumber_List").Tables[0]);
 }
Ejemplo n.º 27
0
 public static DataTable GetAll(SqlConnection conectionString)
 {
     return(SPHelper.ExecuteDataset(conectionString, "usp_ExternalNumber_List").Tables[0]);
 }
Ejemplo n.º 28
0
 public static DataTable GetAll(SqlConnection conectionString)
 {
     return(SPHelper.ExecuteDataset(conectionString, SpNames.List).Tables[0]);
 }
Ejemplo n.º 29
0
        private void Init(SqlTransaction trans, int id)
        {
            if (!CanView(UserName))
            {
                throw new AccessException(UserName, "Init");
            }

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

            DataTable cTable;

            if (trans == null)
            {
                cTable = SPHelper.ExecuteDataset("usp_ControlCard_GetGroup", prms).Tables[0];
            }
            else
            {
                cTable = SPHelper.ExecuteDataset(trans, "usp_ControlCard_GetGroup", prms).Tables[0];
            }

            Group = new List <ControlCardBlank>();
            foreach (DataRow row in cTable.Rows)
            {
                ControlCardGroup card = new ControlCardGroup();

                card.ID         = (int)row["ControlCardID"];
                card.DocumentID = (int)row["DocumentID"];
                card.HeadID     = (int)row["HeadID"];
                card.WorkerID   = (int)row["WorkerID"];
                card.CardNumber = (int)row["CardNumber"];
                card.StartDate  = (DateTime)row["StartDate"];
                card.EndDate    = (DateTime)row["EndDate"];

                card.ControlResponseDate = row["ControlResponseDate"] != DBNull.Value ? (DateTime)row["ControlResponseDate"] : DateTime.MinValue;

                card.ControlResponse       = (string)row["ControlResponse"];
                card.HeadResponseID        = (int)row["HeadResponseID"];
                card.FixedWorkerID         = (int)row["FixedWorkerID"];
                card.CardStatusID          = (int)row["CardStatusID"];
                card.IsSpeciallyControlled = (bool)row["IsSpeciallyControlled"];
                card.Notes                          = (string)row["Notes"];
                card.Resolution                     = (string)row["Resolution"];
                card.IsDecisionOfSession            = (bool)row["IsDecisionOfSession"];
                card.IsDecisionOfExecutiveCommittee = (bool)row["IsDecisionOfExecutiveCommittee"];
                card.IsOrderOfHeader                = (bool)row["IsOrderOfHeader"];
                card.IsActionWorkPlan               = (bool)row["IsActionWorkPlan"];
                card.IsSendResponse                 = (bool)row["IsSendResponse"];
                card.IsSendInterimResponse          = (bool)row["IsSendInterimResponse"];
                card.IsLeftToWorker                 = (bool)row["IsLeftToWorker"];
                card.IsAcquaintedWorker             = (bool)row["IsAcquaintedWorker"];
                card.ExecutiveDepartmentID          = (int)row["ExecutiveDepartmentID"];
                card.IsContinuation                 = (bool)row["IsContinuation"];
                card.ParentControlCardID            = row["ParentControlCardID"] != DBNull.Value ? (int)row["ParentControlCardID"] : 0;
                card.InnerNumber                    = row["InnerNumber"] != DBNull.Value ? (string)row["InnerNumber"] : String.Empty;
                card.DepartmentID                   = (int)row["DepartmentID"];
                card.GroupID                        = row["GroupID"] != DBNull.Value ? (int)row["GroupID"] : 0;

                card.InitSubObjects(trans, UserName);
                Group.Add(card);

                if (card.ID == id)
                {
                    ID         = (int)row["ControlCardID"];
                    DocumentID = (int)row["DocumentID"];
                    HeadID     = (int)row["HeadID"];
                    WorkerID   = (int)row["WorkerID"];
                    CardNumber = (int)row["CardNumber"];
                    StartDate  = (DateTime)row["StartDate"];
                    EndDate    = (DateTime)row["EndDate"];

                    ControlResponseDate = row["ControlResponseDate"] != DBNull.Value
                                              ? (DateTime)row["ControlResponseDate"]
                                              : DateTime.MinValue;

                    ControlResponse       = (string)row["ControlResponse"];
                    HeadResponseID        = (int)row["HeadResponseID"];
                    FixedWorkerID         = (int)row["FixedWorkerID"];
                    CardStatusID          = (int)row["CardStatusID"];
                    IsSpeciallyControlled = (bool)row["IsSpeciallyControlled"];
                    Notes                          = (string)row["Notes"];
                    Resolution                     = (string)row["Resolution"];
                    IsDecisionOfSession            = (bool)row["IsDecisionOfSession"];
                    IsDecisionOfExecutiveCommittee = (bool)row["IsDecisionOfExecutiveCommittee"];
                    IsOrderOfHeader                = (bool)row["IsOrderOfHeader"];
                    IsActionWorkPlan               = (bool)row["IsActionWorkPlan"];
                    IsSendResponse                 = (bool)row["IsSendResponse"];
                    IsSendInterimResponse          = (bool)row["IsSendInterimResponse"];
                    IsLeftToWorker                 = (bool)row["IsLeftToWorker"];
                    IsAcquaintedWorker             = (bool)row["IsAcquaintedWorker"];
                    ExecutiveDepartmentID          = (int)row["ExecutiveDepartmentID"];
                    IsContinuation                 = (bool)row["IsContinuation"];
                    ParentControlCardID            = row["ParentControlCardID"] != DBNull.Value
                                              ? (int)row["ParentControlCardID"]
                                              : 0;
                    InnerNumber  = row["InnerNumber"] != DBNull.Value ? (string)row["InnerNumber"] : String.Empty;
                    DepartmentID = (int)row["DepartmentID"];
                    GroupID      = row["GroupID"] != DBNull.Value ? (int)row["GroupID"] : 0;
                }
            }
        }
Ejemplo n.º 30
0
        public static DataTable GetPage(SqlTransaction trans, PageSettings pageSettings, string userName, int departmentID)
        {
            Department department = new Department(trans, departmentID, userName);

            if (!Permission.IsUserPermission(trans, userName, department.ObjectID, (int)Department.ActionType.View))
            {
                throw new AccessException(userName, "Get document template");
            }

            SqlParameter[] sps = new SqlParameter[15];
            sps[0]       = new SqlParameter("@PageIndex", SqlDbType.Int);
            sps[0].Value = pageSettings.PageIndex;

            sps[1]       = new SqlParameter("@SortColumnName", SqlDbType.VarChar, 50);
            sps[1].Value = pageSettings.SortColumn;

            sps[2]       = new SqlParameter("@SortOrderBy", SqlDbType.VarChar, 4);
            sps[2].Value = pageSettings.SortOrder;

            sps[3]       = new SqlParameter("@NumberOfRows", SqlDbType.Int);
            sps[3].Value = pageSettings.PageSize;

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

            sps[5] = new SqlParameter("@CreationDate", SqlDbType.DateTime);
            if (pageSettings.Where.HasRule("CreationDate"))
            {
                sps[5].Value = DateTime.Parse(pageSettings.Where.GetRule("CreationDate").Data, CultureInfo.CurrentCulture);
            }
            else
            {
                sps[5].Value = DBNull.Value;
            }

            SqlDateTime cdStart = SqlDateTime.MinValue;

            if (pageSettings.Where.HasRule("CreationDateStart"))
            {
                cdStart = DateTime.Parse(pageSettings.Where.GetRule("CreationDateStart").Data, CultureInfo.CurrentCulture);
            }
            sps[6]       = new SqlParameter("@CreationDateStart", SqlDbType.DateTime);
            sps[6].Value = cdStart;

            SqlDateTime cdEnd = SqlDateTime.MaxValue;

            if (pageSettings.Where.HasRule("CreationDateEnd"))
            {
                cdEnd = DateTime.Parse(pageSettings.Where.GetRule("CreationDateEnd").Data, CultureInfo.CurrentCulture);
            }
            sps[7]       = new SqlParameter("@CreationDateEnd", SqlDbType.DateTime);
            sps[7].Value = cdEnd;

            sps[8]       = new SqlParameter("@Number", SqlDbType.NVarChar, 50);
            sps[8].Value = pageSettings.Where.HasRule("Number")
                                ? pageSettings.Where.GetRule("Number").Data
                                : String.Empty;

            sps[9]       = new SqlParameter("@DepartmentID", SqlDbType.Int);
            sps[9].Value = departmentID;

            /*
             * sps[10] = new SqlParameter("@DocumentCodeID", SqlDbType.Int);
             * int documentCodeID;
             * if (pageSettings.Where.HasRule("DocumentCodeID") && Int32.TryParse(pageSettings.Where.GetRule("DocumentCodeID").Data, out documentCodeID))
             * {
             *  sps[10].Value = documentCodeID;
             * }
             * else
             *  sps[10].Value = DBNull.Value;
             */
            sps[10]       = new SqlParameter("@DocumentCode", SqlDbType.NVarChar);
            sps[10].Value = pageSettings.Where.HasRule("DocumentCode")
                                ? pageSettings.Where.GetRule("DocumentCode").Data
                                : String.Empty;

            sps[11]       = new SqlParameter("@Content", SqlDbType.NVarChar);
            sps[11].Value = pageSettings.Where.HasRule("Content")
                                ? pageSettings.Where.GetRule("Content").Data
                                : String.Empty;

            sps[12]       = new SqlParameter("@SubjectRequest", SqlDbType.NVarChar);
            sps[12].Value = pageSettings.Where.HasRule("SubjectRequest")
                                ? pageSettings.Where.GetRule("SubjectRequest").Data
                                : String.Empty;

            sps[13]       = new SqlParameter("@ServiceName", SqlDbType.NVarChar);
            sps[13].Value = pageSettings.Where.HasRule("ServiceName")
                                ? pageSettings.Where.GetRule("ServiceName").Data
                                : String.Empty;

            sps[14]       = new SqlParameter("@ObjectForService", SqlDbType.NVarChar);
            sps[14].Value = pageSettings.Where.HasRule("ObjectForService")
                                ? pageSettings.Where.GetRule("ObjectForService").Data
                                : String.Empty;


            DataTable dt = SPHelper.ExecuteDataset(trans, "usp_DocAdminService_Page", sps).Tables[0];

            pageSettings.TotalRecords = sps[4].Value != DBNull.Value ? Convert.ToInt32(sps[4].Value) : 0;

            return(dt);
        }