示例#1
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     base.OnUpdateInsert(ea, cell);
     if (ea.IgnoreChanges)
     {
         return;
     }
     ea.AddApostrophe = false;
 }
示例#2
0
        internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
        {
            base.OnUpdateInsert(ea, cell);
            if (ea.IgnoreChanges)
            {
                return;
            }

            if (EncryptionKey != null && ea.Value != null) // Decrypt ?
            {
                ea.Value = Security.Encrypt(ea.Value.ToString(), EncryptionKey);
            }
        }
示例#3
0
        // 2005.01.09 - jorn, string optimize
        internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
        {
            // Fix value
            ea.AddApostrophe = true;

            // If update and value matches with DB then don't update
            if (ea.Value != null && ea.Value.Equals(cell.DataSourceValue))
            {
                ea.IgnoreChanges = true;
            }

            if (ea.Value == null)
            {
                ea.AddApostrophe = false;
            }
        }
示例#4
0
        private void OnUpdateInsertDataSource(CellUpdateInsertArgument ea, RowCell cell)
        {
            if (!Grid.GotHttpContext)
            {
                return;
            }
            if (HttpContext.Current.Session[cell.CellClientId + "_imgdata"] == null)
            {
                ea.IgnoreChanges = true;
                return;
            }
            BinaryReader br;

            switch (FileTemporaryMode)
            {
            case FileTemporaryMode.Memory:

                System.Drawing.Image img = (System.Drawing.Image)HttpContext.Current.Session[cell.CellClientId + "_imgdata"];

                //if (Sizes.Count > 0)
                //    img = Sizes[0].Resize(img);

                MemoryStream ms = new MemoryStream();
                img.Save(ms, img.RawFormat);
                br = new BinaryReader(ms);

                br.BaseStream.Position = 0;
                ea.Parameter           = br;
                ea.IgnoreChanges       = false;
                break;

            case FileTemporaryMode.File:
            {
                FileStream fs =
                    System.IO.File.Open((string)HttpContext.Current.Session[cell.CellClientId + "_imgdata"],
                                        FileMode.Open, FileAccess.Read, FileShare.Read);
                br = new BinaryReader(fs);
                fs.Close();
                br.BaseStream.Position = 0;
                ea.Parameter           = br;
                ea.IgnoreChanges       = false;
            }
            break;
            }
        }
示例#5
0
        private void OnUpdateInsertDataSource(CellUpdateInsertArgument ea, RowCell cell)
        {
            if (!Grid.GotHttpContext)
            {
                return;
            }
            if (HttpContext.Current.Session[cell.CellClientId + "_imgdata"] == null)
            {
                ea.IgnoreChanges = true;
                return;
            }

            switch (FileTemporaryMode)
            {
            case FileTemporaryMode.Memory:
            {
                Stream       s  = (Stream)HttpContext.Current.Session[cell.CellClientId + "_imgdata"];
                BinaryReader br = new BinaryReader(s);
                br.BaseStream.Position = 0;
                ea.Parameter           = br;
            }
                ea.IgnoreChanges = false;
                break;

            case FileTemporaryMode.File:
            {
                FileStream fs =
                    System.IO.File.Open((string)HttpContext.Current.Session[cell.CellClientId + "_imgdata"],
                                        FileMode.Open, FileAccess.Read, FileShare.Read);
                BinaryReader br = new BinaryReader(fs);
                fs.Close();
                br.BaseStream.Position = 0;
                ea.Parameter           = br;
                ea.IgnoreChanges       = false;
            }
            break;
            }
        }
示例#6
0
        /// <summary>
        /// Updates or inserts a row into the table in the data source.
        /// </summary>
        /// <param name="row">The row to be inserted.</param>
        /// <param name="editIndex">The value of the primary key(s) (the column identifier).</param>
        /// <param name="isInsert">Indicates whether the operation is update or insert.</param>
        /// <returns>The (new) values for the primary key(s).</returns>
        internal static bool InsertUpdateRow(ref string editIndex, Row row, bool isInsert)
        {
            #region Error and permissions checks
            if (Grid.GotHttpContext &&
                System.IO.File.Exists(String.Format("{0}\\noupdate.webgrid", HttpContext.Current.Server.MapPath(".")))
                && row.m_Table.m_Grid.Tag["allowupdate"] == null)
            {
                string content =
                    System.IO.File.ReadAllText(String.Format("{0}\\noupdate.webgrid",
                                                             HttpContext.Current.Server.MapPath(".")));
                row.m_Table.m_Grid.SystemMessage.Add(
                    String.IsNullOrEmpty(content)
                        ? "The capability to insert, update, and delete has been disabled."
                        : content);
                return false;
            }
            if (row.Columns.Primarykeys.Count == 0)
            {
                row.m_Table.m_Grid.SystemMessage.Add(
                    "Your data source is missing primary key(s). This is needed to identify the row you want to update, insert or delete.");
                return false;
            }
            #endregion

            bool identity = false;

            if (row.m_Table == row.m_Table.m_Grid.MasterTable)
                row.m_Table.m_Grid.BeforeValidateEvent(ref row);
            ValidateColumns(row);

            BeforeUpdateInsertEventArgs columnArgs = new BeforeUpdateInsertEventArgs
                                                         {DataSourceId = row.m_Table.DataSourceId};
            if (isInsert)
            {
                columnArgs.m_Insert = true;
                columnArgs.m_EditIndex = null;
            }
            else
            {
                columnArgs.m_Update = true;
                columnArgs.m_EditIndex = editIndex;
            }

            for (int i = 0; i < row.Columns.Count; i++)
            {
              //  row.Columns[i].Row = row;
                CellUpdateInsertArgument ea = new CellUpdateInsertArgument();
                if (isInsert)
                {
                    ea.m_Insert = true;
                    ea.m_Update = false;
                }
                else
                {
                    ea.m_Update = true;
                    ea.m_Insert = false;
                }
                ea.Name = row.Columns[i].ColumnId;
                ea.Column = row.Columns[i];
                ea.PostBackValue = row[ea.Name].PostBackValue;
                ea.Value = row[ea.Name].Value;
                ea.DataSourceValue = row[ea.Name].DataSourceValue;

                if (row.m_Table.m_Grid.Trace.IsTracing)
                    row.m_Table.m_Grid.Trace.Trace(
                        isInsert
                            ? "{0} on insert has value '{1}' and old value was '{2}'"
                            : "{0} on update has value '{1}' and old value was '{2}'", ea.Name,
                        ea.Value,
                        ea.DataSourceValue);

                if (row.Columns[i].IsInDataSource == false || row.Columns[i].ColumnType == ColumnType.SystemColumn)
                    ea.IgnoreChanges = true;
                if (row.Columns[i].Identity)
                {
                    ea.IgnoreChanges = true;
                    identity = true;
                    if (editIndex == null && row[i].Value != null)
                        editIndex = row[i].Value.ToString();
                }
                if (ea.IgnoreChanges == false)
                    columnArgs.AcceptChanges = true;
                columnArgs.Row.Add(ea.Name, ea);
            }

            row.m_Table.m_Grid.BeforeUpdateInsertEvent(columnArgs);

            for (int i = 0; i < row.Columns.Count; i++)
                if (row.Columns[i].ColumnType == ColumnType.Foreignkey == false && row.Columns[i].IsInDataSource &&
                    row.Columns[i].ColumnType == ColumnType.SystemColumn == false)
                    row[row.Columns[i].ColumnId].Value = columnArgs.Row[row.Columns[i].ColumnId].Value;

            if (columnArgs.AcceptChanges == false || row.m_Table.m_Grid.SystemMessage.Count > 0)
                return false;

            if (String.IsNullOrEmpty(row.m_Table.DataSourceId) && row.m_Table.DataSource == null)
                return true; // No datasources.

            InsertUpdate updateColumn = null;
            bool updates = false;
            if ((String.IsNullOrEmpty(row.m_Table.m_Grid.DataSourceId) ||
                 row.m_Table.DataSourceType != DataSourceControlType.InternalDataSource) && isInsert)
            {
                if ( row.m_Table.DataSource is XmlDataDocument == false)
                    row.m_DataRow = row.m_Table.m_DataSourceColumns.NewRow();
                else
                {
                    // Detect if any node has child nodes.
                    XmlDataDocument xmldoc =  row.m_Table.DataSource as XmlDataDocument;

                    if (xmldoc != null && xmldoc.DocumentElement != null)
                    {
                        XmlNodeList nodeList = xmldoc.
                            DocumentElement.SelectNodes(
                            row.m_Table.m_Xmlxpath);
                        if (nodeList != null)
                            foreach (XmlNode xmlNode in nodeList)
                            {
                                DataRow myrow =
                                    ((XmlDataDocument)  row.m_Table.DataSource).GetRowFromElement(
                                        (XmlElement) xmlNode);
                                if (myrow == null)
                                    continue;

                                if (!xmlNode.HasChildNodes) continue;
                                row.m_Table.m_Grid.SystemMessage.Add(
                                    "This Xml node has child nodes and can only be updated or removed from the loaded XML document.");
                                return false;
                            }
                    }
                    else
                        throw new GridException("XmlDataDocument is null or have a invalid root element (DocumentElement is null)");
                    updates = true;
                    row.m_DataRow = row.m_Table.m_DataSourceColumns.NewRow();
                }
            }

            if (row.DataRow == null)
            {
                string datasourcetable = row.m_Table.DataSourceId;
                if (Grid.DATASOURCEID_NULL == datasourcetable)
                    datasourcetable = row.Columns.Primarykeys[0].DataSourceId ?? row.Columns.Primarykeys[0].DefaultDataSourceId;
                updateColumn =
                    new InsertUpdate(datasourcetable, QueryType.Update,
                                     row.m_Table.m_Grid.ActiveConnectionString);
                if (isInsert)
                    updateColumn.QueryType = QueryType.Insert;
                else
                    updateColumn.FilterExpression = BuildPKFilter(row.m_Table, editIndex, true);
            }
            else
            {
                if ( row.m_Table.DataSource is XmlDataDocument && isInsert == false)
                {
                    if (((XmlDataDocument) row.m_Table.DataSource).DocumentElement == null)
                        throw new GridException("Root of your XmlDocument is null" + row.m_Table.DataSource);
                    List<Column> datacolumns = row.m_Table.Columns.Primarykeys;

                    XmlNodeList nodeList = ((XmlDataDocument)row.m_Table.DataSource).DocumentElement.
                        SelectNodes(
                        row.m_Table.m_Xmlxpath);

                    if (nodeList != null)
                        foreach (XmlNode xmlNode in nodeList)
                        {
                            DataRow myrow =
                                ((XmlDataDocument)row.m_Table.DataSource).GetRowFromElement(
                                    (XmlElement) xmlNode);
                            if (myrow == null)
                                continue;

                            if (xmlNode.HasChildNodes)
                            {
                                if (DetectDataSourceRow(row.m_DataRow, myrow, datacolumns))
                                {
                                    row.m_DataRow = myrow;
                                    updates = true;
                                    break;
                                }
                            }
                            else if (DetectDataSourceRow(row.m_DataRow, myrow, datacolumns))
                            {
                                updates = true;
                                row.m_DataRow = myrow;
                                break;
                            }
                        }
                }
            }

            try
            {
                for (int i = 0; i < row.Columns.Count; i++)
                {
                    if (row.Columns[i].IsInDataSource == false || row.Columns[i].ColumnType == ColumnType.SystemColumn ||
                        !String.IsNullOrEmpty(row.Columns[i].DataSourceId) &&
                        row.Columns[i].ColumnType != ColumnType.Foreignkey &&
                        row.Columns[i].DataSourceId.Equals(row.m_Table.DataSourceId) == false)
                        continue;

                    CellUpdateInsertArgument ea = columnArgs.Row[row.Columns[i].ColumnId];

                   if ( ReferenceEquals(Grid.NULLCONSTANT, ea.Value) || ea.Value == null)
                        ea.Value = DBNull.Value;

                    if (row.Columns[i].ColumnType == ColumnType.Foreignkey == false)
                        row.Columns[i].OnUpdateInsert(ea, row[row.Columns[i].ColumnId]);

                    if (row.m_Table.m_Grid.SystemMessage.Count > 0)
                        return false;

                    if (ea.IgnoreChanges || (row.Columns[i].AllowEdit == false &&
                                             (isInsert == false ||
                                              (row.Columns[i].Primarykey == false &&
                                               (row.Columns[i].Required == false &&
                                                row.Columns[i].IsInDataSource == false)))) ||
                        (row.m_Table.m_Grid.DisplayView == DisplayView.Grid &&
                         row.Columns[i].AllowEditInGrid == false) ||
                        (ea.Value == ea.DataSourceValue && isInsert == false))
                    {
                        StringBuilder reason = new StringBuilder();

                        if (ea.IgnoreChanges)
                            reason.Append("ignore");
                        if (isInsert && row.Columns[i].Primarykey == false)
                            reason.Append(" was not primary key on insert");
                        if (row.m_Table.m_Grid.Trace.IsTracing)
                            row.m_Table.m_Grid.Trace.Trace(
                                isInsert
                                    ? "skipping {0} on insert has value '{1}' and old value was '{2}' (reason: {3})"
                                    : "skipping {0} on update has value '{1}' and old value was '{2}' (reason: {3})",
                                ea.Name, ea.Value, ea.DataSourceValue, reason.ToString());

                        continue;
                    }

                    switch (row.Columns[i].ColumnType)
                    {
                        case ColumnType.File:
                        case ColumnType.Image:
                            if (row.Columns[i].IsBlob == false &&
                                row.Columns[i].FileNameColumn != row.Columns[i].ColumnId)
                                continue;
                            if (ea.Parameter != null && row.Columns[i].FileNameColumn != row.Columns[i].ColumnId)
                            {
                                if (row.DataRow == null)
                                    updateColumn.Add(row.Columns[i].ColumnId, (BinaryReader) ea.Parameter);
                                else if (row.DataRow.Table.Columns.Contains(row.Columns[i].ColumnId))
                                    row.DataRow[row.Columns[i].ColumnId] = ea.Parameter;
                            }
                            else if (Grid.GotHttpContext &&row.Columns[i].FileNameColumn == row.Columns[i].ColumnId &&
                                     HttpContext.Current.Session[row[row.Columns[i].ColumnId].CellClientId + "_img"] != null)
                            {
                                object myvalue = HttpContext.Current.Session[row[row.Columns[i].ColumnId].CellClientId + "_img"];
                                if (row.DataRow == null)
                                    updateColumn.Add(row.Columns[i].ColumnId, myvalue);
                                else if (row.DataRow.Table.Columns.Contains(row.Columns[i].ColumnId))
                                    row.DataRow[row.Columns[i].ColumnId] = myvalue;
                            }
                            break;
                        default:
                            if (row.DataRow == null)
                            {
                                if (updateColumn != null)
                                    updateColumn.Add(row.Columns[i].ColumnId, ea.Value);
                            }
                            else if (row.DataRow.Table.Columns.Contains(row.Columns[i].ColumnId))
                                row.DataRow[row.Columns[i].ColumnId] = ea.Value;
                            break;
                    }
                    updates = true;
                }
            }
            catch (Exception ee)
            {
                throw new GridDataSourceException("Error generating update/insert sql", ee);
            }
            if (row.m_Table.m_Grid.Debug && updateColumn != null)
                row.m_Table.m_Grid.m_DebugString.AppendFormat("<b>Datainterface.InsertUpdateRow</b> - {0}<br/>",
                                                              updateColumn.GetQueryString());

            string res = null;
            if (updates)
            {
                try
                {
                    if (row.DataRow == null && row.m_Table.DataSource == null)
                        res = updateColumn.Execute();
                    else
                    {
                        if ( row.m_Table.DataSource != null &&
                             row.m_Table.DataSource is OleDbDataAdapter)
                        {
                            OleDbCommandBuilder updateCommand =
                                new OleDbCommandBuilder((OleDbDataAdapter)  row.m_Table.DataSource);
                            if (isInsert)
                                row.DataRow.Table.Rows.Add(row.DataRow);

                            ((OleDbDataAdapter)  row.m_Table.DataSource).Update(row.DataRow.Table);
                            updateCommand.Dispose();
                        }
                        else if (row.m_Table.m_XmlDataDocument != null)
                        {
                            try
                            {
                                if (isInsert)
                                    row.DataRow.Table.Rows.Add(row.DataRow);
                               row.m_Table.m_XmlDataSet.WriteXml(row.m_Table.m_XmlDataDocument);
                            }
                            catch (Exception ee)
                            {
                                throw new GridDataSourceException("Error processing xml for updating/inserting", ee);
                            }
                        }
                        else
                        {
                            if (isInsert && row.DataRow != null)
                                row.DataRow.Table.Rows.Add(row.DataRow);
                            switch (row.m_Table.DataSourceType)
                            {
                                case DataSourceControlType.SqlDataSource:
                                case DataSourceControlType.AccessDataSource:
                                    UpdateInsertDataSourceControl(row, isInsert);
                                    break;
                                case DataSourceControlType.ObjectDataSource:
                                    UpdateInsertObjectDataSourceControl(row, isInsert);
                                    break;
                                default:
                                    row.m_Table.m_Grid.BindDataSourceSession();
                                    break;
                            }
                        }
                    }
                }
                catch (Exception ee)
                {
                    if (updateColumn != null)
                        throw new GridDataSourceException("Error executing insert/update sql", ee);
                    throw new GridDataSourceException("Error updating data source", ee);
                }
                if (res != null && isInsert)
                {
                    editIndex = res;

                    foreach (Column column in row.m_Table.Columns)
                    {
                        if (!column.Identity)
                            continue;
                        row[column.ColumnId].Value = editIndex;
                        break;
                    }
                }
            }

            for (int i = 0; i < row.Columns.Count; i++)
                if (!String.IsNullOrEmpty(row.Columns[i].DataSourceId) &&
                    row.m_Table.m_Grid[row.Columns[i].ColumnId].ColumnType == ColumnType.Foreignkey == false)
                    row.Columns[i].UpdateInsertColumnDataSourceId(row, columnArgs, editIndex);
            if (identity == false)
                editIndex = row.PrimaryKeyUpdateValues;
            return true;
        }
示例#7
0
文件: Image.cs 项目: webgrid/WebGrid
        private void OnUpdateInsertDataSource(CellUpdateInsertArgument ea,RowCell cell)
        {
            if (!Grid.GotHttpContext)
                return;
            if (HttpContext.Current.Session[cell.CellClientId + "_imgdata"] == null)
            {
                ea.IgnoreChanges = true;
                return;
            }
            BinaryReader br;
            switch (FileTemporaryMode)
            {
                case FileTemporaryMode.Memory:

                    System.Drawing.Image img = (System.Drawing.Image)HttpContext.Current.Session[cell.CellClientId + "_imgdata"];

                    //if (Sizes.Count > 0)
                    //    img = Sizes[0].Resize(img);

                    MemoryStream ms = new MemoryStream();
                    img.Save(ms, img.RawFormat);
                    br = new BinaryReader(ms);

                    br.BaseStream.Position = 0;
                    ea.Parameter = br;
                    ea.IgnoreChanges = false;
                    break;
                case FileTemporaryMode.File:
                    {
                        FileStream fs =
                            System.IO.File.Open((string)HttpContext.Current.Session[cell.CellClientId + "_imgdata"],
                                                FileMode.Open, FileAccess.Read, FileShare.Read);
                        br = new BinaryReader(fs);
                        fs.Close();
                        br.BaseStream.Position = 0;
                        ea.Parameter = br;
                        ea.IgnoreChanges = false;
                    }
                    break;
            }
        }
示例#8
0
文件: Image.cs 项目: webgrid/WebGrid
        internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
        {
            if (!Grid.GotHttpContext || HttpContext.Current.Session == null)
                return;
            if (IsBlob == false && System.IO.Directory.Exists(AbsoluteDirectory) == false)
                throw new GridException(
                    string.Format("Upload directory for '{0}' does not exist ({1})", Title,
                                  AbsoluteDirectory));

            // Should we remove the file in DB?
            string strDelete = HttpContext.Current.Request[cell.CellClientId + "_delete"];

            if (strDelete != null && String.Compare(strDelete, "TRUE") == 0)
            {
                if (IsBlob == false)
                {
                    string filename;
                    if (FileNameOption == FileNameOption.UsePrimaryKey)
                        filename =
                            string.Format("{0}{1}_{2}.{3}", AbsoluteDirectory, cell.Row.PrimaryKeyUpdateValues,
                                          ColumnId, GetExtension(Value(cell)));
                    else
                        filename = AbsoluteDirectory + Value(cell);
                    if (System.IO.File.Exists(filename))
                    {
                        try
                        {
                            System.IO.File.Delete(filename);
                        }
                        catch (Exception ee)
                        {
                            Grid.SystemMessage.Add(
                                string.Format("Warning: failed to remove file associated with column '{0}'", Title));
                            if (Grid.Debug)
                                Grid.m_DebugString.Append(ee.Message);
                        }
                    }
                    if (FileNameColumn == ColumnId)
                    {
                        cell.Value = null;
                        cell.PostBackValue = null;
                    }
                }
                ea.IgnoreChanges = false;
               // ea.Value = Grid.NULLCONSTANT;
                ea.AddApostrophe = false;

                if (FileNameColumn != null && FileNameColumn != ColumnId)
                    cell.Row[FileNameColumn].Value = null;

                // TODO: Should delete old image if not blob.
                return;
            }

            ea.IgnoreChanges = true;
            if (!Grid.GotHttpContext || HttpContext.Current.Session[cell.CellClientId + "_img"] == null)
                // No image!
                return;
            if (IsBlob)
            {
                OnUpdateInsertDataSource(ea,cell);
                return;
            }
            ea.Parameter = null;
            ea.IgnoreChanges = false;

            ea.Value = HttpContext.Current.Session[cell.CellClientId + "_img"].ToString();
        }
示例#9
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     return;
 }
示例#10
0
 // 2004.10.27, jorn - Added this, because bits must always be updated. Stupid HTML!
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     ea.AddApostrophe = false;
     ea.IgnoreChanges = false;
 }
示例#11
0
 // 2004.10.27, jorn - Added this, because bits must always be updated. Stupid HTML!
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     ea.AddApostrophe = false;
     ea.IgnoreChanges = false;
 }
示例#12
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     return;
 }
示例#13
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     ea.IgnoreChanges = true;
 }
示例#14
0
        internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
        {
            if (!Grid.GotHttpContext || HttpContext.Current.Session == null)
            {
                return;
            }
            if (IsBlob == false && System.IO.Directory.Exists(AbsoluteDirectory) == false)
            {
                throw new GridException(
                          string.Format("Upload directory for '{0}' does not exist ({1})", Title,
                                        AbsoluteDirectory));
            }
            string uniqueID = cell.CellClientId;
            // Should we remove the file in DB?
            string strDelete = HttpContext.Current.Request[uniqueID + "_delete"];

            if (strDelete != null && String.Compare(strDelete, "TRUE") == 0)
            {
                if (IsBlob == false)
                {
                    string filename;
                    if (FileNameOption == FileNameOption.UsePrimaryKey)
                    {
                        filename =
                            string.Format("{0}{1}_{2}.{3}", AbsoluteDirectory, cell.Row.PrimaryKeyUpdateValues,
                                          ColumnId, GetExtension(Value(cell)));
                    }
                    else
                    {
                        filename = AbsoluteDirectory + Value(cell);
                    }
                    if (System.IO.File.Exists(filename))
                    {
                        try
                        {
                            System.IO.File.Delete(filename);
                        }
                        catch (Exception ee)
                        {
                            Grid.SystemMessage.Add(
                                string.Format("Warning: failed to remove file associated with column '{0}'", Title));
                            if (Grid.Debug)
                            {
                                Grid.m_DebugString.Append(ee.Message);
                            }
                        }
                    }
                    if (FileNameColumn == ColumnId)
                    {
                        cell.Value = null;
                    }
                }
                ea.IgnoreChanges = false;
                // ea.Value = Grid.NULLCONSTANT;
                ea.AddApostrophe = false;

                if (FileNameColumn != null && FileNameColumn != ColumnId)
                {
                    cell.Row[FileNameColumn].Value = null;
                }

                // TODO: Should delete old image if not blob.
                return;
            }

            ea.IgnoreChanges = true;
            if (!Grid.GotHttpContext || HttpContext.Current.Session[uniqueID + "_img"] == null)
            {
                return;
            }
            if (IsBlob)
            {
                OnUpdateInsertDataSource(ea, cell);
                return;
            }
            ea.Parameter     = null;
            ea.IgnoreChanges = false;

            ea.Value = HttpContext.Current.Session[uniqueID + "_img"].ToString();
        }
示例#15
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     base.OnUpdateInsert(ea, cell);
     ea.AddApostrophe = false;
 }