Exemplo n.º 1
0
        /// <summary>
        /// Creates the clearance.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="good">The good.</param>
        /// <returns></returns>
        public static Clearence CreataClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, SADGood good)
        {
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            _newClearance.Clearence2SadGoodID = good;
            _newClearance.DocumentNo          = good.SADDocumentIndex.DocumentNumber;
            _newClearance.ReferenceNumber     = good.SADDocumentIndex.ReferenceNumber;
            _newClearance.UpdateTitle(entities);
            entities.Clearence.InsertOnSubmit(_newClearance);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            return(_newClearance);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts the clearance and creates an object of <see cref="Clearence" />.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="procedure">The customs procedure.</param>
        /// <param name="procedureCode">The procedure code.</param>
        /// <param name="trace">The trace action.</param>
        /// <returns>Return new <see cref="Clearence"/> entity.</returns>
        public static Clearence CreateClearance(Entities entities, string procedure, ClearenceProcedure procedureCode, NamedTraceLogger.TraceAction trace)
        {
            trace("Entering Clearence.CreateClearance", 98, TraceSeverity.Verbose);
            Clearence _newClearance = CreateClearance(procedure, procedureCode);

            entities.Clearence.InsertOnSubmit(_newClearance);
            _newClearance.UpdateTitle(entities);
            trace("Clearence.CreateClearance at SubmitChanges", 103, TraceSeverity.Verbose);
            entities.SubmitChanges();
            _newClearance.UpdateTitle(entities);
            trace("Finished Clearence.CreateClearance", 106, TraceSeverity.Verbose);
            return(_newClearance);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets the parameter.
        /// </summary>
        /// <param name="edc">The edc.</param>
        /// <param name="index">The parameter index.</param>
        /// <returns></returns>
        public static string GetParameter(Entities edc, SettingsEntry index)
        {
            Settings _ret = (from _sx in edc.Settings where _sx.KeyValue.Contains(index.ToString()) select _sx).FirstOrDefault();

            if (_ret == null)
            {
                _ret = new Settings()
                {
                    KeyValue = index.ToString(),
                    Title    = m_DefaultSettings[index]
                };
                edc.Settings.InsertOnSubmit(_ret);
                edc.SubmitChanges();
            }
            return(_ret.Title);
        }
Exemplo n.º 4
0
        internal static Consent DefaultConsent(Entities edc, CustomsProcess process, string number)
        {
            int      _defPeriod = 360;
            DateTime _defDate   = DateTime.Today.Date;
            Consent  _ret       = new Consent()
            {
                ConsentDate   = _defDate,
                ConsentPeriod = _defPeriod / 30,
                IsIPR         = process == CustomsProcess.ipr,
                Title         = String.Format("{0}", number.NotAvailable()),
                ValidFromDate = _defDate,
                ValidToDate   = _defDate + TimeSpan.FromDays(_defPeriod)
            };

            edc.Consent.InsertOnSubmit(_ret);
            edc.SubmitChanges();
            return(_ret);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Adds the or get.
        /// </summary>
        /// <param name="entities">The entities.</param>
        /// <param name="productCodeNumber">The product code number.</param>
        /// <param name="title">The title.</param>
        /// <returns></returns>
        public static PCNCode AddOrGet(Entities entities, string productCodeNumber, string title)
        {
            PCNCode _pcncode = Find(entities, false, productCodeNumber);

            if (_pcncode == null)
            {
                _pcncode = new PCNCode()
                {
                    //TODO PCNCode - auto generation value of the column CompensationGood http://cas_sp:11225/sites/awt/Lists/TaskList/DispForm.aspx?ID=3341
                    CompensationGood  = "Tytoń",
                    Disposal          = false,
                    ProductCodeNumber = productCodeNumber,
                    Title             = title
                };
                entities.PCNCode.InsertOnSubmit(_pcncode);
                entities.SubmitChanges();
            }
            return(_pcncode);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Reports the action result.
 /// </summary>
 /// <param name="url">The _url.</param>
 public void ReportActionResult(string url)
 {
     if (this.Count == 0)
     {
         return;
     }
     try
     {
         using (Entities _edc = new Entities(url))
         {
             foreach (string _msg in this)
             {
                 ActivityLogCT _entry = new ActivityLogCT()
                 {
                     Title = "ReportActionResult", Body = _msg, Expires = DateTime.Now + new TimeSpan(2, 0, 0, 0)
                 };
                 _edc.ActivityLog.InsertOnSubmit(_entry);
             }
             _edc.SubmitChanges();
         }
     }
     catch (Exception) { }
 }