示例#1
0
        private bool TryCheckFile(string fullPath, out CheckedStatus checkedStatus)
        {
            checkedStatus = null;

            string batchFileLocation = GetCheckPath();

            Process p = new Process();

            p.StartInfo.FileName               = batchFileLocation;
            p.StartInfo.WorkingDirectory       = Path.GetDirectoryName(batchFileLocation);
            p.StartInfo.UseShellExecute        = false;
            p.StartInfo.Arguments              = fullPath;
            p.StartInfo.RedirectStandardOutput = true;
            p.Start();
            var output = p.StandardOutput.ReadLine();

            p.WaitForExit();

            try
            {
                checkedStatus = ParseXml(output);
            }
            catch (Exception ex)
            {
                return(false);
            }
            finally
            {
                DeleteFile(output);
            }
            return(true);
        }
示例#2
0
 public Casilla(int coord_x, int coord_y)
 {
     this.state       = CellState.__water;           //Por defecto las casillas son agua
     this.checkstatus = CheckedStatus.__unchecked;   //Por defecto las casillas estan unchecked
     this.owner       = Propietario.vacia;           //Por defecto estan vacias(sin propietario)
     //Coords
     this.coord_x = coord_x;
     this.coord_y = coord_y;
 }
        /// <summary>
        /// Get DataTable of Notes Data for DataNid or ProfileNid or classificationNid and for approved or all Comments Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetNotesData(string notesNId, string dataNId, string profileNIds, string classificationNIds, CheckedStatus notesApproved)
        {
            DataTable RetVal = null;
            string SqlQuery = string.Empty;
            try
            {
                SqlQuery = this.DBQueries.Notes.GetNotes_Data( notesNId,  dataNId,  profileNIds,  classificationNIds,  notesApproved);

                RetVal = this.DBConnection.ExecuteDataTable(SqlQuery);

            }
            catch (Exception ex)
            {
                ExceptionFacade.ThrowException(ex);
            }
            return RetVal;
        }
示例#4
0
        private CheckedStatus ParseXml(string filename)
        {
            var checkStatus = new CheckedStatus();


            XmlDocument xDoc = new XmlDocument();

            //var encodeName = XmlConvert.EncodeName(File.ReadAllText(filename));
            xDoc.Load(filename);//(filename);

            XmlElement xRoot  = xDoc.DocumentElement;
            var        result = xRoot.GetAttribute("Result"); //.Attributes.GetNamedItem();

            checkStatus.Result = result;
            if (result == "Ok")
            {
                return(checkStatus);
            }

            foreach (XmlNode xnode in xRoot)
            {
                var item = new Item();

                foreach (XmlNode childnode in xnode.ChildNodes)
                {
                    if (childnode.Name == "Paragraph")
                    {
                        item.Paragraph = childnode.InnerText;
                    }
                    else if (childnode.Name == "Comment")
                    {
                        item.Comment = childnode.InnerText;
                    }
                }

                if (xnode.Name == "Error")
                {
                    checkStatus.Errors.Add(item);
                }
                else if (xnode.Name == "Warning")
                {
                    checkStatus.Warnings.Add(item);
                }
            }
            return(checkStatus);
        }
示例#5
0
 //Checkea la celda
 public void CheckCell()
 {
     this.checkstatus = CheckedStatus.__checked;
 }
示例#6
0
        /// <summary>
        /// Get DataTable of Notes Data for DataNid or ProfileNid or classificationNid and for approved or all Comments Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetNotesData(string notesNId, string dataNId, string profileNIds, string classificationNIds, CheckedStatus notesApproved)
        {
            DataTable RetVal   = null;
            string    SqlQuery = string.Empty;

            try
            {
                SqlQuery = this.DBQueries.Notes.GetNotes_Data(notesNId, dataNId, profileNIds, classificationNIds, notesApproved);

                RetVal = this.DBConnection.ExecuteDataTable(SqlQuery);
            }
            catch (Exception ex)
            {
                ExceptionFacade.ThrowException(ex);
            }
            return(RetVal);
        }
示例#7
0
        /// <summary>
        /// Get CommentsInfo for CommentsNId
        /// </summary>
        /// <param name="notesNid"></param>
        /// <returns></returns>
        public DataTable GetNotesByNotesNid(string dataNIds, string notesNIds, string profileNIds, string classificationNIds, CheckedStatus NotesApproved, FieldSelection fieldSelection)
        {
            DataTable RetVal = null;
            string SqlQuery = string.Empty;
            try
            {
                SqlQuery = this.DBQueries.Notes.GetNotes( dataNIds, notesNIds, profileNIds, classificationNIds, NotesApproved, FieldSelection.Heavy );

                RetVal = this.DBConnection.ExecuteDataTable(SqlQuery);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return RetVal;
        }
示例#8
0
        /// <summary>
        /// Get Notes based on various filter conditions
        /// </summary>
        /// <param name="dataNId">Comma delimited DataNIds which may be NullOrEmpty</param>
        /// <param name="notesNId">Comma delimited NotesNIds which may be NullOrEmpty</param>
        /// <param name="profileNId">Comma delimited ProfileNIds which may be NullOrEmpty</param>
        /// <param name="classificationNId">Comma delimited ClassificationNIds which may be NullOrEmpty</param>
        /// <param name="NotesApproved">NotesApproved status. For most of the cases it shall be CheckedStatus.True</param>
        /// <param name="fieldSelection">Light gets column from Notes Table. Heavy gets additional column for ProfileName, ClassificationName</param>
        /// <returns></returns>
        public string GetNotes(string dataNIds, string notesNIds, string profileNIds, string classificationNIds, CheckedStatus NotesApproved, FieldSelection fieldSelection)
        {
            string RetVal = string.Empty;
            string SelectClause = "SELECT ";
            string FromClause = " FROM ";
            string WhereClause = string.Empty;

            if (!string.IsNullOrEmpty(dataNIds))
            {
                SelectClause += " ND." + DIColumns.Notes_Data.DataNId + ",";
                FromClause += this.TablesName.NotesData + " AS ND " + ",";
            }

            SelectClause += "N." + DIColumns.Notes.NotesNId + ",N." + DIColumns.Notes.ProfileNId + ",N." + DIColumns.Notes.ClassificationNId + "," + DIColumns.Notes.Note + "," + DIColumns.Notes.NotesDateTime + "," + DIColumns.Notes.NotesApproved;
            FromClause += this.TablesName.Notes + " AS N";

            switch (fieldSelection)
            {
                case FieldSelection.NId:
                case FieldSelection.Name:
                case FieldSelection.Light:
                    break;
                case FieldSelection.Heavy:
                    SelectClause += ",NP." + DIColumns.Notes_Profile.ProfileName + ",NC." + DIColumns.Notes_Classification.ClassificationName;
                    FromClause += "," + this.TablesName.NotesProfile + " AS NP," + this.TablesName.NotesClassification + " AS NC";
                    break;
            }

            if (!string.IsNullOrEmpty(dataNIds))
            {
                WhereClause = "ND." + DIColumns.Notes_Data.DataNId + " IN (" + dataNIds + ")";
            }

            if (!string.IsNullOrEmpty(notesNIds))
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                WhereClause = "N." + DIColumns.Notes.NotesNId + " IN (" + notesNIds + ")";
            }

            if (!string.IsNullOrEmpty(profileNIds))
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                WhereClause += " NP." + DIColumns.Notes_Profile.ProfileNId + " IN (" + profileNIds + ")";
            }

            if (!string.IsNullOrEmpty(classificationNIds))
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                WhereClause += " NC." + DIColumns.Notes_Classification.ClassificationNId + " IN (" + classificationNIds + ")";
            }

            if (NotesApproved != CheckedStatus.All)
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                switch (NotesApproved)
                {
                    //Use 0 based logic for boolean fields as this syntax works on all databases
                    case CheckedStatus.False:
                        WhereClause += " N." + DIColumns.Notes.NotesApproved + " = 0";
                        break;
                    case CheckedStatus.True:
                        WhereClause += " N." + DIColumns.Notes.NotesApproved + " <> 0";
                        break;
                }
            }

            if (!string.IsNullOrEmpty(dataNIds))
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                WhereClause += " N." + DIColumns.Notes.NotesNId + " = ND." + DIColumns.Notes_Data.NotesNId;
            }

            if (fieldSelection== FieldSelection.Heavy)
            {
                if (WhereClause.Trim().Length > 0)
                {
                    WhereClause += " AND ";
                }
                WhereClause += " N." + DIColumns.Notes.ClassificationNId + " = NC." + DIColumns.Notes_Classification.ClassificationNId;
                WhereClause += " AND N." + DIColumns.Notes.ProfileNId + " = NP." + DIColumns.Notes_Profile.ProfileNId;
            }

            RetVal = SelectClause + FromClause;
            if (WhereClause.Trim().Length > 0)
            {
                RetVal += " WHERE " + WhereClause;
            }

            return RetVal;
        }
示例#9
0
        /// <summary>
        /// Gets Notes_Data records for given Notes / Data / Profile / ClassificationType filter
        /// </summary>
        /// <param name="notesNId">Comma delimited NotesNId which may be blank</param>
        /// <param name="dataNId">Comma delimited DataNId which may be blank</param>
        /// <param name="profileNIds">Comma delimited ProfileNId which may be blank</param>
        /// <param name="classificationNIds">Comma delimited Classification NId which may be blank</param>
        /// <param name="NotesApproved">Whether to consider all notes or approved notes only. In case of DXComments all notes will be considered whereelse in case of UI only approved notes will be considered</param>
        /// <returns></returns>
        public string GetNotes_Data(string notesNId, string dataNId, string profileNIds, string classificationNIds, CheckedStatus NotesApproved)
        {
            string RetVal = string.Empty;
            StringBuilder sbQuery = new StringBuilder();

            sbQuery.Append("SELECT ND." + DIColumns.Notes_Data.NotesDataNId + ",ND." + DIColumns.Notes_Data.NotesNId + ",ND." + DIColumns.Notes_Data.DataNId);
            sbQuery.Append(" FROM " + this.TablesName.NotesData + " AS ND," + this.TablesName.Notes + " AS N");

            sbQuery.Append(" WHERE ND." + DIColumns.Notes_Data.NotesNId + " = N." + DIColumns.Notes.NotesNId);

            if (notesNId.Trim().Length > 0)
            {
                sbQuery.Append(" AND ND." + DIColumns.Notes_Data.NotesNId + " IN (" + notesNId + ")");
            }

            if (dataNId.Trim().Length > 0)
            {
                sbQuery.Append(" AND ND." + DIColumns.Notes_Data.DataNId + " IN (" + dataNId + ")");
            }

            if (profileNIds.Trim().Length > 0)
            {
                sbQuery.Append(" AND N." + DIColumns.Notes.ProfileNId + " IN (" + profileNIds + ")");
            }

            if (classificationNIds.Trim().Length > 0)
            {
                sbQuery.Append(" AND N." + DIColumns.Notes.ClassificationNId + " IN (" + classificationNIds + ")");
            }

            switch (NotesApproved)
            {
                case CheckedStatus.All:
                    //All records to be considered ignore where clause
                    break;
                case CheckedStatus.False:
                    sbQuery.Append(" AND N." + DIColumns.Notes.NotesApproved + " = 0");
                    break;
                case CheckedStatus.True:
                    sbQuery.Append(" AND N." + DIColumns.Notes.NotesApproved + " <> 0");
                    break;
            }

            RetVal = sbQuery.ToString();
            return RetVal;
        }
示例#10
0
 /// <summary>
 /// Gets Notes_Data records for given Notes and/or Data filter
 /// </summary>
 /// <param name="notesNId">Comma delimited NotesNId which may be blank</param>
 /// <param name="dataNId">Comma delimited DataNId which may be blank</param>
 /// <param name="NotesApproved">Whether to consider all notes or approved notes only. In case of DXComments all notes will be considered whereelse in case of UI only approved notes will be considered</param>
 /// <returns></returns>
 public string GetNotes_Data(string notesNId, string dataNId, CheckedStatus NotesApproved)
 {
     return this.GetNotes_Data(notesNId, dataNId, string.Empty, string.Empty, NotesApproved);
 }
示例#11
0
        /// <summary>
        /// Get CommentsInfo for CommentsNId
        /// </summary>
        /// <param name="notesNid"></param>
        /// <returns></returns>
        public DataTable GetNotesByNotesNid(string dataNIds, string notesNIds, string profileNIds, string classificationNIds, CheckedStatus NotesApproved, FieldSelection fieldSelection)
        {
            DataTable RetVal   = null;
            string    SqlQuery = string.Empty;

            try
            {
                SqlQuery = this.DBQueries.Notes.GetNotes(dataNIds, notesNIds, profileNIds, classificationNIds, NotesApproved, FieldSelection.Heavy);

                RetVal = this.DBConnection.ExecuteDataTable(SqlQuery);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(ex.Message);
            }

            return(RetVal);
        }