Beispiel #1
0
        public double   GetValueFromCollectedData(int rowId, int columnId)
        {
            CompetitionDataContext competitionDataBase = new CompetitionDataContext();
            zColumnTable           currentColumn       = (from a in competitionDataBase.zColumnTable
                                                          where a.ID == columnId
                                                          select a).FirstOrDefault();
            DataType dataType = new DataType();

            if (columnId != null)
            {
                zCollectedDataTable currenCollectedDataTable = (from a in competitionDataBase.zCollectedDataTable
                                                                where a.Active == true &&
                                                                a.FK_ColumnTable == columnId &&
                                                                a.FK_CollectedRowsTable == rowId
                                                                select a).FirstOrDefault();

                if (dataType.IsDataTypeFloat(currentColumn.DataType) || dataType.IsCellCalculateInRow(currentColumn.DataType))
                {
                    return((double)currenCollectedDataTable.ValueDouble);
                }
                if (dataType.IsDataTypeInteger(currentColumn.DataType))
                {
                    return((double)currenCollectedDataTable.ValueInt);
                }
                if (dataType.IsDataTypeBit(currentColumn.DataType))
                {
                    if ((bool)currenCollectedDataTable.ValueBit)
                    {
                        return(1);
                    }
                }
            }
            return(0);
        }
Beispiel #2
0
        public string   GetDropDownSelectedValueString(zColumnTable currentColumn, zCollectedDataTable currentCollectedData, int applicationId, int currentRowId)
        {
            CompetitionDataContext competitionDataBase = new CompetitionDataContext();
            DataType dataType = new DataType();

            #region ConstantDropDown

            if (dataType.IsDataTypeConstantDropDown(currentColumn.DataType))
            {
                zCollectedDataTable getCollectedData =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                return(getCollectedData.ValueText);
            }

            #endregion
            #region OtherTableDropDown

            if (dataType.IsDataTypeDropDown(currentColumn.DataType))
            {
                zCollectedDataTable getCollectedData =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                return(getCollectedData.ValueText);
            }

            #endregion
            return("");
        }
Beispiel #3
0
 public bool     GetIsFileConnected(zCollectedDataTable currentCollectedData)
 {
     if (currentCollectedData.ValueText == null)
     {
         return(false);
     }
     if (!currentCollectedData.ValueText.Any())
     {
         return(false);
     }
     if (currentCollectedData.ValueText.Length > 3)
     {
         return(true);
     }
     return(false);
 }
Beispiel #4
0
        public bool     GetBoolDataValue(zColumnTable currentColumn, zCollectedDataTable currentCollectedData)
        {
            DataType dataType = new DataType();

            #region bit
            if (dataType.IsDataTypeBit(currentColumn.DataType))
            {
                if (currentCollectedData.ValueBit == null)
                {
                    return(false);
                }
                else
                {
                    return((bool)currentCollectedData.ValueBit);
                }
            }
            #endregion
            return(false);
        }
            private string GetValueFromKnownRowByUniqueMark(zCollectedRowsTable currentRow, string uniqueName, int applicationId)
            {
                zColumnTable           currentColumn        = GetColumnByUniqueMark(uniqueName, applicationId);
                CompetitionDataContext competitionDataBase  = new CompetitionDataContext();
                zCollectedDataTable    currentCollectedData = (from a in competitionDataBase.zCollectedDataTable
                                                               where a.FK_CollectedRowsTable == currentRow.ID &&
                                                               a.FK_ColumnTable == currentColumn.ID
                                                               select a).FirstOrDefault();

                if (currentCollectedData == null)
                {
                    return("");
                }

                DataProcess dataProcess = new DataProcess();

                dataProcess.ClearTotalUp();
                int dType = (int)currentColumn.DataType;

                if (dataProcess.IsCellReadWrite(dType))
                {
                    return(dataProcess.GetReadWriteString(currentColumn, currentCollectedData));
                }

                if (dataProcess.IsCellCheckBox(dType))
                {
                    return(dataProcess.GetBoolDataValue(currentColumn, currentCollectedData).ToString());
                }

                if (dataProcess.IsCellDate(dType))
                {
                    return(dataProcess.GetDateDataValue(currentColumn, currentCollectedData).ToString());
                }

                if (dataProcess.IsCellReadOnly(dType))
                {
                    return(dataProcess.GetReadOnlyString(currentColumn, currentCollectedData, applicationId, currentRow.ID, 0));
                }
                return("");
            }
Beispiel #6
0
        public DateTime GetDateDataValue(zColumnTable currentColumn, zCollectedDataTable currentCollectedData)
        {
            DataType dataType = new DataType();

            #region date

            if (dataType.IsDataTypeDate(currentColumn.DataType))
            {
                if (currentCollectedData.ValueDataTime == null)
                {
                    return(DateTime.Today);
                }
                else
                {
                    return((DateTime)currentCollectedData.ValueDataTime);
                }
            }

            #endregion

            return(DateTime.Today);
        }
Beispiel #7
0
        protected void DeleteButtonClick(object sender, EventArgs e)
        {
            Button button = (Button)sender;

            {
                int iD = Convert.ToInt32(button.CommandArgument);
                CompetitionDataContext competitionDataBase   = new CompetitionDataContext();
                zCollectedDataTable    collectedDataToDelete = (from a in competitionDataBase.zCollectedDataTable
                                                                where a.ID == iD
                                                                select a).FirstOrDefault();
                if (collectedDataToDelete != null)
                {
                    collectedDataToDelete.Active = false;
                    competitionDataBase.SubmitChanges();
                }
                else
                {
                    //error
                }
            }
            Response.Redirect("ConstantListCreate.aspx");
        }
Beispiel #8
0
        protected void SaveAllButton_Click(object sender, EventArgs e)
        {
            CompetitionDataContext competitionDataBase = new CompetitionDataContext();
            var sessionParam1 = Session["CompetitionID"];
            var sessionParam2 = Session["ConstantListID"];

            if ((sessionParam1 == null) || (sessionParam2 == null))
            {   //error
                Response.Redirect("ChooseConstantList.aspx");
            }
            int competitionId  = (int)sessionParam1;
            int constantListId = (int)sessionParam2;

            DataType dataType = new DataType();

            foreach (GridViewRow currentRow in ConstantListValuesGV.Rows)
            {
                Label idLabel = (Label)currentRow.FindControl("ID");
                if (idLabel != null)
                {
                    zCollectedDataTable currentCollectedData = (from a in competitionDataBase.zCollectedDataTable
                                                                where a.ID == Convert.ToInt32(idLabel.Text)
                                                                select a).FirstOrDefault();

                    if (currentCollectedData != null)
                    {
                        TextBox currentTextBox = (TextBox)currentRow.FindControl("ConstValueTextBox");
                        currentCollectedData.ValueText = currentTextBox.Text;
                        competitionDataBase.SubmitChanges();
                    }
                }
            }
            zConstantListTable currentConstantList = (from a in competitionDataBase.zConstantListTable
                                                      where a.ID == constantListId
                                                      select a).FirstOrDefault();

            currentConstantList.Name = ConstantListNameTextBox.Text;
            competitionDataBase.SubmitChanges();
        }
Beispiel #9
0
        public string   GetStringValueFromCollectedData(int rowId, int columnId)
        {
            CompetitionDataContext competitionDataBase = new CompetitionDataContext();
            zColumnTable           currentColumn       = (from a in competitionDataBase.zColumnTable
                                                          where a.ID == columnId
                                                          select a).FirstOrDefault();
            DataType dataType = new DataType();

            if (columnId != null)
            {
                zCollectedDataTable currenCollectedDataTable = (from a in competitionDataBase.zCollectedDataTable
                                                                where a.Active == true &&
                                                                a.FK_ColumnTable == columnId &&
                                                                a.FK_CollectedRowsTable == rowId
                                                                select a).FirstOrDefault();

                if (dataType.IsDataTypeText(currentColumn.DataType))
                {
                    return(currenCollectedDataTable.ValueText);
                }
            }
            return("");
        }
Beispiel #10
0
        protected void AddRowButton_Click(object sender, EventArgs e)
        {
            var sessionParam1 = Session["CompetitionID"];
            var sessionParam2 = Session["ConstantListID"];

            if ((sessionParam1 == null) || (sessionParam2 == null))
            {   //error
                Response.Redirect("ChooseConstantList.aspx");
            }
            int competitionId  = (int)sessionParam1;
            int constantListId = (int)sessionParam2;

            CompetitionDataContext competitionDataBase  = new CompetitionDataContext();
            zCollectedDataTable    newCollectedConstant = new  zCollectedDataTable();

            newCollectedConstant.FK_ConstantListTable = constantListId;
            newCollectedConstant.Active             = true;
            newCollectedConstant.CreateDateTime     = DateTime.Now;
            newCollectedConstant.LastChangeDateTime = DateTime.Now;

            competitionDataBase.zCollectedDataTable.InsertOnSubmit(newCollectedConstant);
            competitionDataBase.SubmitChanges();
            Response.Redirect("ConstantListCreate.aspx");
        }
Beispiel #11
0
        public string   GetReadOnlyString(zColumnTable currentColumn, zCollectedDataTable currentCollectedData, int applicationId, int currentRowId, int gvRowId)
        {
            CompetitionDataContext competitionDataBase = new CompetitionDataContext();
            DataType dataType = new DataType();

            #region iterator

            if (dataType.IsDataTypeIterator(currentColumn.DataType))
            {
                _toTotalUp = gvRowId;
                return((gvRowId).ToString());
            }

            #endregion
            #region sum

            if (dataType.IsDataTypeSum(currentColumn.DataType))
            {
                zColumnTable columnToSum = (from a in competitionDataBase.zColumnTable
                                            where a.ID == currentColumn.FK_ColumnTable
                                            select a).FirstOrDefault();
                double AllSum = 0;
                if (dataType.IsDataTypeInteger(columnToSum.DataType))
                {
                    AllSum = (int)(from a in competitionDataBase.zCollectedDataTable
                                   where a.FK_ColumnTable == columnToSum.ID &&
                                   a.Active == true
                                   join b in competitionDataBase.zCollectedRowsTable
                                   on a.FK_CollectedRowsTable equals b.ID
                                   where b.Active == true &&
                                   b.FK_ApplicationTable == applicationId
                                   select a.ValueInt).Distinct().Sum();
                }
                if (dataType.IsDataTypeFloat(columnToSum.DataType) || dataType.IsCellCalculateInRow(columnToSum.DataType))
                {
                    AllSum = (double)
                             (from a in competitionDataBase.zCollectedDataTable
                              where a.FK_ColumnTable == columnToSum.ID &&
                              a.Active == true
                              join b in competitionDataBase.zCollectedRowsTable
                              on a.FK_CollectedRowsTable equals b.ID
                              where b.Active == true &&
                              b.FK_ApplicationTable == applicationId
                              select a.ValueDouble).Distinct().Sum();
                }
                if (dataType.IsDataTypeBit(columnToSum.DataType))
                {
                    AllSum =
                        (from a in competitionDataBase.zCollectedDataTable
                         where a.FK_ColumnTable == columnToSum.ID &&
                         a.Active == true
                         join b in competitionDataBase.zCollectedRowsTable
                         on a.FK_CollectedRowsTable equals b.ID
                         where b.Active == true &&
                         b.FK_ApplicationTable == applicationId &&
                         a.ValueBit == true
                         select a).Distinct().Count();
                }
                _toTotalUp = AllSum;
                return(AllSum.ToString());
            }

            #endregion
            #region ConstantNecessarily

            if (dataType.IsDataTypeConstantNecessarilyShow(currentColumn.DataType))
            {
                zCollectedDataTable getCollectedData =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                return(getCollectedData.ValueText);
            }

            #endregion
            #region MaxValue

            if (dataType.IsDataTypeMaxValue(currentColumn.DataType))
            {
                zColumnTable columnToFind = (from a in competitionDataBase.zColumnTable
                                             where a.ID == currentColumn.FK_ColumnTable
                                             select a).FirstOrDefault();
                string tmpResult = "";
                if (dataType.IsDataTypeInteger(columnToFind.DataType))
                {
                    _toTotalUp = (double)(from a in competitionDataBase.zCollectedDataTable
                                          where a.FK_ColumnTable == columnToFind.ID &&
                                          a.Active == true
                                          join b in competitionDataBase.zCollectedRowsTable
                                          on a.FK_CollectedRowsTable equals b.ID
                                          where b.Active == true &&
                                          b.FK_ApplicationTable == applicationId
                                          select a.ValueInt).Distinct()
                                 .OrderByDescending(param => param)
                                 .FirstOrDefault();
                    tmpResult = _toTotalUp.ToString();
                }
                if (dataType.IsDataTypeFloat(columnToFind.DataType))
                {
                    _toTotalUp = (double)(from a in competitionDataBase.zCollectedDataTable
                                          where a.FK_ColumnTable == columnToFind.ID &&
                                          a.Active == true
                                          join b in competitionDataBase.zCollectedRowsTable
                                          on a.FK_CollectedRowsTable equals b.ID
                                          where b.Active == true &&
                                          b.FK_ApplicationTable == applicationId
                                          select a.ValueDouble).Distinct()
                                 .OrderByDescending(param => param)
                                 .FirstOrDefault();
                    tmpResult = _toTotalUp.ToString();
                }

                if (dataType.IsDataTypeDate(columnToFind.DataType))
                {
                    tmpResult =
                        (from a in competitionDataBase.zCollectedDataTable
                         where a.FK_ColumnTable == columnToFind.ID &&
                         a.Active == true
                         join b in competitionDataBase.zCollectedRowsTable
                         on a.FK_CollectedRowsTable equals b.ID
                         where b.Active == true &&
                         b.FK_ApplicationTable == applicationId
                         select a.ValueDataTime).Distinct()
                        .OrderByDescending(param => param)
                        .FirstOrDefault().ToString().Split(' ')[0];
                }

                return(tmpResult);
            }

            #endregion
            #region MinValue

            if (dataType.IsDataTypeMinValue(currentColumn.DataType))
            {
                zColumnTable columnToFind = (from a in competitionDataBase.zColumnTable
                                             where a.ID == currentColumn.FK_ColumnTable
                                             select a).FirstOrDefault();
                string tmpResult = "";
                if (dataType.IsDataTypeInteger(columnToFind.DataType))
                {
                    _toTotalUp = (double)
                                 (from a in competitionDataBase.zCollectedDataTable
                                  where a.FK_ColumnTable == columnToFind.ID &&
                                  a.Active == true
                                  join b in competitionDataBase.zCollectedRowsTable
                                  on a.FK_CollectedRowsTable equals b.ID
                                  where b.Active == true &&
                                  b.FK_ApplicationTable == applicationId
                                  select a.ValueInt).Distinct()
                                 .OrderBy(param => param)
                                 .FirstOrDefault();
                    tmpResult = _toTotalUp.ToString();
                }
                if (dataType.IsDataTypeFloat(columnToFind.DataType))
                {
                    _toTotalUp = (double)
                                 (from a in competitionDataBase.zCollectedDataTable
                                  where a.FK_ColumnTable == columnToFind.ID &&
                                  a.Active == true
                                  join b in competitionDataBase.zCollectedRowsTable
                                  on a.FK_CollectedRowsTable equals b.ID
                                  where b.Active == true &&
                                  b.FK_ApplicationTable == applicationId
                                  select a.ValueDouble).Distinct()
                                 .OrderBy(param => param)
                                 .FirstOrDefault();
                    tmpResult = _toTotalUp.ToString();
                }

                if (dataType.IsDataTypeDate(columnToFind.DataType))
                {
                    tmpResult =
                        (from a in competitionDataBase.zCollectedDataTable
                         where a.FK_ColumnTable == columnToFind.ID &&
                         a.Active == true
                         join b in competitionDataBase.zCollectedRowsTable
                         on a.FK_CollectedRowsTable equals b.ID
                         where b.Active == true &&
                         b.FK_ApplicationTable == applicationId
                         select a.ValueDataTime).Distinct()
                        .OrderBy(param => param)
                        .FirstOrDefault().ToString().Split(' ')[0];
                }
                return(tmpResult);
            }

            #endregion
            #region CollectedNecessarily

            if (dataType.IsDataTypeNecessarilyShow(currentColumn.DataType))
            {
                zCollectedDataTable getCollectedData =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                return(getCollectedData.ValueText);
            }

            #endregion
            #region CollectedNecessarilyWithParams

            if (dataType.IsDataTypeNecessarilyShowWithParam(currentColumn.DataType))
            {
                if (currentCollectedData.ValueFK_CollectedDataTable != null)
                {
                    zCollectedDataTable getCollectedData =
                        (from a in competitionDataBase.zCollectedDataTable
                         where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                         select a).FirstOrDefault();
                    return(getCollectedData.ValueText);
                }
            }

            #endregion
            #region sumWithParams

            if (dataType.IsDataTypeSymWithParam(currentColumn.DataType))
            {
                zCollectedDataTable collectedDataFrom =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.FK_CollectedRowsTable == currentRowId &&
                     a.FK_ColumnTable == currentColumn.FK_ColumnConnectFromTable
                     select a).FirstOrDefault();

                int iD = (int)collectedDataFrom.ValueFK_CollectedDataTable;
                //мы получили по сути ID мероприятия для которого считаем

                List <zCollectedRowsTable> collectedDataRowsToSum =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.Active == true &&
                     a.FK_ColumnTable == currentColumn.FK_ColumnConnectToTable &&
                     a.ValueFK_CollectedDataTable == iD
                     join b in competitionDataBase.zCollectedRowsTable
                     on a.FK_CollectedRowsTable equals b.ID
                     where b.Active == true &&
                     b.FK_ApplicationTable == applicationId
                     select b).Distinct().ToList();
                //получили список строк в таблице из которой берем числа для суммирования и только те строки которые нам нужны

                double sum = 0;
                foreach (zCollectedRowsTable currentRowToSum in collectedDataRowsToSum)
                {
                    sum += GetValueFromCollectedData(currentRowToSum.ID, (int)currentColumn.FK_ColumnTable);
                }
                _toTotalUp = sum;
                return(sum.ToString());
            }

            #endregion
            #region aplikcationName

            if (dataType.IsDataTypeNameOfApplication(currentColumn.DataType))
            {
                return((from a in competitionDataBase.zApplicationTable
                        where a.ID == applicationId
                        select a.Name).FirstOrDefault());
            }

            #endregion
            #region oneToOneWithParams
            if (dataType.IsDataTypeOneToOneWithParams(currentColumn.DataType))
            {
                zColumnTable columnConnectetFrom = (from a in competitionDataBase.zColumnTable
                                                    where a.ID == currentColumn.FK_ColumnConnectFromTable
                                                    select a).FirstOrDefault();

                zColumnTable columnConnectetTo = (from a in competitionDataBase.zColumnTable
                                                  where a.ID == currentColumn.FK_ColumnConnectToTable
                                                  select a).FirstOrDefault();
                zColumnTable collumnToGetValue = (from a in competitionDataBase.zColumnTable
                                                  where a.ID == currentColumn.FK_ColumnTable
                                                  select a).FirstOrDefault();

                zCollectedDataTable collectedDataFrom = (from a in competitionDataBase.zCollectedDataTable
                                                         where a.Active == true &&
                                                         a.FK_CollectedRowsTable == currentRowId &&
                                                         a.FK_ColumnTable == columnConnectetFrom.ID
                                                         select a).FirstOrDefault(); // значение которое ссылается

                if ((columnConnectetFrom != null) && (columnConnectetTo != null) && (collumnToGetValue != null))
                {
                    if (columnConnectetFrom.DataType == columnConnectetTo.DataType) // значит оба ссылаются на одного и того же// не тестировано
                    {
                        /* zCollectedRowsTable distatntRow = (from a in competitionDataBase.zCollectedRowsTable
                         *                                  where a.Active == true
                         *                                  join b in competitionDataBase.zCollectedDataTable
                         *                                      on a.ID equals b.FK_CollectedRowsTable
                         *                                  where b.ID == collectedDataFrom.ValueFK_CollectedDataTable
                         *                                  select a).FirstOrDefault();
                         *
                         * zCollectedDataTable distantRowValue = (from a in competitionDataBase.zCollectedDataTable
                         *                                      where a.Active == true
                         *                                            && a.FK_CollectedRowsTable == distatntRow.ID
                         *                                              && a.FK_ColumnTable == collumnToGetValue.ID
                         *                                      select a).FirstOrDefault();
                         *
                         * if (distantRowValue != null)
                         * {
                         *   if (IsCellReadWrite(collumnToGetValue.DataType))
                         *   {
                         *       return (GetReadWriteString(collumnToGetValue, distantRowValue));
                         *   }
                         * }*/
                    }
                    else //наш ссылается на него
                    {
                        zCollectedRowsTable distatntRow = (from a in competitionDataBase.zCollectedRowsTable
                                                           where a.Active == true
                                                           join b in competitionDataBase.zCollectedDataTable
                                                           on a.ID equals b.FK_CollectedRowsTable
                                                           where b.ID == collectedDataFrom.ValueFK_CollectedDataTable
                                                           select a).FirstOrDefault();
                        //нащли далбнюю строку
                        if (distatntRow != null) //дальней строки нет
                        {
                            zCollectedDataTable distantRowValue = (from a in competitionDataBase.zCollectedDataTable
                                                                   where a.Active == true &&
                                                                   a.FK_CollectedRowsTable == distatntRow.ID &&
                                                                   a.FK_ColumnTable == collumnToGetValue.ID
                                                                   select a).FirstOrDefault();

                            if (distantRowValue != null)
                            {
                                if (IsCellReadWrite(collumnToGetValue.DataType))
                                {
                                    return(GetReadWriteString(collumnToGetValue, distantRowValue));
                                }
                                if (IsCellCalculateInRow(collumnToGetValue.DataType))
                                {
                                    return((distantRowValue.ValueDouble).ToString());
                                }
                            }
                        }
                    }
                }
            }
            #endregion
            #region DropDown

            if (dataType.IsDataTypeDropDown(currentColumn.DataType))
            {
                return(GetDropDownSelectedValueString(currentColumn, currentCollectedData, applicationId, currentRowId));
            }
            #endregion
            #region applikcationCreateName

            if (dataType.IsDataTypeApplicationCreateDate(currentColumn.DataType))
            {
                var tmp = (from a in competitionDataBase.zApplicationTable
                           where a.ID == applicationId
                           select a).FirstOrDefault();
                if (tmp == null)
                {
                    return("error");
                }
                if (tmp.CretaDateTime == null)
                {
                    return("error");
                }
                return(tmp.CretaDateTime.ToString().Split(' ')[0]);
            }

            #endregion
            #region CalcInRow

            if (dataType.IsCellCalculateInRow(currentColumn.DataType))
            {
                if (currentCollectedData.ValueDouble.ToString() == "")
                {
                    return(0.ToString());
                }
                _toTotalUp = Convert.ToDouble(currentCollectedData.ValueDouble);
                return(currentCollectedData.ValueDouble.ToString());
            }
            #endregion
            #region AtLeastOneWithCheckBox
            if (dataType.IsDataTypeConstntAtLeastOneWithCheckBoxParam(currentColumn.DataType))
            {
                zCollectedDataTable getCollectedData =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == currentCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                if (getCollectedData == null)
                {
                    return("");
                }
                if (getCollectedData.ValueFK_CollectedDataTable == null)
                {
                    return("");
                }
                zCollectedDataTable getCollectedData2 =
                    (from a in competitionDataBase.zCollectedDataTable
                     where a.ID == getCollectedData.ValueFK_CollectedDataTable
                     select a).FirstOrDefault();
                return(getCollectedData2.ValueText);
            }
            #endregion
            return("");
        }
Beispiel #12
0
        public string   GetReadWriteString(zColumnTable currentColumn, zCollectedDataTable currentCollectedData)
        {
            try
            {
                DataType dataType = new DataType();

                #region float

                if (dataType.IsDataTypeFloat(currentColumn.DataType))
                {
                    validator.Enabled                 = true;
                    validator.ContentType             = ValidationDataType.Double;
                    validator.ErrorMessage            = "Только числовое значение!";
                    validator.MinValue                = (-100000000000).ToString();
                    validator.MaxValue                = 100000000000.ToString();
                    validator.RequireValidatorEnabled = true;
                    validator.TextBoxTextMode         = TextBoxMode.SingleLine;
                    if (currentCollectedData.ValueDouble != null)
                    {
                        double doubleValue = (double)currentCollectedData.ValueDouble;
                        _toTotalUp = doubleValue;
                        return(doubleValue.ToString());
                    }
                }

                #endregion

                #region Date

                if (dataType.IsDataTypeDate(currentColumn.DataType))
                {
                    validator.Enabled                 = true;
                    validator.ErrorMessage            = "Введите корректную дату";
                    validator.ContentType             = ValidationDataType.Date;
                    validator.MinValue                = "1900/01/01";
                    validator.MaxValue                = "2100/01/01";
                    validator.RequireValidatorEnabled = true;
                    validator.TextBoxTextMode         = TextBoxMode.SingleLine;
                    if (currentCollectedData.ValueDataTime != null)
                    {
                        DateTime dateTime = (DateTime)currentCollectedData.ValueDataTime;
                        string   tmpStr   = dateTime.ToString().Split(' ')[0];
                        string[] tmpArray = tmpStr.Split('.');
                        string   tmp2     = tmpArray[2] + "-" + tmpArray[1] + "-" + tmpArray[0];
                        return(tmp2);
                    }
                }

                #endregion

                #region int

                validator.Enabled = true;
                if (dataType.IsDataTypeInteger(currentColumn.DataType))
                {
                    validator.ContentType             = ValidationDataType.Integer;
                    validator.ErrorMessage            = "Только целочисленное значение!";
                    validator.MinValue                = Int32.MinValue.ToString();
                    validator.MaxValue                = Int32.MaxValue.ToString();
                    validator.RequireValidatorEnabled = true;
                    validator.TextBoxTextMode         = TextBoxMode.SingleLine;
                    if (currentCollectedData.ValueInt != null)
                    {
                        int intValue = (int)currentCollectedData.ValueInt;
                        _toTotalUp = intValue;
                        return(intValue.ToString());
                    }
                }

                #endregion

                #region text

                if (dataType.IsDataTypeText(currentColumn.DataType))
                {
                    validator.Enabled                 = false;
                    validator.ContentType             = ValidationDataType.String;
                    validator.ErrorMessage            = "Введите текст!";
                    validator.MinValue                = 1.ToString();
                    validator.MaxValue                = 50000.ToString();
                    validator.RequireValidatorEnabled = true;
                    validator.TextBoxTextMode         = TextBoxMode.MultiLine;
                    return(currentCollectedData.ValueText);
                }

                #endregion
            }
            catch
            {
                return("0");
            }

            return("0");
        }