Example #1
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     base.OnUpdateInsert(ea, cell);
     if (ea.IgnoreChanges) return;
     ea.AddApostrophe = false;
 }
Example #2
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;
        }
Example #3
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     base.OnUpdateInsert(ea, cell);
     ea.AddApostrophe = false;
 }
Example #4
0
        /// <summary>
        /// Used to validate data source against on update insert.
        /// </summary>
        /// <param name="ea">insertupdate argument</param>
        /// <param name="cell">Rowcell</param>
        internal virtual void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
        {
            // Fix value
            ea.AddApostrophe = true;

            if (IsInDataSource == false || (ea.Value != null && ea.Value.Equals(cell.DataSourceValue)) || (( ea.Value == DBNull.Value) && (ea.DataSourceValue == null)) )
                ea.IgnoreChanges = true;
            if (ea.Value == null)
                ea.AddApostrophe = false;
        }
Example #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;
            }
        }
Example #6
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();
        }
Example #7
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     return;
 }
Example #8
0
 internal override void OnUpdateInsert(CellUpdateInsertArgument ea, RowCell cell)
 {
     ea.IgnoreChanges = true;
 }
Example #9
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);
        }