Ejemplo n.º 1
0
 public void Save(Context context)
 {
     if (context.ExportMode || updateAttr[Constants.updateAttrCreated])
     {
         GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisRanges");
         cmd.AddInt("Id", id);
         cmd.AddInt("TypeId", type.Id);
         context.Buf.SetRect(cmd.AddBinary("Code"), bounds);
         cmd.ExecuteNonQuery();
         if (!context.ExportMode)
         {
             updateAttr = 0;
         }
     }
     if (context.Filter == null)
     {
         return;
     }
     if (!context.Filter.Includes(BatchLevel.Object))
     {
         return;
     }
     if (objects != null)
     {
         foreach (GObject obj in objects)
         {
             obj.Save(context);
         }
     }
 }
Ejemplo n.º 2
0
 public void Save(Context context)
 {
     if (this.IsOverall)
     {
         return;
     }
     if (context.ExportMode || updateAttr[Constants.updateAttrCreated])
     {
         GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisViews");
         cmd.AddInt("Id", id);
         cmd.AddInt("Attr", attr);
         cmd.AddString("Name", name, MaxLength.Name);
         context.Buf.SetIntArray(cmd.AddBinary("Code"), GetIntArray());
         cmd.ExecuteNonQuery();
     }
     else if (updateAttr.NonEmpty)
     {
         GmCommand cmd     = context.Conn.CreateCommand();
         string    cmdText = "";
         if (updateAttr[(int)ViewField.Attr])
         {
             cmdText += "Attr= @Attr,";
             cmd.AddInt("Attr", attr);
         }
         if (updateAttr[(int)ViewField.Name])
         {
             cmdText += "Name= @Name,";
             cmd.AddString("Name", name, MaxLength.Name);
         }
         if (updateAttr[(int)ViewField.Code])
         {
             cmdText += "Code= @Code,";
             context.Buf.SetIntArray(cmd.AddBinary("Code"), this.GetIntArray());
         }
         Geomethod.StringUtils.RemoveLastChar(ref cmdText);
         cmd.CommandText = "update gisViews set " + cmdText + " where Id= @Id";
         cmd.AddInt("Id", id);
         cmd.ExecuteNonQuery();
     }
     if (!context.ExportMode)
     {
         updateAttr = 0;
     }
 }
Ejemplo n.º 3
0
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddString("Name", name);
            cmd.AddBinary("Permissions", permissions.GetBytes());
            cmd.AddInt("WatchingGroupId", watchingGroupId);
            if (id == 0)
            {
                cmd.CommandText = "insert into Roles values (@Name,@Permissions,@WatchingGroupId) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                cmd.CommandText = "update Roles set Name=@Name, Permissions=@Permissions, WatchingGroupId=@WatchingGroupId where Id=@Id";
                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 4
0
        public void Save(GmConnection conn)
        {
            GmCommand cmd = conn.CreateCommand();

            cmd.AddInt("Id", id);
            cmd.AddString("Name", name);
            cmd.AddInt("RoleId", roleId);
            cmd.AddString("Login", login);
            cmd.AddString("Password", password);
            cmd.AddBinary("Permissions").Value = permissions.Count == 0 ? (object)DBNull.Value : (object)permissions.GetBytes();
            if (id == 0)
            {
                cmd.CommandText = "insert into Users values (@Name,@RoleId,@Login,@Password,@Permissions) select @@Identity";
                id = (int)(decimal)cmd.ExecuteScalar();
            }
            else
            {
                string pswCmdText = password.Trim().Length == 0 ? "" : ",Password=@Password";
                cmd.CommandText = string.Format("update Users set Name=@Name,RoleId=@RoleId,Login=@Login{0},Permissions=@Permissions where Id=@Id", pswCmdText);
                cmd.ExecuteNonQuery();
            }
        }
Ejemplo n.º 5
0
        public void Save(Context context)
        {
            if (context.ExportMode || updateAttr[Constants.updateAttrCreated])
            {
                GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisLib");
                cmd.AddInt("Id", id);
                cmd.AddInt("Attr", attr);
                cmd.AddString("Name", name, MaxLength.Name);
                cmd.AddString("Style", styleStr, MaxLength.Style);

//      DZ      14.01.08
//                if( defaultStyleStr == "" )
//                    cmd.AddString( "DefaultStyle", /*defaultStyleStr*/ " ", MaxLength.Style );
//                else
                cmd.AddString("DefaultStyle", defaultStyleStr, MaxLength.Style);
                cmd.AddInt("SMin", smin);
                cmd.AddInt("SMax", smax);
                cmd.AddBinary("Code", context.Buf.SetRect(bounds));
                cmd.AddBinary("IndexerCode", context.Buf.SetIntArray(indexer.ToIntArray()));
                cmd.AddBinary("Scales", context.Buf.SetIntArray(scales.Values));
                cmd.ExecuteNonQuery();
            }
            else if (updateAttr.NonEmpty)
            {
                GmCommand cmd     = context.Conn.CreateCommand();
                string    cmdText = "";
                if (updateAttr[(int)LibField.Attr])
                {
                    cmdText += "Attr= @Attr,";
                    cmd.AddInt("Attr", attr);
                }
                if (updateAttr[(int)LibField.Name])
                {
                    cmdText += "Name= @Name,";
                    cmd.AddString("Name", name, MaxLength.Name);
                }
                if (updateAttr[(int)LibField.Style])
                {
                    cmdText += "Style= @Style,";
                    cmd.AddString("Style", styleStr, MaxLength.Style);
                }
                if (updateAttr[(int)LibField.DefaultStyle])
                {
                    cmdText += "DefaultStyle= @DefaultStyle,";
                    cmd.AddString("DefaultStyle", defaultStyleStr, MaxLength.Style);
                }
                if (updateAttr[(int)LibField.SMin])
                {
                    cmdText += "SMin= @SMin,";
                    cmd.AddInt("SMin", smin);
                }
                if (updateAttr[(int)LibField.SMax])
                {
                    cmdText += "SMax= @SMax,";
                    cmd.AddInt("SMax", smax);
                }
                if (updateAttr[(int)LibField.Code])
                {
                    cmdText += "Code= @Code,";
                    cmd.AddBinary("Code", context.Buf.SetRect(bounds));
                }
                if (updateAttr[(int)LibField.IndexerCode])
                {
                    cmdText += "IndexerCode= @IndexerCode,";
                    cmd.AddBinary("IndexerCode", context.Buf.SetIntArray(indexer.ToIntArray()));
                }
                if (updateAttr[(int)LibField.Scales])
                {
                    cmdText += "Scales= @Scales,";
                    cmd.AddBinary("Scales", context.Buf.SetIntArray(scales.Values));
                }
                Geomethod.StringUtils.RemoveLastChar(ref cmdText);
                cmd.CommandText = "update gisLib set " + cmdText + " where Id= @Id";
                cmd.AddInt("Id", id);
                cmd.ExecuteNonQuery();
            }
            if (!context.ExportMode)
            {
                updateAttr = 0;
            }

            if (context.Filter != null && context.Filter.Includes(BatchLevel.Type))
            {
                if (types != null)
                {
                    foreach (GType type in types)
                    {
                        type.Save(context);
                    }
                }
            }

            if (context.ExportMode)
            {
                idGenerator.Save(context.TargetConn);
            }
            colors.Save(context);
            layers.Save(context);
            views.Save(context);
            bgImages.Save(context);
            customTables.Save(context);
        }
Ejemplo n.º 6
0
 public void Save(Context context)
 {
     if (context.ExportMode || updateAttr[Constants.updateAttrCreated])
     {
         GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisBg");
         cmd.AddInt("Id", id);
         cmd.AddInt("Attr", attr);
         cmd.AddString("Style", styleStr, MaxLength.Style);
         cmd.AddString("TextAttr", textAttr, MaxLength.TextAttr);
         cmd.AddString("FilePath", filePath, MaxLength.FilePath);
         cmd.AddInt("SMin", smin);
         cmd.AddInt("SMax", smax);
         context.Buf.SetIntArray(cmd.AddBinary("Code"), GetIntArray());
         cmd.ExecuteNonQuery();
     }
     else if (updateAttr.NonEmpty)
     {
         GmCommand cmd     = context.Conn.CreateCommand();
         string    cmdText = "";
         if (updateAttr[(int)BgImageField.Attr])
         {
             cmdText += "Attr= @Attr,";
             cmd.AddInt("Attr", attr);
         }
         if (updateAttr[(int)BgImageField.Style])
         {
             cmdText += "Style= @Style,";
             cmd.AddString("Style", styleStr, MaxLength.Style);
         }
         if (updateAttr[(int)BgImageField.TextAttr])
         {
             cmdText += "TextAttr= @TextAttr,";
             cmd.AddString("TextAttr", textAttr, MaxLength.TextAttr);
         }
         if (updateAttr[(int)BgImageField.FilePath])
         {
             cmdText += "FilePath= @FilePath,";
             cmd.AddString("FilePath", filePath, MaxLength.FilePath);
         }
         if (updateAttr[(int)BgImageField.SMin])
         {
             cmdText += "SMin= @SMin,";
             cmd.AddInt("SMin", smin);
         }
         if (updateAttr[(int)BgImageField.SMax])
         {
             cmdText += "SMax= @SMax,";
             cmd.AddInt("SMax", smax);
         }
         if (updateAttr[(int)BgImageField.Code])
         {
             cmdText += "Code= @Code,";
             context.Buf.SetIntArray(cmd.AddBinary("Code"), this.GetIntArray());
         }
         Geomethod.StringUtils.RemoveLastChar(ref cmdText);
         cmd.CommandText = "update gisBg set " + cmdText + " where Id= @Id";
         cmd.AddInt("Id", id);
         cmd.ExecuteNonQuery();
     }
     if (!context.ExportMode)
     {
         updateAttr = 0;
     }
 }
Ejemplo n.º 7
0
 public void Save(Context context)
 {
     if (!context.ExportMode && range.NotSaved)
     {
         range.Save(context);
     }
     if (context.ExportMode || updateAttr[Constants.updateAttrCreated])
     {
         GmCommand cmd = context.TargetConn.CreateCommandById("insertIntoGisObjects");
         cmd.AddInt("Id", id);
         cmd.AddInt("TypeId", range.Type.Id);
         cmd.AddInt("RangeId", range.Id);
         cmd.AddInt("Attr", attr);
         cmd.AddString("Name", name, MaxLength.Name);
         cmd.AddString("Caption", caption, MaxLength.Caption);
         cmd.AddString("Style", styleStr, MaxLength.Style);
         cmd.AddString("TextAttr", textAttr, MaxLength.TextAttr);
         SetCode(context, cmd.AddBinary("Code"));
         cmd.ExecuteNonQuery();
     }
     else if (updateAttr.NonEmpty)
     {
         GmCommand cmd     = context.Conn.CreateCommand();
         string    cmdText = "";
         if (updateAttr[(int)ObjectField.TypeId])
         {
             cmdText += "TypeId= @TypeId,";
             cmd.AddInt("TypeId", range.Type.Id);
         }
         if (updateAttr[(int)ObjectField.RangeId])
         {
             cmdText += "RangeId= @RangeId,";
             cmd.AddInt("RangeId", range.Id);
         }
         if (updateAttr[(int)ObjectField.Attr])
         {
             cmdText += "Attr= @Attr,";
             cmd.AddInt("Attr", attr);
         }
         if (updateAttr[(int)ObjectField.Name])
         {
             cmdText += "Name= @Name,";
             cmd.AddString("Name", name, MaxLength.Name);
         }
         if (updateAttr[(int)ObjectField.Caption])
         {
             cmdText += "Caption= @Caption,";
             cmd.AddString("Caption", caption, MaxLength.Caption);
         }
         if (updateAttr[(int)ObjectField.Style])
         {
             cmdText += "Style= @Style,";
             cmd.AddString("Style", styleStr, MaxLength.Style);
         }
         if (updateAttr[(int)ObjectField.TextAttr])
         {
             cmdText += "TextAttr= @TextAttr,";
             cmd.AddString("TextAttr", textAttr, MaxLength.TextAttr);
         }
         if (updateAttr[(int)ObjectField.Code])
         {
             cmdText += "Code= @Code,";
             SetCode(context, cmd.AddBinary("Code"));
         }
         Geomethod.StringUtils.RemoveLastChar(ref cmdText);
         cmd.CommandText = "update gisObjects set " + cmdText + " where Id= @Id";
         cmd.AddInt("Id", id);
         cmd.ExecuteScalar();
     }
     if (!context.ExportMode)
     {
         updateAttr = 0;
     }
 }