Ejemplo n.º 1
0
        public override bool Update()
        {
            ExecSQLX E = new ExecSQLX(string.Format("update {0}.SGEtalons set dt=@dt, IsOn='{1}' where typeSize='{2}' and sGroup='{3}' and id={4}",
                                                    BaseItem.Schema,
                                                    IsOn ? "true" : "false",
                                                    ownKey.TSName,
                                                    ownKey.GroupName,
                                                    Id.ToString()));

            E.AddParam("@dt", SqlDbType.DateTime, Dt);
            pr("Update");
            bool ret = E.Exec() == 1;

            if (!ret)
            {
                Select S = new Select(string.Format("SELECT dt from {0}.SGEtalons where typeSize='{1}' and sGroup='{2}' and id={3}",
                                                    BaseItem.Schema,
                                                    ownKey.TSName,
                                                    ownKey.GroupName,
                                                    Id.ToString()
                                                    ));
                if (!S.Read())
                {
                    throw new Exception("Etalon: не могу получить предыдуще значения");
                }
                Dt   = (DateTime)S["dt"];
                IsOn = Convert.ToBoolean(S["IsOn"]);
                S.Dispose();
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public override bool Update()
        {
            pr("Tube.Update()");
            ExecSQLX E = new ExecSQLX(string.Format("update {0}.SGTubes set dt=@dt, name='{1}', sGroup='{2}' where id={3}",
                                                    BaseItem.Schema,
                                                    Name,
                                                    SG,
                                                    Id.ToString()
                                                    ));

            E.AddParam("@dt", SqlDbType.DateTime, Dt);
            bool ret = E.Exec() == 1;

            if (!ret)
            {
                Select S = new Select(string.Format("SELECT dt, name, sGroup from {0}.SGTubes where Id={1}",
                                                    BaseItem.Schema, Id.ToString()));
                if (!S.Read())
                {
                    throw new Exception("Tube: не могу получить предыдуще значения");
                }
                Dt   = (DateTime)S["dt"];
                Name = S["name"] as string;
                SG   = S["sGroup"] as string;
                S.Dispose();
            }
            return(ret);
        }
Ejemplo n.º 3
0
        public override void Save(ParMainLite _O)
        {
            L.Clear();
            ExecSave(_O, (_O as IParentBase).PropertyName);
            MemoryStream ms = new MemoryStream();
            StreamWriter sw = new StreamWriter(ms, Encoding.GetEncoding(1251));

            foreach (Param p in L)
            {
                sw.WriteLine(p.ToString());
            }
            sw.Flush();
            string img = Encoding.GetEncoding(1251).GetString(ms.ToArray());

            sw.Dispose();
            ms.Dispose();
            ExecSQLX E = new ExecSQLX(string.Format("update {0} set Val=@textdata where Unit='{1}'",
                                                    schema + "." + table_name, Unit));

            E.AddParam("@textdata", SqlDbType.Text, img, img.Length);
            int ret = E.Exec();

            if (ret == 0)
            {
                ExecSQLX EE = new ExecSQLX(string.Format("insert into {0} values('{1}',@textdata)",
                                                         schema + "." + table_name, Unit));
                EE.AddParam("@textdata", SqlDbType.Text, img, img.Length);
                int aaa = EE.Exec();
            }
        }
Ejemplo n.º 4
0
        protected override bool SetImg(string _data)
        {
            ExecSQLX E = new ExecSQLX(string.Format("update {0}.SGEtalons set img=@textdata where typesize='{1}' and sGroup='{2}' and id={3}",
                                                    BaseItem.Schema, ownKey.TSName, ownKey.GroupName, Id.ToString()));

            E.AddParam("@textdata", SqlDbType.Text, _data, _data.Length);
            return(E.Exec() == 1);
        }
Ejemplo n.º 5
0
        protected override bool SetImg(string _data)
        {
            ExecSQLX E = new ExecSQLX(string.Format("update {0}.SGTubes set img=@textdata where id={1}",
                                                    BaseItem.Schema, Id.ToString()));

            E.AddParam("@textdata", SqlDbType.Text, _data, _data.Length);
            return(E.Exec() == 1);
        }