Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public void ToPrettyString_Works()
        {
            var metadata = new MetaData();
            metadata.BuildType = BuildType.Debug;
            metadata.ClrVersion = "3.0";
            metadata.FullName = "Assembly.dll";
            metadata.Platform = Platform.x64;
            metadata.References = new[] { "mscorlib.dll" };
            metadata.Type = AssemblyType.ConsoleApp;
            metadata.Version = "1.0";

            string expected =
            @"General:
            FullName = Assembly.dll
            Version = 1.0
            Platform = x64
            BuildType = Debug
            CLR Version = 3.0
            Type = ConsoleApp

            References:
            mscorlib.dll

            Attributes:
            ";

            Assert.AreEqual(expected, metadata.ToPrettyString());
        }
Exemplo n.º 2
0
        public Stream RenderHTML(ICollection<Result> results, MetaData metaData)
        {
            RenderMetaData(metaData);
            var body = BaseTemplate.DocumentNode.SelectSingleNode("//body");
            body.ChildNodes.Add(MetaDataTemplate.DocumentNode);

            int i = 0;
            foreach (var r in results)
            {
                var div = HtmlNode.CreateNode("<div></div>");
                div.CopyFrom(TableTemplate.DocumentNode.SelectSingleNode("//div"), false);
                div.InnerHtml = div.InnerHtml.Replace("{{CLASS_NAME}}", r.ClassName);
                foreach (var ri in r.Items)
                {
                    var beforeCol = ri.Before.Split(' ');
                    string before = beforeCol.Length > 1 ? String.Format("<span class=\"datatype\"> {0} </span>{1}", beforeCol[0], beforeCol[1]) : ri.Before;

                    var afterCol = ri.After.Split(' ');
                    string after = afterCol.Length > 1 ? String.Format("<span class=\"datatype\"> {0} </span>{1}", afterCol[0], afterCol[1]) : ri.After;

                    string type = String.Format("<span class=\"{0}\">{0}</span", ri.Type);
                    var node = HtmlNode.CreateNode(String.Format("<tr class=\"{0} child\"><td>{1}</td><td>{2}</td><td>{3}</td></tr>", i % 2 == 0 ? "even" : "odd", type, before, after));
                    div.SelectSingleNode("//table").ChildNodes.Add(node);
                    i++;
                }
                i = 0;
                body.ChildNodes.Add(div);
            }

            var stream = new MemoryStream();
            BaseTemplate.Save(stream);

            return stream;
        }
Exemplo n.º 3
0
 public Command(string identifier, string value, StatementType statementType, MetaData<IMeta> metaData, bool rcon)
     : base(statementType, metaData)
 {
     Identifier = identifier;
     Value = value;
     RCON = rcon;
 }
Exemplo n.º 4
0
        public Flv(FileInfo file, bool generateMetadata)
        {
            _file = file;
            _generateMetadata = generateMetadata;
            int count = 0;

            if (!_generateMetadata)
            {
                try
                {
                    FlvReader reader = new FlvReader(_file);
                    ITag tag = null;
                    while (reader.HasMoreTags() && (++count < 5))
                    {
                        tag = reader.ReadTag();
                        if (tag.DataType == IOConstants.TYPE_METADATA)
                        {
                            if (_metaService == null) _metaService = new MetaService(_file);
                            _metaData = _metaService.ReadMetaData(tag.Body);
                        }
                    }
                    reader.Close();
                }
                catch (Exception ex)
                {
#if !SILVERLIGHT
                    log.Error("An error occured looking for metadata:", ex);
#endif
                }
            }
        }
    public static MetaData GetMetaData(string text)
    {
        Hashtable table = text.hashtableFromJson();
        MetaData meta = new MetaData((Hashtable)table["meta"]);

        return meta;
    }
Exemplo n.º 6
0
 protected MapObject(long id)
 {
     ID = id;
     Visgroups = new List<int>();
     AutoVisgroups = new List<int>();
     Children = new Dictionary<long, MapObject>();
     MetaData = new MetaData();
 }
Exemplo n.º 7
0
 public ItemVM(IItemProvider provider, ContainerVM parent, string name, bool canRename)
 {
     Provider = provider;
     Parent = parent;
     _name = name;
     CanRename = canRename;
     MetaData = new MetaData();
 }
Exemplo n.º 8
0
 internal static void FillCommonData(ShellFolder shell, MetaData data)
 {
     if (shell.IsFileSystemObject)
     {
         data.Add(new MetaEntry { Name = FileMetaData.ModifiedDate.Name, Value = shell.Properties.GetProperty(SystemProperties.System.DateModified).ValueAsObject });
         data.Add(new MetaEntry { Name = FileMetaData.Type.Name, Value = shell.Properties.GetProperty(SystemProperties.System.ItemTypeText).ValueAsObject });
     }
 }
Exemplo n.º 9
0
 private void TcpClient_onMessage(MetaData md, string msg)
 {
     switch(md.Action)
     {
         case MetaData.Actions.register:
             priority = Int32.Parse(msg);
             Console.WriteLine("Получен порядковый номер " + msg);
             break;
     }
 }
Exemplo n.º 10
0
 public override void ReadBlock(FlvContext context)
 {
     base.ReadBlock(context);
     //var br = context.Reader;
     //var dat = br.ReadBytes((int)this.Header.DataLength);
     //data = new MetaData(dat);
     data = new MetaData(context, this.Header.DataLength);
     this.Size += this.Header.DataLength;
     context.CurrentPostion += this.Size;
 }
Exemplo n.º 11
0
        public void Construct_MetaData_with_Field_array()
        {
            var fields = new []
                {
                    new Field("Test_Field_1", DataType.adInteger),
                    new Field("Test_Field_2", DataType.adVarChar)
                };
            var metaData = new MetaData(fields);

            Assert.That(metaData.Fields, Is.EqualTo(fields));
        }
Exemplo n.º 12
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="writer">Symbol writer</param>
		/// <param name="pdbState">PDB state</param>
		/// <param name="metaData">Meta data</param>
		public PdbWriter(ISymbolWriter2 writer, PdbState pdbState, MetaData metaData) {
			if (writer == null)
				throw new ArgumentNullException("writer");
			if (pdbState == null)
				throw new ArgumentNullException("pdbState");
			if (metaData == null)
				throw new ArgumentNullException("metaData");
			this.writer = writer;
			this.pdbState = pdbState;
			this.metaData = metaData;
			this.module = metaData.Module;
			writer.Initialize(metaData);
		}
Exemplo n.º 13
0
        public void AddMetaData(MetaData metaData)
        {
            IEnumerable<Attribute> attributes = CreateTextFramesFromMetaData(metaData);

            foreach (var attribute in attributes)
            {
                //TODO: needs testing
                if (!String.IsNullOrEmpty(attribute.Value))
                {
                    _container.Add(attribute);
                }
            }
        }
        public void SetUp()
        {
            _metaData = new MetaData(new[]
                {
                    new Field("First_Field", DataType.adInteger),
                    new Field("Second_Field", DataType.adVarChar, 2014)
                });

            _fakeData = new List<object[]>
                {
                    new object[] { 1, "First" },
                    new object[] { 2, "Second" }
                };
        }
Exemplo n.º 15
0
 /// <summary>Initializes a new instance of the <see cref="T:System.Object" /> class.</summary>
 public MetaData(MetaData metadata)
 {
     if (metadata != null)
     {
         this.AlbumArtist = metadata.AlbumArtist;
         this.Artist = metadata.Artist;
         this.Comment = metadata.Comment;
         this.Composer = metadata.Composer;
         this.Description = metadata.Description;
         this.Genre = metadata.Genre;
         this.LongDescription = metadata.LongDescription;
         this.Name = metadata.Name;
         this.ReleaseDate = metadata.ReleaseDate;
     }
 }
Exemplo n.º 16
0
        private static MetaData ParseThread(string path)
        {
            if (!Directory.Exists(path))
                throw new MetaParseException("Directory not found: {0}", path);

            MetaData meta = new MetaData();
            meta.Type = MetaType.Directory;
            meta.Path = path;
            //meta.Data = new Dictionary<MetaKey, object>();
            //meta.Data[MetaKey.FileName] = Path.GetFileName(path);
            //meta.Data[MetaKey.OriginalName] = meta.Data[MetaKey.FileName];
            //meta.Data[MetaKey.Size] = GetFileSize(path);
            //meta.Data[MetaKey.Date] = File.GetCreationTime(path);
            //meta.Data[MetaKey.Tags] = new string[0];
            return meta;
        }
Exemplo n.º 17
0
        public Question ReconstructQuestion(QB qb, MetaData meta)
        {
            Question question = new Question();

            question.QuestionID = qb.QuestionID;
            question.Category = CategoryRepository.Find(qb.CategoryID);
            question.Source = qb.Source;
            question.CreatedUserName = qb.CrUserName;
            question.CreatedTime = qb.CrTime;
            if (meta != null)
            {
                question.Meta = meta;
            }

            return question;
        }
Exemplo n.º 18
0
        public Result CreateQuestion(string categoryIDString, string source , string userName,MetaData meta, out Question question)
        {
            var qd = QuestionRepository.QuestionFactory.CreateQuestion(categoryIDString, source, userName, meta);

            var res = QuestionRepository.Insert(qd);

            if (res.IsSuccess)
            {
                question = qd;
            }
            else
            {
                question = null;
            }

            return res;
        }
Exemplo n.º 19
0
        public Question CreateQuestion(string categoryIDString, string source, string userName, MetaData meta)
        {
            long categoryID = Convert.ToInt64(categoryIDString);
            var category = CategoryRepository.Find(categoryID);

            Question question = new Question();
            question.QuestionID = IDProvider.GetNewId("QuestionID");
            question.CreatedTime = TimeProvider.Now;
            question.CreatedUserName = userName;
            question.Category = category;
            question.Source = source;

            meta.AlterWiki("Answer", userName, new KEYID("QuestionAnswer", question.QuestionID));

            question.Meta = meta;

            return question;
        }
Exemplo n.º 20
0
        private static MetaData ParseThread(string filename, MetaType type)
        {
            if (!File.Exists(filename))
                throw new MetaParseException("File not found: {0}", filename);

            MetaData meta = new MetaData();
            meta.Type = type;
            meta.Path = filename;
            meta.Data = new Dictionary<MetaKey, object>();
            meta.Data[MetaKey.FileName] = Path.GetFileName(filename);
            meta.Data[MetaKey.OriginalName] = meta.Data[MetaKey.FileName];
            meta.Data[MetaKey.Size] = GetFileSize(filename);
            meta.Data[MetaKey.DateCreated] = File.GetCreationTime(filename);
            meta.Data[MetaKey.DateModified] = File.GetLastWriteTime(filename);
            meta.Data[MetaKey.Timestamp] = meta.Data[MetaKey.DateModified];
            meta.Data[MetaKey.Tags] = new string[0];
            return meta;
        }
Exemplo n.º 21
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="metaData">Metadata</param>
		public MDEmitter(MetaData metaData) {
			this.metaData = metaData;

			// We could get these from the metadata tables but it's just easier to get name,
			// declaring type etc using TypeDef and MethodDef.

			tokenToTypeDef = new Dictionary<uint, TypeDef>(metaData.TablesHeap.TypeDefTable.Rows);
			tokenToMethodDef = new Dictionary<uint, MethodDef>(metaData.TablesHeap.MethodTable.Rows);
			foreach (var type in metaData.Module.GetTypes()) {
				if (type == null)
					continue;
				tokenToTypeDef.Add(new MDToken(MD.Table.TypeDef, metaData.GetRid(type)).Raw, type);
				foreach (var method in type.Methods) {
					if (method == null)
						continue;
					tokenToMethodDef.Add(new MDToken(MD.Table.Method, metaData.GetRid(method)).Raw, method);
				}
			}
		}
Exemplo n.º 22
0
    public static Mesh[] ProcessToMeshes(string text, Quaternion rotation)
    {
        Hashtable table = text.hashtableFromJson();

        MetaData meta = new MetaData((Hashtable)table["meta"]);

        List<PackedFrame> frames = new List<PackedFrame>();
        Hashtable frameTable = (Hashtable)table["frames"];

        foreach(DictionaryEntry entry in frameTable){
            frames.Add(new PackedFrame((string)entry.Key, meta.size, (Hashtable)entry.Value));
        }

        List<Mesh> meshes = new List<Mesh>();
        for(int i = 0; i < frames.Count; i++){
            meshes.Add(frames[i].BuildBasicMesh(0.01f, new Color32(128,128,128,128), rotation));
        }

        return meshes.ToArray();
    }
Exemplo n.º 23
0
        public void ImportData_CR()
        {
            Assert.Fail("不要乱运行这个方法");
            return;

            string username = "******";
            string conStr = "Data Source=211.99.2.167;Initial Catalog=m_antaeus_temp;Persist Security Info=True;User ID=ans;Password=123456";

            DBTempDataContext con = new DBTempDataContext(conStr);

            var crs = from cr in con.TEMP_CRs
                      orderby cr.QUES_ID descending
                      select cr;
            QuestionModel qm = new QuestionModel();

            foreach (var cr in crs)
            {
                string categoryIDString = "3";
                string source = cr.QUES_SOURCE;
                Dictionary<string,string> dic = new Dictionary<string,string>();
                dic.Add("Content",cr.QUES_CONTENT);
                dic.Add("OptionA",cr.QUES_A);
                dic.Add("OptionB",cr.QUES_B);
                dic.Add("OptionC",cr.QUES_C);
                dic.Add("OptionD",cr.QUES_D);
                dic.Add("OptionE",cr.QUES_E);
                dic.Add("CorrectMark", cr.QUES_CORRECT);
                dic.Add("Question",cr.QUES_QUESTION);
                dic.Add("IsQuestionInFront",cr.QUES_PLACE?"1":"2");

                MetaData meta = new MetaData(dic);
                Question q;
                var res = qm.CreateQuestion(categoryIDString, source, username, meta, out q);
                Assert.IsTrue(res.IsSuccess, res.ErrorMessage);

                int rate = Convert.ToInt32(cr.QUES_RATE);
                res = new RateService().Rate(username, new KEYID("Question", q.QuestionID), rate);

                Assert.IsTrue(res.IsSuccess, res.ErrorMessage);
            }
        }
Exemplo n.º 24
0
        public ActionResult Create(string name, string shortName, string questionType, MetaData metaData)
        {
            try
            {
                Category cate = new Category()
                {
                    Name = name,
                    ShortName = shortName,
                    QuestionType = questionType
                };
                cate.SetMeta(metaData);

                CategoryRepository.Insert(cate);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
    public static List<SpriteMetaData> ProcessToSprites(string text)
    {
        Hashtable table = text.hashtableFromJson();
        MetaData meta = new MetaData((Hashtable)table["meta"]);
        Hashtable frameTable = (Hashtable)table["frames"];

        List<PackedFrame> frames = new List<PackedFrame>();
        foreach(DictionaryEntry entry in frameTable) {
            frames.Add(new PackedFrame((string)entry.Key, meta.size, (Hashtable)entry.Value));
        }
        alphabatizeFramesByName( frames );

        List<SpriteMetaData> sprites = new List<SpriteMetaData>();
        for(int i = 0; i < frames.Count; i++){
            SpriteMetaData smd = frames[i].BuildBasicSprite( 0.01f, new Color32(128,128,128,128));
            if(smd.name.Equals("IGNORE_SPRITE")) {
                continue;
            }
            sprites.Add(smd);
        }
        return sprites;
    }
Exemplo n.º 26
0
        public void AddMetaData(MetaData metaData)
        {
            foreach (var textFrame in CreateTextFramesFromMetaData(metaData))
            {
                //TODO: needs testing

                //we are only allowing fields to be updated if what they are being updated with is not empty
                if (!string.IsNullOrEmpty(textFrame.Content))
                {
                    TextFrame tempTextFrame = textFrame;

                    TextFrame existingFrame = (from frame in _container.OfType<TextFrame>()
                                               where frame.Descriptor.Id == tempTextFrame.Descriptor.Id
                                               select frame).FirstOrDefault();

                    if (existingFrame != null)
                        _container.Remove(existingFrame);

                    _container.Add(textFrame);
                }
            }
        }
Exemplo n.º 27
0
 public void MetaData_AfterLink()
 {
     Meta = MetaData.GetMetaData(this);
     QHC  = new CQueryHelper();
     QHS  = Meta.Conn.GetQueryHelper();
 }
Exemplo n.º 28
0
        public static DateTime GetCreationTime(this MetaData metaData)
        {
            DateTime result;

            return(DateTime.TryParse(metaData?["CreationTime"], out result) ? result : DateTime.MinValue);
        }
Exemplo n.º 29
0
        private HttpRequestMessage BuildRequest(CallMode mode, Uri uri)
        {
            HttpRequestMessage request = null;

            switch (mode)
            {
            case CallMode.Profile:
                request = new HttpRequestMessage(HttpMethod.Post, uri);
                request.Headers.Add("Developer-Key", Configuration.DeveloperKey);
                request.Headers.Add("Application-Key", Configuration.ApplicationKey);
                if (!string.IsNullOrEmpty(InteractionId))
                {
                    request.Headers.Add(SpeechApi.INTERACTION_ID, InteractionId);
                }
                if (!string.IsNullOrEmpty(InteractionTag))
                {
                    request.Headers.Add(SpeechApi.INTERACTION_TAG, InteractionTag);
                }
                if (!string.IsNullOrEmpty(Configuration.ApplicationSource))
                {
                    request.Headers.Add(SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource);
                    request.Headers.Add(SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource);
                }
                if (!string.IsNullOrEmpty(Configuration.ApplicationUserAgent))
                {
                    request.Headers.Add(SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent);
                }
                break;

            case CallMode.Start:
                request = new HttpRequestMessage(HttpMethod.Post, uri);
                request.Headers.Add("Developer-Key", Configuration.DeveloperKey);
                request.Headers.Add("Application-Key", Configuration.ApplicationKey);
                if (!string.IsNullOrEmpty(InteractionId))
                {
                    Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_ID, InteractionId);
                    request.Headers.Add(SpeechApi.INTERACTION_ID, InteractionId);
                }
                if (!string.IsNullOrEmpty(InteractionTag))
                {
                    Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_TAG, InteractionTag);
                    request.Headers.Add(SpeechApi.INTERACTION_TAG, InteractionTag);
                }
                if (!string.IsNullOrEmpty(Configuration.ApplicationSource))
                {
                    Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource);
                    Logger?.LogDebug("{0}: {1}", SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource);
                    request.Headers.Add(SpeechApi.INTERACTION_SOURCE, Configuration.ApplicationSource);
                    request.Headers.Add(SpeechApi.APP_VERSION_ID, Configuration.ApplicationSource);
                }
                if (!string.IsNullOrEmpty(Configuration.ApplicationUserAgent))
                {
                    Logger?.LogDebug("{0}: {1}", SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent);
                    request.Headers.Add(SpeechApi.INTERACTION_AGENT, Configuration.ApplicationUserAgent);
                }
                if (!string.IsNullOrEmpty(AuthToken))
                {
                    Logger?.LogDebug("{0}: {1}", SpeechApi.OVERRIDE_TOKEN, AuthToken);
                    request.Headers.Add(SpeechApi.OVERRIDE_TOKEN, AuthToken);
                }
                if (MetaData.Count > 0)
                {
                    foreach (var item in MetaData)
                    {
                        Logger?.LogDebug("{0}: {1}", item.Key, item.Value);
                        request.Headers.Add(item.Key, item.Value);
                    }
                    MetaData.Clear();
                }
                break;

            case CallMode.Process:
                request = new HttpRequestMessage(HttpMethod.Post, uri);
                Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId);
                request.Headers.Add(SpeechApi.SESSION_ID, SessionId);
                if (MetaData.Count > 0)
                {
                    foreach (var item in MetaData)
                    {
                        Logger?.LogDebug("{0}: {1}", item.Key, item.Value);
                        request.Headers.Add(item.Key, item.Value);
                    }
                    MetaData.Clear();
                }
                request.Content = BuildContent();
                break;

            case CallMode.Train:
                request = new HttpRequestMessage(HttpMethod.Delete, uri);
                Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId);
                request.Headers.Add(SpeechApi.SESSION_ID, SessionId);
                if (MetaData.Count > 0)
                {
                    foreach (var item in MetaData)
                    {
                        Logger?.LogDebug("{0}: {1}", item.Key, item.Value);
                        request.Headers.Add(item.Key, item.Value);
                    }
                    MetaData.Clear();
                }
                break;

            case CallMode.Cancel:
                request = new HttpRequestMessage(HttpMethod.Delete, uri);
                Logger?.LogDebug("{0}: {1}", SpeechApi.SESSION_ID, SessionId);
                request.Headers.Add(SpeechApi.SESSION_ID, SessionId);
                break;
            }

            request.Version = new Version(1, 1);
            request.Headers.ConnectionClose = false;
            string cookies = CookieContainer.GetCookieHeader(request.RequestUri);

            if (!string.IsNullOrEmpty(cookies))
            {
                Logger?.LogDebug("{0}: {1}", SpeechApi.COOKIE, cookies);
                request.Headers.Add(SpeechApi.COOKIE, cookies);
            }

            return(request);
        }
Exemplo n.º 30
0
		/// <summary>
		/// Writes the Metadata.
		/// </summary>
		/// <param name="metaData">Metadata to write.</param>
		public void WriteMetaData(MetaData metaData) {
		}
Exemplo n.º 31
0
		/// <summary>
		/// Initiates writing of the Metadata.
		/// </summary>
		/// <param name="meta">Metadata to write.</param>
		public void Write(MetaData meta) {
			// Get cue points, FLV reader and writer
			MetaCue[] metaArr = meta.MetaCue;
			FlvReader reader = new FlvReader(_file, false);
			FlvWriter writer = new FlvWriter(_output, false);
			ITag tag = null;

			// Read first tag
			if (reader.HasMoreTags()) {
				tag = reader.ReadTag();
				if (tag.DataType == IOConstants.TYPE_METADATA) {
					if (!reader.HasMoreTags())
						throw new IOException("File we're writing is metadata only?");
				}
			}

			meta.Duration = (double)reader.Duration / 1000;
			meta.VideoCodecId = reader.VideoCodecId;
			meta.AudioCodecId = reader.AudioCodecId;

			ITag injectedTag = InjectMetaData(meta, tag);
			injectedTag.PreviousTagSize = 0;
			tag.PreviousTagSize = injectedTag.BodySize;

			writer.WriteHeader();
			writer.WriteTag(injectedTag);
			writer.WriteTag(tag);

			int cuePointTimeStamp = 0;
			int counter = 0;

			if (metaArr != null) {
				Array.Sort(metaArr);
				cuePointTimeStamp = GetTimeInMilliseconds(metaArr[0]);
			}

			while (reader.HasMoreTags()) {
				tag = reader.ReadTag();

				// if there are cuePoints in the array 
				if (counter < metaArr.Length) {

					// If the tag has a greater timestamp than the
					// cuePointTimeStamp, then inject the tag
					while (tag.Timestamp > cuePointTimeStamp) {

						injectedTag = InjectMetaCue(metaArr[counter], tag);
						writer.WriteTag(injectedTag);

						tag.PreviousTagSize = injectedTag.BodySize;

						// Advance to the next CuePoint
						counter++;

						if (counter > (metaArr.Length - 1)) {
							break;
						}

						cuePointTimeStamp = GetTimeInMilliseconds(metaArr[counter]);

					}
				}

				if (tag.DataType != IOConstants.TYPE_METADATA) {
					writer.WriteTag(tag);
				}

			}
			writer.Close();
		}
Exemplo n.º 32
0
        // tEntryDetailSource: idupb, cost,revenue,accruals,idacc_cost,idacc_revenue,idacc_deferredcost,idacc_accruals,yearstop
        private bool doRettificaPluriennale(DataTable tEntryDetailSource)
        {
            if (tEntryDetailSource == null)
            {
                MessageBox.Show(this, "La tabella dei dettagli scritture non è definita", "Errore");
                return(false);
            }

            if (tEntryDetailSource.Rows.Count == 0)
            {
                MessageBox.Show(this, "Nessun importo da rettificare", "Avvertimento");
                return(true);
            }

            DataTable tEntry       = DataAccess.CreateTableByName(Meta.Conn, "entry", "*");
            DataTable tEntryDetail = DataAccess.CreateTableByName(Meta.Conn, "entrydetail", "*");

            tEntryDetail.Columns.Add("!costi", typeof(decimal));
            tEntryDetail.Columns.Add("!ricavi", typeof(decimal));
            tEntryDetail.Columns.Add("!rateoattivo", typeof(decimal));
            tEntryDetail.Columns.Add("!scadenza", typeof(int));

            DataSet ds = new DataSet();

            ds.Tables.Add(tEntry);
            ds.Tables.Add(tEntryDetail);

            ds.Relations.Add("entryentrydetail",
                             new DataColumn[] { tEntry.Columns["yentry"], tEntry.Columns["nentry"] },
                             new DataColumn[] { tEntryDetail.Columns["yentry"], tEntryDetail.Columns["nentry"] }, false);

            int currYear = (int)Meta.GetSys("esercizio");

            MetaData MEntry = MetaData.GetMetaData(this, "entry");

            MEntry.SetDefaults(ds.Tables["entry"]);
            MetaData.SetDefault(ds.Tables["entry"], "yentry", currYear);

            DateTime dec31 = new DateTime(currYear, 12, 31);
            string   descr = "Rettifica costi/ricavi per progetti pluriennali";

            DataRow rEntry = MEntry.Get_New_Row(null, ds.Tables["entry"]);

            rEntry["identrykind"] = 8;
            rEntry["adate"]       = dec31;
            rEntry["description"] = descr;

            DateTime jan01 = new DateTime(1 + currYear, 1, 1);

            string campoRicavo          = "idacc_revenue";
            string campoCosto           = "idacc_cost";
            string campoRateoAttivo     = "idacc_accruals";
            string campoRiscontoPassivo = "idacc_deferredcost";

            object idacc_riscontoA = Meta.Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", currYear), campoRateoAttivo);

            if ((idacc_riscontoA == null) || (idacc_riscontoA == DBNull.Value))
            {
                MessageBox.Show(this, "Attenzione non è stato specificato il conto del rateo attivo per la UPB:....", "Errore");
                return(false);
            }

            object idacc_riscontoP = Meta.Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", currYear), campoRiscontoPassivo);

            if ((idacc_riscontoP == null) || (idacc_riscontoP == DBNull.Value))
            {
                MessageBox.Show(this, "Attenzione non è stato specificato il conto del risconto passivo per la UPB:....", "Errore");
                return(false);
            }

            MetaData MEntryDetail = MetaData.GetMetaData(this, "entrydetail");

            MEntryDetail.SetDefaults(ds.Tables["entrydetail"]);



            foreach (DataRow Curr in tEntryDetailSource.Rows)
            {
                // Dettaglio COSTO - RICAVO (Non ho il problema di controllare l'esistenza di una riga pregressa
                // perché per come è costruita la tabella le righe sono tutte diverse tra di loro
                MetaData.SetDefault(ds.Tables["entrydetail"], "yentry", currYear);
                MetaData.SetDefault(ds.Tables["entrydetail"], "nentry", rEntry["nentry"]);

                bool annoFine = (CfgFn.GetNoNullInt32(Curr["yearstop"]) == currYear);

                tEntryDetail.Columns.Add("!costi", typeof(decimal));
                tEntryDetail.Columns.Add("!ricavi", typeof(decimal));



                DataRow rDetail = null;

                if (annoFine)
                {
                    decimal rateo = CfgFn.GetNoNullDecimal(Curr[campoRateoAttivo]);
                    if (rateo == 0)
                    {
                        continue;
                    }

                    //genera scrittura COSTO A RATEO ATTIVO

                    rDetail = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                    rDetail["!scadenza"]    = CfgFn.GetNoNullInt32(Curr["yearstop"]);
                    rDetail["!rateoattivo"] = rateo;
                    rDetail["amount"]       = -rateo;
                    rDetail["idacc"]        = Curr[campoCosto];
                    rDetail["idreg"]        = DBNull.Value;
                    rDetail["idupb"]        = Curr["idupb"];
                    //rDetail["idsor1"] = Curr["idsor1"];
                    //rDetail["idsor2"] = Curr["idsor2"];
                    //rDetail["idsor3"] = Curr["idsor3"];
                    //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                    rDetail["competencystart"] = DBNull.Value;
                    rDetail["competencystop"]  = DBNull.Value;

                    rDetail = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                    rDetail["!scadenza"] = CfgFn.GetNoNullInt32(Curr["yearstop"]);
                    rDetail["amount"]    = rateo;
                    rDetail["idacc"]     = Curr[campoRateoAttivo];
                    rDetail["idreg"]     = DBNull.Value;
                    rDetail["idupb"]     = Curr["idupb"];
                    //rDetail["idsor1"] = Curr["idsor1"];
                    //rDetail["idsor2"] = Curr["idsor2"];
                    //rDetail["idsor3"] = Curr["idsor3"];
                    //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                    rDetail["competencystart"] = DBNull.Value;
                    rDetail["competencystop"]  = DBNull.Value;
                }
                else
                {
                    decimal costi  = CfgFn.GetNoNullDecimal(Curr["cost"]);
                    decimal ricavi = CfgFn.GetNoNullDecimal(Curr["revenue"]);
                    if (costi == ricavi)
                    {
                        continue;
                    }

                    if (costi > ricavi)
                    {
                        decimal importo_rateo = costi - ricavi;
                        //genera scrittura RATEO ATTIVO A RICAVI

                        rDetail = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                        rDetail["!scadenza"] = CfgFn.GetNoNullInt32(Curr["yearstop"]);
                        rDetail["!ricavi"]   = ricavi;
                        rDetail["!costi"]    = costi;
                        rDetail["amount"]    = importo_rateo;
                        rDetail["idacc"]     = Curr[campoRicavo];
                        rDetail["idreg"]     = DBNull.Value;
                        rDetail["idupb"]     = Curr["idupb"];
                        //rDetail["idsor1"] = Curr["idsor1"];
                        //rDetail["idsor2"] = Curr["idsor2"];
                        //rDetail["idsor3"] = Curr["idsor3"];
                        //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                        rDetail["competencystart"] = DBNull.Value;
                        rDetail["competencystop"]  = DBNull.Value;

                        rDetail            = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                        rDetail["!ricavi"] = ricavi;
                        rDetail["!costi"]  = costi;
                        rDetail["amount"]  = -importo_rateo;
                        rDetail["idacc"]   = Curr[campoRateoAttivo];
                        rDetail["idreg"]   = DBNull.Value;
                        rDetail["idupb"]   = Curr["idupb"];
                        //rDetail["idsor1"] = Curr["idsor1"];
                        //rDetail["idsor2"] = Curr["idsor2"];
                        //rDetail["idsor3"] = Curr["idsor3"];
                        //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                        rDetail["competencystart"] = DBNull.Value;
                        rDetail["competencystop"]  = DBNull.Value;
                    }
                    else
                    {
                        decimal importo_risconto = ricavi - costi;
                        //genera scrittura RICAVI A RISCONTI PASSIVI

                        rDetail = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                        rDetail["!scadenza"] = CfgFn.GetNoNullInt32(Curr["yearstop"]);
                        rDetail["!ricavi"]   = ricavi;
                        rDetail["!costi"]    = costi;

                        rDetail["amount"] = -importo_risconto;
                        rDetail["idacc"]  = Curr[campoRicavo];
                        rDetail["idreg"]  = DBNull.Value;
                        rDetail["idupb"]  = Curr["idupb"];
                        //rDetail["idsor1"] = Curr["idsor1"];
                        //rDetail["idsor2"] = Curr["idsor2"];
                        //rDetail["idsor3"] = Curr["idsor3"];
                        //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                        rDetail["competencystart"] = DBNull.Value;
                        rDetail["competencystop"]  = DBNull.Value;

                        rDetail           = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                        rDetail["amount"] = importo_risconto;
                        rDetail["idacc"]  = Curr[campoRiscontoPassivo];
                        rDetail["idreg"]  = DBNull.Value;
                        rDetail["idupb"]  = Curr["idupb"];
                        //rDetail["idsor1"] = Curr["idsor1"];
                        //rDetail["idsor2"] = Curr["idsor2"];
                        //rDetail["idsor3"] = Curr["idsor3"];
                        //rEntryDetailCR["idaccmotive"] = Curr["idaccmotive"];
                        rDetail["competencystart"] = DBNull.Value;
                        rDetail["competencystop"]  = DBNull.Value;
                    }
                }
            }

            FrmEntryPreSavePluriennale frm = new FrmEntryPreSavePluriennale(ds.Tables["entrydetail"], Meta.Conn);
            DialogResult dr = frm.ShowDialog();

            if (dr != DialogResult.OK)
            {
                MessageBox.Show(this, "Operazione Annullata!");
                return(true);
            }
            PostData Post = MEntry.Get_PostData();

            Post.InitClass(ds, Meta.Conn);

            if (Post.DO_POST())
            {
                DataRow rEntryPosted = ds.Tables["entry"].Rows[0];
                EditRelatedEntryByKey(rEntryPosted);
                MessageBox.Show(this, "Assestamento completato con successo!");
            }
            else
            {
                MessageBox.Show(this, "Errore nel salvataggio della scrittura di assestamento!", "Errore");
            }

            return(true);
        }
Exemplo n.º 33
0
    private static void ProcessAssembly(XmlTextWriter oo, MetaData md)
    {
        IDictionary <string, MetaDataObject> tests  = new SortedDictionary <string, MetaDataObject>();
        IDictionary <string, MetaDataObject> suites = new SortedDictionary <string, MetaDataObject>();
        // Look for the annotation that tells us that this assembly is a stand-alone
        // test app.
        MetaDataAssembly mda = (MetaDataAssembly)md.Assemblies[0];

        foreach (MetaDataCustomAttribute attrib in md.CustomAttributes)
        {
            MetaDataObject parent = attrib.Parent;
            //Console.WriteLine("Found: {0} in {1} {2}", attrib.Name, parent.FullName, parent.FullNameWithContext);
            if (!attrib.Name.StartsWith(ATTRIBUTE_PREFIX))
            {
                continue;
            }
            string attribName = attrib.Name.Substring(ATTRIBUTE_PREFIX.Length);
            switch (attribName)
            {
            case "TestAppAttribute":
                break;

            case "TestClassAttribute":
                suites.Add(attrib.Parent.FullName, attrib);
                break;

            case "TestMethodAttribute":
                MetaDataObject m = attrib.Parent;
                tests.Add(attrib.Parent.FullName, attrib);
                break;
            }
        }
        string prevSuite = "";

        foreach (KeyValuePair <string, MetaDataObject> kvp in tests)
        {
            string k = kvp.Key;
            string className;
            string testname = Tail(k, '.', out className);
            if (!suites.ContainsKey(className))
            {
                Console.WriteLine("TestMethod declared outside of a TestClass: {0}", k);
                continue;
            }
            if (!prevSuite.Equals(className))
            {
                if (!prevSuite.Equals(""))
                {
                    oo.WriteEndElement();
                }
                oo.WriteStartElement("Suite");
                string ignored;
                oo.WriteAttributeString("Name", Tail(className, '.', out ignored));
                prevSuite = className;
            }
            oo.WriteStartElement("Test");
            oo.WriteAttributeString("Name", testname);
#if EXTRACT_TIMEOUT
            object timeout = psItem.Fields["Test Timeout"].Value;
            if (timeout != null)
            {
                oo.WriteAttributeString("Timeout", timeout.ToString());
            }
            object knownFailure = psItem.Fields["Test Known Failure"].Value;
            if (knownFailure != null)
            {
                oo.WriteAttributeString("KnownFailure", knownFailure.ToString());
            }
#endif
            oo.WriteEndElement();
        }
        if (!prevSuite.Equals(""))
        {
            oo.WriteEndElement();
        }
    }
Exemplo n.º 34
0
 public PhotoViewerViewModel(MetaData metadata)
 {
     _metadata = metadata;
 }
Exemplo n.º 35
0
 public Task <IRestResponse> GetThumbnailTask(MetaData file, ThumbnailSize size)
 {
     return(GetThumbnailTask(file.Path, size));
 }
Exemplo n.º 36
0
 public int GetValue()
 {
     return(Children.Any()
         ? MetaData.Select(i => i > Children.Length ? 0 : Children[i - 1].GetValue()).Sum()
         : GetMetaDataSum());
 }
Exemplo n.º 37
0
 public int GetMetaDataSum() => MetaData.Sum() + Children.Select(c => c.GetMetaDataSum()).Sum();
Exemplo n.º 38
0
        /// <summary>
        /// The code that should run once when a control is loaded
        /// Base code should have "virtual"
        /// Derived classes should have "override"
        /// </summary>
        public virtual void InitializeFieldTemplate()
        {
            string DefaultValue = GetMetaDataValue(MetaDataDefaultValueKey, "");

            // Do things depending which InputType this control has set
            if (InputType == InputTypes.Wysiwyg)
            {
                TextBox1.Visible    = false;
                Texteditor1.Visible = true;

                //if (MetaData.ContainsKey(MetaDataWysiwygHeightKey))
                //{
                var WysiwygHeight = GetMetaDataValue(MetaDataWysiwygHeightKey, new decimal?());     // (((IAttribute<decimal?>)(MetaData[MetaDataWysiwygHeightKey]))).Typed[DimensionIds];
                if (WysiwygHeight.HasValue)
                {
                    Texteditor1.Height = new Unit(Convert.ToInt32(WysiwygHeight));
                }
                //}
                if (MetaData.ContainsKey(MetaDataWysiwygWidthKey))
                {
                    var WysiwygWidth = (((IAttribute <decimal?>)(MetaData[MetaDataWysiwygWidthKey]))).Typed[DimensionIds];
                    if (WysiwygWidth.HasValue)
                    {
                        Texteditor1.Width = new Unit(Convert.ToInt32(WysiwygWidth));
                    }
                }

                if (FieldValueEditString != null)
                {
                    Texteditor1.Text = FieldValueEditString;
                }
                else
                {
                    Texteditor1.Text = DefaultValue;
                }

                Texteditor1.ChooseMode = false;
            }
            else if (InputType == InputTypes.DropDown)
            {
                TextBox1.Visible  = false;
                DropDown1.Visible = true;
                if (!String.IsNullOrEmpty(GetMetaDataValue <string>(MetaDataDrowdownValuesKey)))
                {
                    DropDown1.DataSource = (from c in GetMetaDataValue <string>(MetaDataDrowdownValuesKey).Replace("\r", "").Split('\n')
                                            select new
                    {
                        Text = c.Contains(':') ? (c.Split(':'))[0] : c,
                        Value = c.Contains(':') ? (c.Split(':'))[1] : c
                    }).ToList();
                }
                DropDown1.DataBind();

                if (!String.IsNullOrEmpty(FieldValueEditString))
                {
                    if (DropDown1.Items.Cast <ListItem>().All(i => i.Value != FieldValueEditString))
                    {
                        DropDown1.Items.Insert(0, new ListItem(FieldValueEditString + " (keep old value)", FieldValueEditString));
                    }
                    DropDown1.SelectedValue = FieldValueEditString;
                }

                if (FieldValueEditString == null)
                {
                    DropDown1.SelectedValue = DefaultValue;
                }
            }
            else if (InputType == InputTypes.Link)
            {
                TextBox1.Visible = false;
                DnnUrl1.Visible  = true;

                DnnUrl1.Url = FieldValueEditString;
            }
            else
            {
                // Row Count of multiline field
                var metaDataRowCount = GetMetaDataValue <decimal?>(MetaDataRowCountKey);
                if (metaDataRowCount.HasValue && metaDataRowCount > 0)
                {
                    TextBox1.Rows = Convert.ToInt32(metaDataRowCount.Value.ToString());
                    if (TextBox1.Rows > 1)
                    {
                        TextBox1.TextMode = System.Web.UI.WebControls.TextBoxMode.MultiLine;
                    }
                }

                if (GetMetaDataValue <bool>(MetaDataIsRequiredKey))
                {
                    TextBox1.CssClass += " dnnFormRequired";
                }

                var metaDataLength = GetMetaDataValue <int?>(MetaDataLengthKey);
                if (metaDataLength.HasValue && metaDataLength > 0)
                {
                    TextBox1.MaxLength = metaDataLength.Value;
                }

                TextBox1.ToolTip = GetMetaDataValue <string>(MetaDataNotesKey);

                if (FieldValueEditString != null)
                {
                    TextBox1.Text = FieldValueEditString;
                }
                else
                {
                    TextBox1.Text = DefaultValue;
                }
            }

            if (ShowDataControlOnly)
            {
                FieldLabel.Visible = false;
            }

            valFieldValue.DataBind();

            var metaRegularExpressions = GetMetaDataValue <string>(MetaDataRegularExpression);

            if (!String.IsNullOrEmpty(metaRegularExpressions))
            {
                valRegularExpression.ValidationExpression = metaRegularExpressions;
            }
            valRegularExpression.DataBind();
        }
    void InitParse(string needFindContent, string dependencePrefabContent)
    {
        gameObjectMataDatas.Clear();
        monoBehaviourMataDatas.Clear();

        //解析查找.prefab文件信息
        if (!string.IsNullOrEmpty(needFindContent))
        {
            string   text      = needFindContent;
            string[] textArray = text.Split(new string[] { "---" }, StringSplitOptions.None);

            foreach (var v in textArray)
            {
                if (v.Contains("MonoBehaviour:"))
                {
                    var mataData = new MetaData();
                    mataData.SetData(v);
                    monoBehaviourMataDatas.Add(mataData);
                }
                else if (v.Contains("GameObject:"))
                {
                    var mataData = new MetaData();
                    mataData.SetData(v);
                    gameObjectMataDatas.Add(mataData);
                }
            }
        }

        //解析查找 xxx.prefab 文件的依赖的文件 Atlas.prefab 的 Atlas.prefab.meta 的 GUID 信息
        string dependenceAtlasGUID = string.Empty;

        if (!string.IsNullOrEmpty(dependencePrefabContent))
        {
            string   text      = dependencePrefabContent;
            string[] textArray = text.Split(new string[] { "\n" }, StringSplitOptions.None);

            foreach (var v in textArray)
            {
                if (v.Contains("guid:"))
                {
                    dependenceAtlasGUID = v.Split(new string[] { ":" }, StringSplitOptions.None)[1].Trim();
                    break;
                }
            }
        }

        //通过dependenceTextAssetGUID查找GameObject fileID
        List <string> gameObjectFileID = new List <string>();
        Dictionary <string, string> spriteNameWithFileID = new Dictionary <string, string>();

        foreach (var v in monoBehaviourMataDatas)
        {
            if (v.m_GUID == dependenceAtlasGUID)
            {
                gameObjectFileID.Add(v.m_GameObjectFileID);
                spriteNameWithFileID[v.m_GameObjectFileID] = v.m_SpriteName;
            }
        }

        //再通过查找与 fileID 相同的GameObject Name 对象
        List <MetaData> list = new List <MetaData>();

        foreach (var v in gameObjectMataDatas)
        {
            if (gameObjectFileID.Contains(v.m_FlagID))
            {
                var info = string.Format("m_SpriteName: {0} \t\t m_Name: {1}\n", spriteNameWithFileID[v.m_FlagID], v.m_Name);
                resolvesTextContent += info;
                Debug.Log(info);
            }
        }
    }
Exemplo n.º 40
0
 public override void RegisterMetadata(MetaData metaData)
 {
     metaData.CharEncodingRecord = this;
     metaData.DataEncoding       = Encoding;
 }
Exemplo n.º 41
0
        void azzeraRiporto(object idSpesa, DataRow rFinvar)
        {
            DataRow[] drMovimento     = DS.expense.Select(QHC.CmpEq("idexp", idSpesa));
            DataRow[] drMovimentoView = DS.expenseview.Select(QHC.CmpEq("idexp", idSpesa));
            object    idfin           = drMovimentoView[0]["idfin"];
            object    idupb           = drMovimentoView[0]["idupb"];

            MetaData metaVarSpesa = MetaData.GetMetaData(this, "expensevar");

            metaVarSpesa.SetDefaults(DS.expensevar);
            MetaData.SetDefault(DS.expensevar, "adate", lastday);
            MetaData.SetDefault(DS.expensevar, "autokind", 9);
            decimal valore_da_azzerare = (decimal)drMovimentoView[0]["available"];


            DataTable TNextYear = Meta.Conn.RUN_SELECT("expenseview", "idexp,available", null,
                                                       QHS.AppAnd(QHS.CmpEq("idexp", idSpesa), QHS.CmpEq("ayear", CfgFn.GetNoNullInt32(Meta.GetSys("esercizio")) + 1)), null, false);

            if (TNextYear != null && TNextYear.Rows.Count > 0)
            {
                decimal nextyear_available = (decimal)TNextYear.Rows[0]["available"];
                valore_da_azzerare = nextyear_available; // il disponibile residuo effettivo da azzerare è quello dell'esercizio successivo e non quello al 31/12
            }


            DataTable Tresidui = Meta.Conn.RUN_SELECT("expensecreditproceedsview", "idexp,topay,idunderwriting", null,
                                                      QHS.AppAnd(QHS.CmpEq("idexp", idSpesa), QHS.CmpGt("topay", 0)), null, false);
            decimal tot_to_pay = MetaData.SumColumn(Tresidui, "topay");
            decimal valore_da_azzerare_nofinanziamento = valore_da_azzerare - tot_to_pay;

            decimal rimasto_da_azzerare = valore_da_azzerare;


            //Crea le variazioni di spesa
            DataRow DRVarSpesa;

            if (valore_da_azzerare_nofinanziamento > 0)
            {
                DRVarSpesa                = metaVarSpesa.Get_New_Row(drMovimento[0], DS.expensevar);
                DRVarSpesa["amount"]      = -valore_da_azzerare_nofinanziamento;
                DRVarSpesa["idexp"]       = idSpesa;
                DRVarSpesa["description"] = "Variazione di Azzeramento del Riporto";
                rimasto_da_azzerare      -= valore_da_azzerare_nofinanziamento;
            }


            if (Tresidui != null && rimasto_da_azzerare > 0)
            {
                foreach (DataRow Rtopay in Tresidui.Select(null, "topay desc"))
                {
                    DRVarSpesa = metaVarSpesa.Get_New_Row(drMovimento[0], DS.expensevar);
                    decimal topay = CfgFn.GetNoNullDecimal(Rtopay["topay"]);
                    if (topay > rimasto_da_azzerare)
                    {
                        topay = rimasto_da_azzerare;
                    }
                    DRVarSpesa["amount"]         = -topay;
                    DRVarSpesa["idunderwriting"] = Rtopay["idunderwriting"];
                    DRVarSpesa["idexp"]          = idSpesa;
                    DRVarSpesa["description"]    = "Variazione di Azzeramento del Riporto";
                    rimasto_da_azzerare         -= topay;
                    if (rimasto_da_azzerare == 0)
                    {
                        break;
                    }
                }
            }

            // Aggiorna l'importo delle classificazioni
            string filterMov = QHC.CmpEq("idexp", idSpesa);

            DataRow[] Rexpensesorted = DS.expensesorted.Select(filterMov);

            foreach (DataRow R in Rexpensesorted)  // se la classificazione class. interamente il mov lo azzera
            {
                if ((decimal)R["amount"] == (decimal)drMovimentoView[0]["curramount"])
                {
                    R["amount"] = (decimal)R["amount"] - valore_da_azzerare;
                }
            }

            rimasto_da_azzerare = valore_da_azzerare;
            if (rFinvar != null)
            {
                //Crea le variazioni crediti
                if (rimasto_da_azzerare > 0)
                {
                    if (valore_da_azzerare_nofinanziamento > 0)
                    {
                        AggiungiVarCrediti(idfin, idupb, DBNull.Value, valore_da_azzerare_nofinanziamento, rFinvar);
                        rimasto_da_azzerare -= valore_da_azzerare_nofinanziamento;
                    }
                    if (Tresidui != null && rimasto_da_azzerare > 0)
                    {
                        foreach (DataRow R in Tresidui.Select(null, "topay desc"))
                        {
                            decimal topay = CfgFn.GetNoNullDecimal(R["topay"]);
                            if (topay > rimasto_da_azzerare)
                            {
                                topay = rimasto_da_azzerare;
                            }

                            AggiungiVarCrediti(idfin, idupb, R["idunderwriting"], topay, rFinvar);
                            rimasto_da_azzerare -= topay;
                            if (rimasto_da_azzerare == 0)
                            {
                                break;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 42
0
 /**************************************************************************************************/
 public SessionManager()
 {
     MetaData = new MetaData();
     mfl      = new MainFormLoading();
     //mfl.Register(this);
 }
Exemplo n.º 43
0
        public override void DetermineDataType(Plan plan)
        {
            DetermineModifiers(plan);
            _dataType       = new Schema.TableType();
            _tableVar       = new Schema.ResultTableVar(this);
            _tableVar.Owner = plan.User;
            _tableVar.InheritMetaData(SourceTableVar.MetaData);
            _tableVar.MergeMetaData(MetaData);
            AlterNode.AlterMetaData(_tableVar, AlterMetaData, true);
            CopyTableVarColumns(SourceTableVar.Columns);
            int sourceColumnIndex;

            Schema.TableVarColumn sourceColumn;
            Schema.TableVarColumn newColumn;
            _isRestrict = false;
            PlanNode restrictNode = null;
            PlanNode constraintNode;

            foreach (AdornColumnExpression expression in _expressions)
            {
                sourceColumnIndex = TableVar.Columns.IndexOf(expression.ColumnName);
                sourceColumn      = TableVar.Columns[expression.ColumnName];
                newColumn         = CopyTableVarColumn(sourceColumn);
                if (expression.ChangeNilable)
                {
                    newColumn.IsNilable = expression.IsNilable;
                }
                newColumn.MergeMetaData(expression.MetaData);
                AlterNode.AlterMetaData(newColumn, expression.AlterMetaData, true);
                newColumn.ReadOnly = Convert.ToBoolean(MetaData.GetTag(newColumn.MetaData, "Frontend.ReadOnly", newColumn.ReadOnly.ToString()));

                foreach (ConstraintDefinition constraint in expression.Constraints)
                {
                    _isRestrict = true;
                    Schema.TableVarColumnConstraint newConstraint = Compiler.CompileTableVarColumnConstraint(plan, TableVar, newColumn, constraint);

                    //Schema.TableVarColumnConstraint newConstraint = new Schema.TableVarColumnConstraint(Schema.Object.GetObjectID(constraint.MetaData), constraint.ConstraintName);
                    //newConstraint.ConstraintType = Schema.ConstraintType.Column;
                    //newConstraint.MergeMetaData(constraint.MetaData);
                    plan.PushCreationObject(newConstraint);
                    try
                    {
                        plan.Symbols.Push(new Symbol(Keywords.Value, newColumn.DataType));
                        try
                        {
                            //PlanNode node = Compiler.CompileBooleanExpression(plan, constraint.Expression);
                            //newConstraint.Node = node;
                            //newConstraint.IsRemotable = true;
                            //if (newConstraint.HasDependencies())
                            //	for (int index = 0; index < newConstraint.Dependencies.Count; index++)
                            //	{
                            //		Schema.Object objectValue = newConstraint.Dependencies.Objects[index];
                            //		if (objectValue != null)
                            //		{
                            //			if (!objectValue.IsRemotable)
                            //			{
                            //				newConstraint.IsRemotable = false;
                            //				break;
                            //			}
                            //		}
                            //		else
                            //		{
                            //			Error.Fail("Missing object dependency in AdornNode.");
                            //			//Schema.ObjectHeader LHeader = APlan.CatalogDeviceSession.SelectObjectHeader(LNewConstraint.Dependencies.IDs[LIndex]);
                            //			//if (!LHeader.IsRemotable)
                            //			//{
                            //			//    LNewConstraint.IsRemotable = false;
                            //			//    break;
                            //			//}
                            //		}
                            //	}

                            newColumn.Constraints.Add(newConstraint);

                            constraintNode = Compiler.CompileBooleanExpression(plan, constraint.Expression);
                            constraintNode = ReplaceColumnReferences(plan, constraintNode, sourceColumn.Name, sourceColumnIndex);
                            if (restrictNode == null)
                            {
                                restrictNode = constraintNode;
                            }
                            else
                            {
                                restrictNode = Compiler.EmitBinaryNode(plan, restrictNode, Instructions.And, constraintNode);
                            }
                        }
                        finally
                        {
                            plan.Symbols.Pop();
                        }
                    }
                    finally
                    {
                        plan.PopCreationObject();
                    }

                    if (newConstraint.HasDependencies())
                    {
                        plan.AttachDependencies(newConstraint.Dependencies);
                    }
                }

                // TODO: verify that the default satisfies the constraints
                if (expression.Default != null)
                {
                    newColumn.Default = Compiler.CompileTableVarColumnDefault(plan, _tableVar, newColumn, expression.Default);
                    if (newColumn.Default.HasDependencies())
                    {
                        plan.AttachDependencies(newColumn.Default.Dependencies);
                    }
                }

                if (expression.MetaData != null)
                {
                    Tag tag;
                    tag = expression.MetaData.Tags.GetTag("DAE.IsDefaultRemotable");
                    if (tag != Tag.None)
                    {
                        newColumn.IsDefaultRemotable = newColumn.IsDefaultRemotable && Convert.ToBoolean(tag.Value);
                    }

                    tag = expression.MetaData.Tags.GetTag("DAE.IsChangeRemotable");
                    if (tag != Tag.None)
                    {
                        newColumn.IsChangeRemotable = newColumn.IsChangeRemotable && Convert.ToBoolean(tag.Value);
                    }

                    tag = expression.MetaData.Tags.GetTag("DAE.IsValidateRemotable");
                    if (tag != Tag.None)
                    {
                        newColumn.IsValidateRemotable = newColumn.IsValidateRemotable && Convert.ToBoolean(tag.Value);
                    }
                }

                DataType.Columns[sourceColumnIndex] = newColumn.Column;
                TableVar.Columns[sourceColumnIndex] = newColumn;
            }

            // Keys
            CopyKeys(SourceTableVar.Keys);
            foreach (DropKeyDefinition keyDefinition in _dropKeys)
            {
                Schema.Key oldKey = Compiler.FindKey(plan, TableVar, keyDefinition);

                TableVar.Keys.SafeRemove(oldKey);
                TableVar.Constraints.SafeRemove(oldKey.Constraint);
                TableVar.InsertConstraints.SafeRemove(oldKey.Constraint);
                TableVar.UpdateConstraints.SafeRemove(oldKey.Constraint);
            }

            foreach (AlterKeyDefinition keyDefinition in _alterKeys)
            {
                Schema.Key oldKey = Compiler.FindKey(plan, TableVar, keyDefinition);
                AlterNode.AlterMetaData(oldKey, keyDefinition.AlterMetaData);
            }

            Compiler.CompileTableVarKeys(plan, _tableVar, _keys, false);

            // Orders
            CopyOrders(SourceTableVar.Orders);

            foreach (DropOrderDefinition orderDefinition in _dropOrders)
            {
                Schema.Order oldOrder = Compiler.FindOrder(plan, TableVar, orderDefinition);

                TableVar.Orders.SafeRemove(oldOrder);
            }

            foreach (AlterOrderDefinition orderDefinition in _alterOrders)
            {
                AlterNode.AlterMetaData(Compiler.FindOrder(plan, TableVar, orderDefinition), orderDefinition.AlterMetaData);
            }

            Compiler.CompileTableVarOrders(plan, _tableVar, _orders);

            if (SourceNode.Order != null)
            {
                Order = CopyOrder(SourceNode.Order);
            }

            // Constraints
            Compiler.CompileTableVarConstraints(plan, _tableVar, _constraints);

            if (_tableVar.HasConstraints())
            {
                foreach (Schema.TableVarConstraint constraint in _tableVar.Constraints)
                {
                    if (restrictNode == null)
                    {
                        if (constraint is Schema.RowConstraint)
                        {
                            restrictNode = ((Schema.RowConstraint)constraint).Node;
                            _isRestrict  = true;
                        }
                    }
                    else
                    {
                        if (constraint is Schema.RowConstraint)
                        {
                            restrictNode = Compiler.EmitBinaryNode(plan, restrictNode, Instructions.And, ((Schema.RowConstraint)constraint).Node);
                            _isRestrict  = true;
                        }
                    }

                    if (constraint.HasDependencies())
                    {
                        plan.AttachDependencies(constraint.Dependencies);
                    }
                }
            }

            if (_isRestrict)
            {
                Nodes[0] = Compiler.EmitRestrictNode(plan, Nodes[0], restrictNode);
            }

            DetermineRemotable(plan);

            if (MetaData != null)
            {
                Tag tag;
                Schema.ResultTableVar tableVar = (Schema.ResultTableVar)TableVar;
                tag = MetaData.Tags.GetTag("DAE.IsDefaultRemotable");
                if (tag != Tag.None)
                {
                    tableVar.InferredIsDefaultRemotable = tableVar.InferredIsDefaultRemotable && Convert.ToBoolean(tag.Value);
                }

                tag = MetaData.Tags.GetTag("DAE.IsChangeRemotable");
                if (tag != Tag.None)
                {
                    tableVar.InferredIsChangeRemotable = tableVar.InferredIsChangeRemotable && Convert.ToBoolean(tag.Value);
                }

                tag = MetaData.Tags.GetTag("DAE.IsValidateRemotable");
                if (tag != Tag.None)
                {
                    tableVar.InferredIsValidateRemotable = tableVar.InferredIsValidateRemotable && Convert.ToBoolean(tag.Value);
                }
            }

            if (Order == null)
            {
                string orderName = MetaData.GetTag(MetaData, "DAE.DefaultOrder", String.Empty);
                if (orderName != String.Empty)
                {
                    Order =
                        Compiler.CompileOrderDefinition
                        (
                            plan,
                            TableVar,
                            new Parser().ParseOrderDefinition
                            (
                                MetaData.GetTag
                                (
                                    MetaData,
                                    "DAE.DefaultOrder",
                                    String.Empty
                                )
                            ),
                            false
                        );
                }
            }

            if ((Order != null) && !TableVar.Orders.Contains(Order))
            {
                TableVar.Orders.Add(Order);
            }

                        #if UseReferenceDerivation
                        #if UseElaborable
            if (plan.CursorContext.CursorCapabilities.HasFlag(CursorCapability.Elaborable))
                        #endif
            CopyReferences(plan, SourceTableVar);
                        #endif

            foreach (ReferenceDefinition referenceDefinition in _references)
            {
                // Create a reference on the table var
                Schema.Reference reference = new Schema.Reference(Schema.Object.GetObjectID(referenceDefinition.MetaData), referenceDefinition.ReferenceName, referenceDefinition.MetaData);
                reference.Enforced    = false;
                reference.SourceTable = TableVar;

                foreach (ReferenceColumnDefinition column in referenceDefinition.Columns)
                {
                    reference.SourceKey.Columns.Add(reference.SourceTable.Columns[column.ColumnName]);
                }
                foreach (Schema.Key key in reference.SourceTable.Keys)
                {
                    if (reference.SourceKey.Columns.IsSupersetOf(key.Columns))
                    {
                        reference.SourceKey.IsUnique = true;
                        break;
                    }
                }

                Schema.Object schemaObject = Compiler.ResolveCatalogIdentifier(plan, referenceDefinition.ReferencesDefinition.TableVarName, true);
                if (!(schemaObject is Schema.TableVar))
                {
                    throw new CompilerException(CompilerException.Codes.InvalidReferenceObject, referenceDefinition, referenceDefinition.ReferenceName, referenceDefinition.ReferencesDefinition.TableVarName);
                }
                if (schemaObject.IsATObject)
                {
                    referenceDefinition.ReferencesDefinition.TableVarName = Schema.Object.EnsureRooted(((Schema.TableVar)schemaObject).SourceTableName);
                }
                else
                {
                    referenceDefinition.ReferencesDefinition.TableVarName = Schema.Object.EnsureRooted(schemaObject.Name);                     // Set the TableVarName in the references expression to the resolved identifier so that subsequent compiles do not depend on current library context (This really only matters in remote contexts, but there it is imperative, or this could be an ambiguous identifier)
                }
                plan.AttachDependency(schemaObject);
                reference.TargetTable = (Schema.TableVar)schemaObject;
                reference.AddDependency(schemaObject);

                foreach (ReferenceColumnDefinition column in referenceDefinition.ReferencesDefinition.Columns)
                {
                    reference.TargetKey.Columns.Add(reference.TargetTable.Columns[column.ColumnName]);
                }
                foreach (Schema.Key key in reference.TargetTable.Keys)
                {
                    if (reference.TargetKey.Columns.IsSupersetOf(key.Columns))
                    {
                        reference.TargetKey.IsUnique = true;
                        break;
                    }
                }

                if (!reference.TargetKey.IsUnique)
                {
                    throw new CompilerException(CompilerException.Codes.ReferenceMustTargetKey, referenceDefinition, referenceDefinition.ReferenceName, referenceDefinition.ReferencesDefinition.TableVarName);
                }

                if (reference.SourceKey.Columns.Count != reference.TargetKey.Columns.Count)
                {
                    throw new CompilerException(CompilerException.Codes.InvalidReferenceColumnCount, referenceDefinition, referenceDefinition.ReferenceName);
                }

                TableVar.References.Add(reference);
            }

            if (!plan.IsEngine)
            {
                foreach (AlterReferenceDefinition alterReference in _alterReferences)
                {
                    int referenceIndex = TableVar.References.IndexOf(alterReference.ReferenceName);
                    if (referenceIndex < 0)
                    {
                        referenceIndex = TableVar.References.IndexOfOriginatingReference(alterReference.ReferenceName);
                    }

                    if
                    (
                        (referenceIndex >= 0) ||
                        (
                            (plan.ApplicationTransactionID == Guid.Empty) &&
                            (!plan.InLoadingContext()) &&
                            !plan.InATCreationContext                             // We will be in an A/T creation context if we are reinfering view references for an A/T view
                        )
                    )
                    {
                        Schema.ReferenceBase referenceToAlter;
                        if (referenceIndex < 0)
                        {
                            referenceToAlter = TableVar.References[alterReference.ReferenceName];                             // This is just to throw the object not found error
                        }
                        else
                        {
                            referenceToAlter = TableVar.References[referenceIndex];
                        }
                        AlterNode.AlterMetaData(referenceToAlter, alterReference.AlterMetaData);
                        Schema.Object originatingReference = Compiler.ResolveCatalogIdentifier(plan, referenceToAlter.OriginatingReferenceName(), false);
                        if (originatingReference != null)
                        {
                            plan.AttachDependency(originatingReference);
                        }
                    }
                }
            }

            foreach (DropReferenceDefinition dropReference in _dropReferences)
            {
                //if (TableVar.HasDerivedReferences())
                //{
                //	int referenceIndex = TableVar.DerivedReferences.IndexOf(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.DerivedReferences.RemoveAt(referenceIndex);

                //	referenceIndex = TableVar.DerivedReferences.IndexOfOriginatingReference(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.DerivedReferences.RemoveAt(referenceIndex);
                //}

                //if (TableVar.HasSourceReferences())
                //{
                //	int referenceIndex = TableVar.SourceReferences.IndexOf(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.SourceReferences.RemoveAt(referenceIndex);

                //	referenceIndex = TableVar.SourceReferences.IndexOfOriginatingReference(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.SourceReferences.RemoveAt(referenceIndex);
                //}

                //if (TableVar.HasTargetReferences())
                //{
                //	int referenceIndex = TableVar.TargetReferences.IndexOf(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.TargetReferences.RemoveAt(referenceIndex);

                //	referenceIndex = TableVar.TargetReferences.IndexOfOriginatingReference(dropReference.ReferenceName);
                //	if (referenceIndex >= 0)
                //		TableVar.TargetReferences.RemoveAt(referenceIndex);
                //}

                if (TableVar.HasReferences())
                {
                    int referenceIndex = TableVar.References.IndexOf(dropReference.ReferenceName);
                    if (referenceIndex >= 0)
                    {
                        TableVar.References.RemoveAt(referenceIndex);
                    }

                    referenceIndex = TableVar.References.IndexOfOriginatingReference(dropReference.ReferenceName);
                    if (referenceIndex >= 0)
                    {
                        TableVar.References.RemoveAt(referenceIndex);
                    }
                }
            }
        }
Exemplo n.º 44
0
        private bool doRettifica(DataTable tEntryDetailSource)
        {
            if (tEntryDetailSource == null)
            {
                MessageBox.Show(this, "La tabella dei dettagli scritture non è definita", "Errore");
                return(false);
            }

            if (tEntryDetailSource.Rows.Count == 0)
            {
                MessageBox.Show(this, "La tabella dei dettagli scritture risulta vuota", "Avvertimento");
                return(true);
            }

            DataTable tEntry       = DataAccess.CreateTableByName(Meta.Conn, "entry", "*");
            DataTable tEntryDetail = DataAccess.CreateTableByName(Meta.Conn, "entrydetail", "*");

            tEntryDetail.Columns.Add("!valoreoriginale", typeof(decimal));

            DataSet ds = new DataSet();

            ds.Tables.Add(tEntry);
            ds.Tables.Add(tEntryDetail);

            ds.Relations.Add("entryentrydetail",
                             new DataColumn[] { tEntry.Columns["yentry"], tEntry.Columns["nentry"] },
                             new DataColumn[] { tEntryDetail.Columns["yentry"], tEntryDetail.Columns["nentry"] }, false);

            int currYear = (int)Meta.GetSys("esercizio");

            MetaData MEntry = MetaData.GetMetaData(this, "entry");

            MEntry.SetDefaults(ds.Tables["entry"]);
            MetaData.SetDefault(ds.Tables["entry"], "yentry", currYear);

            DateTime dec31 = new DateTime(currYear, 12, 31);
            string   descr = "Rettifica costi/ricavi in risconti";

            DataRow rEntry = MEntry.Get_New_Row(null, ds.Tables["entry"]);

            rEntry["identrykind"] = 3;
            rEntry["adate"]       = dec31;
            rEntry["description"] = descr;

            DateTime jan01 = new DateTime(1 + currYear, 1, 1);

            string campoRiscontoAttivo  = "idacc_deferredrevenue";
            string campoRiscontoPassivo = "idacc_deferredcost";

            object idacc_riscontoA = Meta.Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", currYear), campoRiscontoAttivo);

            if ((idacc_riscontoA == null) || (idacc_riscontoA == DBNull.Value))
            {
                MessageBox.Show(this, "Attenzione non è stato specificato il conto del risconto attivo", "Errore");
                return(false);
            }

            object idacc_riscontoP = Meta.Conn.DO_READ_VALUE("config", QHS.CmpEq("ayear", currYear), campoRiscontoPassivo);

            if ((idacc_riscontoP == null) || (idacc_riscontoP == DBNull.Value))
            {
                MessageBox.Show(this, "Attenzione non è stato specificato il conto del risconto passivo", "Errore");
                return(false);
            }

            MetaData MEntryDetail = MetaData.GetMetaData(this, "entrydetail");

            MEntryDetail.SetDefaults(ds.Tables["entrydetail"]);

            foreach (DataRow Curr in tEntryDetailSource.Rows)
            {
                decimal importoDettaglio = CfgFn.GetNoNullDecimal(Curr["amount"]);
                if (importoDettaglio == 0)
                {
                    continue;
                }

                object idAcc     = Curr["idacc"];
                string placcpart = valutaIdAcc(idAcc);

                if ((placcpart != "C") && (placcpart != "R"))
                {
                    continue;
                }

                if ((idAcc.Equals(idacc_riscontoA)) || (idAcc.Equals(idacc_riscontoP)))
                {
                    continue;
                }

                DateTime inizioCompetenza = (DateTime)Curr["competencystart"];
                DateTime fineCompetenza   = (DateTime)Curr["competencystop"];

                decimal importoRisconto = calcolaRisconto(AnnoCommerciale, (int)Meta.GetSys("esercizio"),
                                                          importoDettaglio, inizioCompetenza, fineCompetenza);
                if (importoRisconto == 0)
                {
                    continue;
                }


                // Dettaglio COSTO - RICAVO (Non ho il problema di controllare l'esistenza di una riga pregressa
                // perché per come è costruita la tabella le righe sono tutte diverse tra di loro
                MetaData.SetDefault(ds.Tables["entrydetail"], "yentry", currYear);
                MetaData.SetDefault(ds.Tables["entrydetail"], "nentry", rEntry["nentry"]);

                DataRow rEntryDetailCR = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                rEntryDetailCR["amount"]           = -importoRisconto;
                rEntryDetailCR["idacc"]            = Curr["idacc"];
                rEntryDetailCR["idreg"]            = Curr["idreg"];
                rEntryDetailCR["idupb"]            = Curr["idupb"];
                rEntryDetailCR["idsor1"]           = Curr["idsor1"];
                rEntryDetailCR["idsor2"]           = Curr["idsor2"];
                rEntryDetailCR["idsor3"]           = Curr["idsor3"];
                rEntryDetailCR["idaccmotive"]      = Curr["idaccmotive"];
                rEntryDetailCR["competencystart"]  = jan01;
                rEntryDetailCR["competencystop"]   = fineCompetenza;
                rEntryDetailCR["!valoreoriginale"] = Math.Abs(importoDettaglio);

                //EP.EffettuaScrittura(idepcontext, importoRisconto, idAcc, Curr["idreg"], Curr["idupb"],
                //    jan01, Curr["competencystop"], null, Curr["idaccmotive"]);
                object riscontoChoosen = "";
                if (placcpart == "C")
                {
                    riscontoChoosen = idacc_riscontoA;
                    //EP.EffettuaScrittura(idepcontext, importoRisconto, idacc_riscontoA.ToString(), null, null, null, null);
                }
                else
                {
                    riscontoChoosen = idacc_riscontoP;
                    //EP.EffettuaScrittura(idepcontext, importoRisconto, idacc_riscontoP.ToString(), null, null, null, null);
                }

                // Dettaglio RISCONTO
                string filter = costruisciFiltro(riscontoChoosen, Curr);
                if (tEntryDetail.Select(filter).Length > 0)
                {
                    DataRow rFound = tEntryDetail.Select(filter)[0];
                    rFound["amount"] = CfgFn.GetNoNullDecimal(rFound["amount"]) + importoRisconto;
                }
                else
                {
                    MetaData.SetDefault(ds.Tables["entrydetail"], "yentry", currYear);
                    MetaData.SetDefault(ds.Tables["entrydetail"], "nentry", rEntry["nentry"]);

                    DataRow rEntryDetailRis = MEntryDetail.Get_New_Row(rEntry, ds.Tables["entrydetail"]);
                    rEntryDetailRis["amount"]          = importoRisconto;
                    rEntryDetailRis["idacc"]           = riscontoChoosen;
                    rEntryDetailRis["idreg"]           = Curr["idreg"];
                    rEntryDetailRis["idupb"]           = Curr["idupb"];
                    rEntryDetailRis["idsor1"]          = Curr["idsor1"];
                    rEntryDetailRis["idsor2"]          = Curr["idsor2"];
                    rEntryDetailRis["idsor3"]          = Curr["idsor3"];
                    rEntryDetailRis["idaccmotive"]     = Curr["idaccmotive"];
                    rEntryDetailRis["competencystart"] = jan01;
                    rEntryDetailRis["competencystop"]  = fineCompetenza;
                    rEntryDetailCR["!valoreoriginale"] = importoDettaglio;
                }
            }

            FrmEntryPreSave frm = new FrmEntryPreSave(ds.Tables["entrydetail"], Meta.Conn, AnnoCommerciale);
            DialogResult    dr  = frm.ShowDialog();

            if (dr != DialogResult.OK)
            {
                MessageBox.Show(this, "Operazione Annullata!");
                return(true);
            }
            PostData Post = MEntry.Get_PostData();

            Post.InitClass(ds, Meta.Conn);

            if (Post.DO_POST())
            {
                DataRow rEntryPosted = ds.Tables["entry"].Rows[0];
                EditRelatedEntryByKey(rEntryPosted);
                MessageBox.Show(this, "Rettifica completata con successo!");
            }
            else
            {
                MessageBox.Show(this, "Errore nel salvataggio della scrittura di rettifica!", "Errore");
            }

            return(true);
        }
Exemplo n.º 45
0
        public override void Resolve()
        {
            string commandText   = base.commandText;
            string parameterHash = base.command.parameterHash;

            if (commandText.IndexOf(".") == -1)
            {
                commandText = base.Connection.Database + "." + commandText;
            }
            DataSet   parameters = this.GetParameters(commandText);
            DataTable table      = parameters.Tables["procedures"];

            this.parametersTable = parameters.Tables["procedure parameters"];
            StringBuilder builder  = new StringBuilder();
            StringBuilder builder2 = new StringBuilder();

            this.outSelect = string.Empty;
            string returnParameter = this.GetReturnParameter();

            foreach (DataRow row in this.parametersTable.Rows)
            {
                if (row["ORDINAL_POSITION"].Equals(0))
                {
                    continue;
                }
                string         str4              = (string)row["PARAMETER_MODE"];
                string         parameterName     = (string)row["PARAMETER_NAME"];
                MySqlParameter parameterFlexible = base.command.Parameters.GetParameterFlexible(parameterName, true);
                if (!parameterFlexible.TypeHasBeenSet)
                {
                    string typeName    = (string)row["DATA_TYPE"];
                    bool   unsigned    = GetFlags(row["DTD_IDENTIFIER"].ToString()).IndexOf("UNSIGNED") != -1;
                    bool   realAsFloat = table.Rows[0]["SQL_MODE"].ToString().IndexOf("REAL_AS_FLOAT") != -1;
                    parameterFlexible.MySqlDbType = MetaData.NameToType(typeName, unsigned, realAsFloat, base.Connection);
                }
                string str7 = parameterName;
                if (parameterName.StartsWith("@") || parameterName.StartsWith("?"))
                {
                    str7 = parameterName.Substring(1);
                }
                string str8 = string.Format("@{0}{1}", parameterHash, str7);
                parameterName = parameterFlexible.ParameterName;
                if (!parameterName.StartsWith("@") && !parameterName.StartsWith("?"))
                {
                    parameterName = "@" + parameterName;
                }
                switch (str4)
                {
                case "OUT":
                case "INOUT":
                    this.outSelect = this.outSelect + str8 + ", ";
                    builder.Append(str8);
                    builder.Append(", ");
                    break;

                default:
                    builder.Append(parameterName);
                    builder.Append(", ");
                    break;
                }
                if (str4 == "INOUT")
                {
                    builder2.AppendFormat(CultureInfo.InvariantCulture, "SET {0}={1};", new object[] { str8, parameterName });
                    this.outSelect = this.outSelect + str8 + ", ";
                }
            }
            string str9 = builder.ToString().TrimEnd(new char[] { ' ', ',' });

            this.outSelect = this.outSelect.TrimEnd(new char[] { ' ', ',' });
            if (table.Rows[0]["ROUTINE_TYPE"].Equals("PROCEDURE"))
            {
                str9 = string.Format("call {0} ({1})", base.commandText, str9);
            }
            else
            {
                if (returnParameter == null)
                {
                    returnParameter = parameterHash + "dummy";
                }
                else
                {
                    this.outSelect = string.Format("@{0}", returnParameter);
                }
                str9 = string.Format("SET @{0}={1}({2})", returnParameter, base.commandText, str9);
            }
            if (builder2.Length > 0)
            {
                str9 = builder2 + str9;
            }
            this.resolvedCommandText = str9;
        }
Exemplo n.º 46
0
        public IEnumerable <Row> ScanIndex(string tableName, string indexName)
        {
            // Get table
            var table = Database.Dmvs.Objects
                        .Where(x => x.Name == tableName && (x.Type == ObjectType.USER_TABLE || x.Type == ObjectType.SYSTEM_TABLE))
                        .SingleOrDefault();

            if (table == null)
            {
                throw new UnknownTableException(tableName);
            }

            // Get index
            var index = Database.Dmvs.Indexes
                        .Where(i => i.ObjectID == table.ObjectID && i.Name == indexName)
                        .SingleOrDefault();

            if (index == null)
            {
                throw new UnknownIndexException(tableName, indexName);
            }

            // Depending on index type, scan accordingly
            switch (index.Type)
            {
            case IndexType.Heap:
            case IndexType.Clustered:
                // For both heaps and clustered tables we delegate the responsibility to a DataScanner
                var scanner = new DataScanner(Database);
                return(scanner.ScanTable(tableName));

            case IndexType.Nonclustered:
                // Get the schema for the index
                var schema = MetaData.GetEmptyIndexRow(tableName, indexName);

                // Get rowset for the index
                var tableRowset = Database.Dmvs.SystemInternalsPartitions
                                  .FirstOrDefault(x => x.ObjectID == table.ObjectID && x.IndexID == index.IndexID);

                if (tableRowset == null)
                {
                    throw new Exception("Index has no rowset");
                }

                // Get allocation unit for in-row data
                var allocUnit = Database.Dmvs.SystemInternalsAllocationUnits
                                .SingleOrDefault(au => au.ContainerID == tableRowset.PartitionID && au.Type == (byte)AllocationUnitType.IN_ROW_DATA);

                if (allocUnit == null)
                {
                    throw new ArgumentException("Table has no allocation unit.");
                }

                // Scan the linked list of nonclustered index pages
                // TODO: Support compressed indexes
                return(ScanLinkedNonclusteredIndexPages(allocUnit.FirstPagePointer, schema, CompressionContext.NoCompression));

            default:
                throw new ArgumentException("Unsupported index type '" + index.Type + "'");
            }
        }
Exemplo n.º 47
0
 public Task <IRestResponse> GetThumbnailTask(MetaData file)
 {
     return(GetThumbnailTask(file.Path, ThumbnailSize.Small));
 }
Exemplo n.º 48
0
 public void MetaData_AfterLink()
 {
     Meta = MetaData.GetMetaData(this);
 }
Exemplo n.º 49
0
 protected LiteralExpression(
     MetaData metaData,
     [NotNull] Type type) :
     base(metaData) => Type = type;
Exemplo n.º 50
0
        public override void Resolve()
        {
            // first retrieve the procedure definition from our
            // procedure cache
            string spName = commandText;

            if (spName.IndexOf(".") == -1)
            {
                spName = Connection.Database + "." + spName;
            }

            DataSet ds = GetParameters(spName);

            DataTable procTable = ds.Tables["procedures"];

            parametersTable = ds.Tables["procedure parameters"];

            StringBuilder sqlStr = new StringBuilder();
            StringBuilder setStr = new StringBuilder();

            outSelect = String.Empty;

            string retParm = GetReturnParameter();

            foreach (DataRow param in parametersTable.Rows)
            {
                if (param["ORDINAL_POSITION"].Equals(0))
                {
                    continue;
                }
                string mode  = (string)param["PARAMETER_MODE"];
                string pName = (string)param["PARAMETER_NAME"];

                // make sure the parameters given to us have an appropriate
                // type set if it's not already
                MySqlParameter p = command.Parameters[pName];
                if (!p.TypeHasBeenSet)
                {
                    string datatype      = (string)param["DATA_TYPE"];
                    bool   unsigned      = param["FLAGS"].ToString().IndexOf("UNSIGNED") != -1;
                    bool   real_as_float = procTable.Rows[0]["SQL_MODE"].ToString().IndexOf("REAL_AS_FLOAT") != -1;
                    p.MySqlDbType = MetaData.NameToType(datatype, unsigned, real_as_float, Connection);
                }

                string basePName = pName.Substring(1);
                string vName     = string.Format("@{0}{1}", hash, basePName);

                if (mode == "OUT" || mode == "INOUT")
                {
                    outSelect += vName + ", ";
                    sqlStr.Append(vName);
                    sqlStr.Append(", ");
                }
                else
                {
                    sqlStr.Append(pName);
                    sqlStr.Append(", ");
                }

                if (mode == "INOUT")
                {
                    setStr.AppendFormat(CultureInfo.InvariantCulture, "SET {0}={1};", vName, pName);
                    outSelect += vName + ", ";
                }
            }

            string sqlCmd = sqlStr.ToString().TrimEnd(' ', ',');

            outSelect = outSelect.TrimEnd(' ', ',');
            if (procTable.Rows[0]["ROUTINE_TYPE"].Equals("PROCEDURE"))
            {
                sqlCmd = String.Format("call {0} ({1})", commandText, sqlCmd);
            }
            else
            {
                if (retParm == null)
                {
                    retParm = hash + "dummy";
                }
                else
                {
                    outSelect = String.Format("@{0}", retParm);
                }
                sqlCmd = String.Format("set @{0}={1}({2})", retParm, commandText, sqlCmd);
            }

            if (setStr.Length > 0)
            {
                sqlCmd = setStr + sqlCmd;
            }

            resolvedCommandText = sqlCmd;
        }
Exemplo n.º 51
0
        public static ApplicationVersion GetApplicationVersion(this MetaData metaData)
        {
            string versionAsString = metaData?["ApplicationVersion"];

            return(versionAsString == null ? ApplicationVersion.Empty : ApplicationVersion.FromString(versionAsString, ApplicationVersionGameType.Singleplayer));
        }
Exemplo n.º 52
0
        protected void TranslateExpression(CatalogDevicePlan devicePlan, CatalogDevicePlanNode devicePlanNode, PlanNode planNode)
        {
            InstructionNodeBase instructionNode = planNode as InstructionNodeBase;

            if (instructionNode != null)
            {
                if ((instructionNode.DataType != null) && (instructionNode.Operator != null))
                {
                    switch (Schema.Object.Unqualify(instructionNode.Operator.OperatorName))
                    {
                    case Instructions.And:
                    case Instructions.Equal:
                    case Instructions.NotEqual:
                    case Instructions.Greater:
                    case Instructions.InclusiveGreater:
                    case Instructions.Less:
                    case Instructions.InclusiveLess:
                    case Instructions.Like:
                        TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[0]);
                        devicePlanNode.WhereCondition.AppendFormat(" {0} ", GetInstructionKeyword(Schema.Object.Unqualify(instructionNode.Operator.OperatorName)));
                        TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[1]);
                        return;

                    case "ReadValue": TranslateExpression(devicePlan, devicePlanNode, instructionNode.Nodes[0]); return;

                    default: devicePlan.IsSupported = false; return;
                    }
                }
            }

            ValueNode valueNode = planNode as ValueNode;

            if (valueNode != null)
            {
                TranslateScalarParameter(devicePlan, devicePlanNode, planNode);
                return;
            }

            StackReferenceNode stackReferenceNode = planNode as StackReferenceNode;

            if (stackReferenceNode != null)
            {
                TranslateScalarParameter(devicePlan, devicePlanNode, new StackReferenceNode(stackReferenceNode.DataType, stackReferenceNode.Location - 1));
                return;
            }

            StackColumnReferenceNode stackColumnReferenceNode = planNode as StackColumnReferenceNode;

            if (stackColumnReferenceNode != null)
            {
                if (stackColumnReferenceNode.Location == 0)
                {
                    if (devicePlan.TableContext != null)
                    {
                        devicePlanNode.WhereCondition.Append(Schema.Object.EnsureUnrooted(MetaData.GetTag(devicePlan.TableContext.Columns[stackColumnReferenceNode.Identifier].MetaData, "Storage.Name", stackColumnReferenceNode.Identifier)));
                    }
                    else
                    {
                        devicePlanNode.WhereCondition.Append(Schema.Object.EnsureUnrooted(stackColumnReferenceNode.Identifier));
                    }
                }
                else
                {
                    TranslateScalarParameter(devicePlan, devicePlanNode, new StackColumnReferenceNode(stackColumnReferenceNode.Identifier, stackColumnReferenceNode.DataType, stackColumnReferenceNode.Location - 1));
                }

                return;
            }

            devicePlan.IsSupported = false;
        }
Exemplo n.º 53
0
		/// <summary>
		/// Reads the Metadata.
		/// </summary>
		/// <param name="buffer">Byte buffer source.</param>
		/// <returns>Metadata.</returns>
		public MetaData ReadMetaData(byte[] buffer) {
			MetaData retMeta = new MetaData();
			MemoryStream ms = new MemoryStream(buffer);
			AMFReader reader = new AMFReader(ms);
			string metaType = reader.ReadData() as string;
			IDictionary data = reader.ReadData() as IDictionary;
			retMeta.PutAll(data);
			return retMeta;
		}
Exemplo n.º 54
0
        }         // SetHmrcBusinessNames

        public void SetMetaData(MetaData oMetaData)
        {
            MetaData = oMetaData;
        }         // SetMetaData
Exemplo n.º 55
0
        private void LoadMetaData()
        {
            List<MetaData> metaDataList = new List<MetaData>();
            foreach (string filePath in CodeGeneraterWin.MetaDataPathList)
            {
                if (!System.IO.Directory.Exists(filePath))
                {
                    continue;
                }
                string[] files = Directory.GetFiles(filePath, "*.b?");
                if (files != null)
                {
                    foreach (string file in files)
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.Load(file);
                        var node = xmlDoc.FirstChild;
                        if (node != null)
                        {
                            string strNameSpace = node.Attributes["namespace"].Value;

                            if (node.Name == "EntityProj")
                            {
                                MetaData meta = new MetaData();
                                meta.FullName = strNameSpace + ".dll";
                                meta.FilePath = file;
                                meta.NodeType = RefType.BEEntity;
                                metaDataList.Add(meta);
                                //deploy
                                meta = new MetaData();
                                meta.FullName = strNameSpace + ".Deploy.dll";
                                meta.FilePath = file;
                                meta.NodeType = RefType.Deploy;
                                metaDataList.Add(meta);
                            }
                            else if (node.Name == "BPProj")
                            {
                                MetaData meta = new MetaData();
                                meta.FullName = strNameSpace + ".dll";
                                meta.FilePath = file;
                                meta.NodeType = RefType.BPEntity;
                                metaDataList.Add(meta);
                                //deploy
                                meta = new MetaData();
                                meta.FullName = strNameSpace + ".Deploy.dll";
                                meta.FilePath = file;
                                meta.NodeType = RefType.Deploy;
                                metaDataList.Add(meta);
                                //agent
                                meta = new MetaData();
                                meta.FullName = strNameSpace + ".Agent.dll";
                                meta.FilePath = file;
                                meta.NodeType = RefType.Agent;
                                metaDataList.Add(meta);
                            }
                        }
                    }
                }
            }
            this.RefreshEventDelegate = new RefreshMetaDataHandler(this.RefreshMetaData);
            this.tvMetaData.Invoke(this.RefreshEventDelegate, metaDataList);
        }
Exemplo n.º 56
0
        internal void ProcessCommand(SoapSudsArgs args)
        {
            ServiceType[] serviceTypes      = null;
            Type[]        assemblyTypes     = null;
            bool          generateCode      = false;
            bool          schemaGenerated   = false;
            bool          btempdirectory    = false;
            DirectoryInfo dir               = null;
            ArrayList     outCodeStreamList = new ArrayList();

            if (args.serviceTypeInfos != null)
            {
                serviceTypes = new ServiceType[args.serviceTypeInfos.Length];
                Type     type;
                Assembly assem;

                for (int i = 0; i < args.serviceTypeInfos.Length; i++)
                {
                    try
                    {
                        assem = Assembly.Load(args.serviceTypeInfos[i].assembly);
                    }
                    catch (Exception ex)
                    {
                        String baseDirectory = Thread.GetDomain().BaseDirectory;
                        String assemName     = args.serviceTypeInfos[i].assembly;
                        if (assemName.EndsWith(".dll") || assemName.EndsWith(".exe"))
                        {
                            throw new ApplicationException(Resource.FormatString("Err_AssemblyName", args.serviceTypeInfos[i].assembly, baseDirectory), ex);
                        }
                        else
                        {
                            throw new ApplicationException(Resource.FormatString("Err_Assembly", args.serviceTypeInfos[i].assembly, baseDirectory), ex);
                        }
                    }


                    if (assem == null)
                    {
                        String baseDirectory = Thread.GetDomain().BaseDirectory;
                        String assemName     = args.serviceTypeInfos[i].assembly;
                        if (assemName.EndsWith(".dll") || assemName.EndsWith(".exe"))
                        {
                            throw new ApplicationException(Resource.FormatString("Err_AssemblyName", args.serviceTypeInfos[i].assembly, baseDirectory));
                        }
                        else
                        {
                            throw new ApplicationException(Resource.FormatString("Err_Assembly", args.serviceTypeInfos[i].assembly, baseDirectory));
                        }
                    }

                    type = assem.GetType(args.serviceTypeInfos[i].type);

                    if (type == null)
                    {
                        throw new ArgumentException(Resource.FormatString("Err_Type", args.serviceTypeInfos[i].type, assem));
                    }

                    serviceTypes[i] = new ServiceType(type, args.serviceTypeInfos[i].serviceEndpoint);
                }
            }

            if (args.inputSchemaFile != null)
            {
                FileInfo file = new FileInfo(args.inputSchemaFile);
                if (!(file.Exists))
                {
                    throw new ApplicationException(Resource.FormatString("Err_InputSchemaFileNotFound", args.inputSchemaFile));
                }
            }

            if (args.inputAssemblyFile != null)             // input assembly
            {
                try
                {
                    Assembly assem = Assembly.Load(args.inputAssemblyFile);
                    if (assem == null)
                    {
                        String baseDirectory = Thread.GetDomain().BaseDirectory;
                        String assemName     = args.inputAssemblyFile;
                        if (assemName.EndsWith(".dll") || assemName.EndsWith(".exe"))
                        {
                            throw new ApplicationException(Resource.FormatString("Err_AssemblyName", args.inputAssemblyFile, baseDirectory));
                        }
                        else
                        {
                            throw new ApplicationException(Resource.FormatString("Err_Assembly", args.inputAssemblyFile, baseDirectory));
                        }
                    }

                    assemblyTypes = assem.GetExportedTypes();
                    serviceTypes  = new ServiceType[assemblyTypes.Length];
                    for (int i = 0; i < serviceTypes.Length; i++)
                    {
                        serviceTypes[i] = new ServiceType(assemblyTypes[i], args.serviceEndpoint);
                    }
                }
                catch (Exception ex)
                {
                    String baseDirectory = Thread.GetDomain().BaseDirectory;
                    String assemName     = args.inputAssemblyFile;
                    if (assemName.EndsWith(".dll") || assemName.EndsWith(".exe"))
                    {
                        throw new ApplicationException(Resource.FormatString("Err_AssemblyName", args.inputAssemblyFile, baseDirectory), ex);
                    }
                    else
                    {
                        throw new ApplicationException(Resource.FormatString("Err_Assembly", args.inputAssemblyFile, baseDirectory), ex);
                    }
                }
            }

            if (args.outputDirectory == null)
            {
                // Create a temp subdirectory in the temp directory
                // loop until a directory can be created
                String temppath = Path.GetTempPath();
                Random ran      = new Random();
                while (true)
                {
                    try
                    {
                        dir = Directory.CreateDirectory(temppath + "\\SS" + ran.Next(10000).ToString("X") + ".tmp");
                        break;
                    }
                    catch {}
                }

                args.outputDirectory = dir.FullName;
                generateCode         = true;
                btempdirectory       = true;
            }
            else
            {
                // See if specified directory exists
                dir = new DirectoryInfo(args.outputDirectory);
                if (!(dir.Exists))
                {
                    throw new ApplicationException(Resource.FormatString("Err_odInvalidDirectory", args.outputDirectory));
                }
                generateCode = true;
            }


            //
            // GENERATE SCHEMA
            //

            bool bOutputOptionProvided = false;             // tracks whether an output option was provided


            schemaGenerated = false;
            MemoryStream outSchemaStream = new MemoryStream();

            if (args.inputSchemaFile != null)             // copy schema file to schema output stream
            {
                Stream fs        = File.OpenRead(args.inputSchemaFile);
                int    chunkSize = 1024;
                byte[] buffer    = new byte[chunkSize];
                int    bytesRead;
                do
                {
                    bytesRead = fs.Read(buffer, 0, chunkSize);
                    if (bytesRead > 0)
                    {
                        outSchemaStream.Write(buffer, 0, bytesRead);
                    }
                } while (bytesRead == chunkSize);
                fs.Close();

                schemaGenerated = true;
            }

            if (serviceTypes != null)
            {
                MetaData.ConvertTypesToSchemaToStream(serviceTypes, args.sdlType, outSchemaStream);
                schemaGenerated = true;
            }

            if (args.urlToSchema != null)             // pull schema from the web
            {
                try
                {
                    RetrieveSchemaFromUrl(args.urlToSchema, outSchemaStream, args);
                    schemaGenerated = true;
                }
                catch (Exception ex)
                {
                    String errorMsg = Resource.FormatString("Err_urlSchema", args.urlToSchema);

                    if (!args.urlToSchema.ToLower(CultureInfo.InvariantCulture).EndsWith("?wsdl"))
                    {
                        errorMsg += " " + Resource.FormatString("Err_urlMightNeedWsdl");
                    }

                    throw new ApplicationException(errorMsg, ex);
                }
            }

            // Ensure that some sort of schema data has been provided
            if (!schemaGenerated)
            {
                throw new ApplicationException(Resource.FormatString("Err_NoSchemaInput"));
            }

            if (args.outputSchemaFile != null)             // save schema to file if output requested
            {
                bOutputOptionProvided = true;

                outSchemaStream.Position = 0;
                MetaData.SaveStreamToFile(outSchemaStream, args.outputSchemaFile);
            }

            //
            // END OF GENERATE SCHEMA
            //

            if (generateCode || args.outputAssemblyFile != null)
            {
                bOutputOptionProvided = true;

                // The out stream stream for the step above, becomes the
                // in schema stream for the code gen
                outSchemaStream.Position = 0;

                try
                {
                    MetaData.ConvertSchemaStreamToCodeSourceStream(args.wp, args.outputDirectory, outSchemaStream, outCodeStreamList, args.urlToSchema, args.proxyNamespace);
                }
                catch (Exception ex)
                {
                    throw new ApplicationException(Resource.FormatString("Err_InvalidSchemaData"), ex);
                }
            }


            if (args.outputAssemblyFile != null)
            {
                bOutputOptionProvided = true;

                MetaData.ConvertCodeSourceStreamToAssemblyFile(outCodeStreamList, args.outputAssemblyFile, args.strongNameFile);
            }


            if (!bOutputOptionProvided)
            {
                Console.WriteLine(Resource.FormatString("Err_NoOutputOptionGiven"));
            }

            if (btempdirectory)
            {
                // delete temp directory
                dir.Delete(true);
            }
        }         // ProcessCommand
Exemplo n.º 57
0
        private void btnSpesa_Click(object sender, EventArgs e)
        {
            if (Meta.IsEmpty)
            {
                return;
            }
            Meta.GetFormData(true);

            DataRow Curr      = DS.csa_contracttax_partition.Rows[0];
            string  filter    = "";
            object  idregauto = Get_Registry_Auto();

            int selectedfase = CfgFn.GetNoNullInt32(cmbFaseSpesa.SelectedValue);

            if (selectedfase > 0)
            {
                filter = QHS.AppAnd(filter, QHS.CmpEq("nphase", selectedfase)); //,
            }
            else
            {
                filter = QHS.AppAnd(filter, QHS.CmpNe("nphase", Meta.GetSys("maxexpensephase")),
                                    QHS.CmpGe("nphase", Meta.GetSys("expensefinphase")),
                                    QHS.CmpLt("nphase", Meta.GetSys("expenseregphase")));
            }

            int ymov = CfgFn.GetNoNullInt32(txtEserc.Text.Trim());
            int nmov = CfgFn.GetNoNullInt32(txtNum.Text.Trim());

            if ((ymov != 0) && (nmov != 0))
            {
                filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov), QHS.CmpEq("nmov", nmov));
            }
            else
            {
                object selectedUPB = Curr["idupb"];
                object selectedFin = Curr["idfin"];
                if (ymov != 0)
                {
                    filter = QHS.AppAnd(filter, QHS.CmpEq("ymov", ymov));
                }

                if ((nmov != 0))
                {
                    filter = QHS.AppAnd(filter, QHS.CmpEq("nmov", nmov));
                }

                var filterUpb = "";
                if (selectedUPB != DBNull.Value)
                {
                    filterUpb = QHC.CmpEq("idupb", selectedUPB);
                }
                var filterFin = "";
                if (selectedFin != DBNull.Value)
                {
                    filterFin = QHC.CmpEq("idfin", selectedFin);
                }

                filter = QHS.AppAnd(filter, filterUpb);
                if (filterFin != "")
                {
                    filter = QHS.AppAnd(filter, filterFin);
                }
            }



            MetaData E = Meta.Dispatcher.Get("expense");

            E.FilterLocked = true;
            E.DS           = DS.Clone();
            DataRow Choosen = E.SelectOne("default", filter, "expense", null);

            if (Choosen == null)
            {
                return;
            }
            int oldIdExp = CfgFn.GetNoNullInt32(Curr["idexp"]);
            int newIdExp = CfgFn.GetNoNullInt32(Choosen["idexp"]);

            Curr["idexp"] = Choosen["idexp"];

            DS.expenseview.Clear();
            Meta.Conn.RUN_SELECT_INTO_TABLE(DS.expenseview, null,
                                            QHS.AppAnd(QHS.CmpEq("idexp", Curr["idexp"]), QHS.CmpEq("ayear", Meta.GetSys("esercizio"))),
                                            null, true);
            txtEserc.Text = Choosen["ymov"].ToString();
            txtNum.Text   = Choosen["nmov"].ToString();
            cmbFaseSpesa.SelectedValue = Choosen["nphase"];


            Curr["idfin"] = Choosen["idfin"];
            Curr["idupb"] = Choosen["idupb"];
            Meta.Conn.RUN_SELECT_INTO_TABLE(DS.fin, null, QHS.CmpEq("idfin", Curr["idfin"]),
                                            null, true);
            Meta.Conn.RUN_SELECT_INTO_TABLE(DS.upb, null,
                                            QHS.CmpEq("idupb", Curr["idupb"]),
                                            null, true);


            Meta.FreshForm(false);
        }
Exemplo n.º 58
0
        public void Add(MetaData metadata)
        {
            string key = GetFavouriteKeyName(metadata.Path);

            _cache.Add(key, metadata);
        }
Exemplo n.º 59
0
        private void btnLinkEpExp_Click(object sender, EventArgs e)
        {
            if (Meta.IsEmpty)
            {
                return;
            }
            DataRow curr = DS.csa_contracttax_partition.Rows[0];

            MetaData.GetFormData(this, true);
            //EP_functions ep = new EP_functions (MetaData.d);

            object nphase = cmbFaseImpBudget.SelectedValue; // Impegno
            string filter = "";
            int    yepexp = CfgFn.GetNoNullInt32(txtEsercizioImpegno.Text.Trim());

            if (yepexp != 0)
            {
                filter = QHS.CmpEq("yepexp", yepexp);
            }
            else
            {
                filter = QHS.CmpEq("ayear", Meta.GetSys("esercizio"));
            }
            int nepexp = CfgFn.GetNoNullInt32(txtNumImpegno.Text.Trim());

            if (nepexp != 0)
            {
                filter = QHS.AppAnd(filter, QHS.CmpEq("nepexp", nepexp));
            }

            string filter_fase = "";

            if (CfgFn.GetNoNullInt32(nphase) == 0)
            {
                filter_fase = QHS.CmpEq("nphase", 1);
            }
            if (CfgFn.GetNoNullInt32(nphase) == 1)
            {
                filter_fase = QHS.CmpEq("nphase", nphase);
            }

            filter = QHS.AppAnd(filter, filter_fase);
            //  Filter = QHS.AppAnd(Filter, EP.GetFilterForEpexp(Meta, Curr["idrelated"].ToString()));
            String fAmount = QHS.CmpGt("isnull(totcurramount,0) - isnull(totalcost,0)", 0); // condizione sul disponibile

            filter = QHS.AppAnd(filter, fAmount);

            object selectedUPB     = curr["idupb"];
            object selectedAccount = curr["idacc"];

            var filterUpb = "";

            if (selectedUPB != DBNull.Value)
            {
                filterUpb = QHC.CmpEq("idupb", selectedUPB);
            }
            var filterAccount = "";

            if (selectedAccount != DBNull.Value)
            {
                filterAccount = QHC.CmpEq("idacc", selectedAccount);
            }

            filter = QHS.AppAnd(filter, filterUpb);
            if (filterAccount != "")
            {
                filter = QHS.AppAnd(filter, filterAccount);
            }

            string   VistaScelta = "epexpview";
            MetaData mepexp      = Meta.Dispatcher.Get(VistaScelta);

            mepexp.FilterLocked = true;
            mepexp.DS           = DS;
            DataRow Choosen = mepexp.SelectOne("default", filter, null, null);


            if (Choosen != null)
            {
                curr["idepexp"] = Choosen["idepexp"];
                DS.epexpview.Clear();
                Conn.RUN_SELECT_INTO_TABLE(DS.epexpview, null,
                                           QHS.AppAnd(QHS.CmpEq("idepexp", curr["idepexp"]), QHS.CmpEq("ayear", Meta.GetSys("esercizio"))),
                                           null, true);
                curr["idacc"] = Choosen["idacc"];
                curr["idupb"] = Choosen["idupb"];
                Conn.RUN_SELECT_INTO_TABLE(DS.account, null, QHS.CmpEq("idacc", curr["idacc"]),
                                           null, true);
                Conn.RUN_SELECT_INTO_TABLE(DS.upb, null,
                                           QHS.CmpEq("idupb", curr["idupb"]),
                                           null, true);
                txtEsercizioImpegno.Text       = Choosen["yepexp"].ToString();
                txtNumImpegno.Text             = Choosen["nepexp"].ToString();
                cmbFaseImpBudget.SelectedValue = Choosen["nphase"];
                Meta.FreshForm();
            }
        }
Exemplo n.º 60
0
        private void FirmarFacturaToolStripMenuItemClick(object sender, EventArgs e)
        {
            using (OpenFileDialog openCertificadoFileDialog = new OpenFileDialog
            {
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                Title = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Seleccione_su_certificado_de_usuario,
                Filter = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Certificado_Digital____p12____p12
            })
            {
                if (openCertificadoFileDialog.ShowDialog(this) == DialogResult.OK)
                {
                    if (!string.IsNullOrEmpty(openCertificadoFileDialog.FileName))
                    {
                        Passs pass = new Passs();

                        if (pass.ShowDialog() == DialogResult.OK)
                        {
                            Cert myCert = null;
                            try
                            {
                                myCert = new Cert(openCertificadoFileDialog.FileName, pass.Password);
                            }
                            catch (Exception ex)
                            {
                                XtraMessageBox.Show(ex.Message, Application.ProductName);
                                return;
                            }

                            OpenFileDialog openFileDialog = new OpenFileDialog
                            {
                                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                Title            =
                                    FacturasRecursos.
                                    Form1_firmarFacturaToolStripMenuItem_Click_Seleccione_una_factura_sin_firmar,
                                Filter =
                                    FacturasRecursos.
                                    Form1_firmarFacturaToolStripMenuItem_Click_Factura____pdf____pdf
                            };


                            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
                            {
                                if (!string.IsNullOrEmpty(openFileDialog.FileName))
                                {
                                    MetaData myMd = new MetaData();
                                    myMd.Author   = Settings.Default.nombre;
                                    myMd.Title    = string.Format("Factura emitida por {0}", Settings.Default.nombre);
                                    myMd.Subject  = "Factura por translado en taxi";
                                    myMd.Keywords = "factura, taxi, mariano";
                                    myMd.Creator  = "Riccardo Prieto Mendoza";
                                    myMd.Producer = "Riccardo Prieto Mendoza";

                                    using (SaveFileDialog sabeD = new SaveFileDialog
                                    {
                                        InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                        Title = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Guardar_Factura_Firmada_como___,
                                        Filter = FacturasRecursos.Form1_firmarFacturaToolStripMenuItem_Click_Factura____pdf____pdf
                                    })
                                    {
                                        if (sabeD.ShowDialog(this) == DialogResult.OK)
                                        {
                                            PdfSigner pdfs = new PdfSigner(openFileDialog.FileName, sabeD.FileName, myCert, myMd);
                                            pdfs.Sign("Factura por translado en taxi", Settings.Default.email, Settings.Default.direccion + " " + Settings.Default.poblacionCP, false);


                                            Process.Start(sabeD.FileName);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }