Beispiel #1
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (CredentialID != null)
         {
             hashCode = hashCode * 59 + CredentialID.GetHashCode();
         }
         if (Hash != null)
         {
             hashCode = hashCode * 59 + Hash.GetHashCode();
         }
         if (SAD != null)
         {
             hashCode = hashCode * 59 + SAD.GetHashCode();
         }
         if (ClientData != null)
         {
             hashCode = hashCode * 59 + ClientData.GetHashCode();
         }
         return(hashCode);
     }
 }
 private void NewDataEventHandler(object sender, DisposalInterconnectionData e)
 {
     if (string.IsNullOrEmpty(e.ID))
     {
         return;
     }
     EnsureChildControls();
     m_SelectedItemTitle.Text = e.Title;
     using (Entities _entities = new Entities())
     {
         DisposalRequestLib _drl = Element.GetAtIndex <DisposalRequestLib>(_entities.DisposalRequestLibrary, e.ID);
         List <SAD>         _cns = new List <SAD>();
         SPWeb _wb = SPContext.Current.Web;
         foreach (CustomsWarehouseDisposal _cwd in _drl.CustomsWarehouseDisposal(_entities, false))
         {
             if (_cwd.CWL_CWDisposal2ClearanceID == null)
             {
                 continue;
             }
             if (_cwd.CWL_CWDisposal2ClearanceID.SADConsignmentLibraryIndex == null)
             {
                 continue;
             }
             SPDocumentLibrary _lib = (SPDocumentLibrary)_wb.Lists[SADConsignment.IPRSADConsignmentLibraryTitle];
             SAD _sad = CAS.SharePoint.DocumentsFactory.File.ReadXmlFile <SAD>(_lib, _cwd.CWL_CWDisposal2ClearanceID.SADConsignmentLibraryIndex.Id.Value);
             _cns.Add(_sad);
         }
         SADCollection _sc = new SADCollection()
         {
             ListOfSAD = _cns.ToArray()
         };
         m_HiddenFieldData.Value = System.Web.HttpUtility.HtmlEncode(CAS.SharePoint.Serialization.XmlSerializer.Serialize <SADCollection>(_sc, Settings.SADCollectionStylesheetName));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Returns true if InputCredentialsExtendTransaction instances are equal
        /// </summary>
        /// <param name="other">Instance of InputCredentialsExtendTransaction to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InputCredentialsExtendTransaction other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CredentialID == other.CredentialID ||
                     CredentialID != null &&
                     CredentialID.Equals(other.CredentialID)
                     ) &&
                 (
                     Hash == other.Hash ||
                     Hash != null &&
                     Hash.Equals(other.Hash)
                 ) &&
                 (
                     SAD == other.SAD ||
                     SAD != null &&
                     SAD.Equals(other.SAD)
                 ) &&
                 (
                     ClientData == other.ClientData ||
                     ClientData != null &&
                     ClientData.Equals(other.ClientData)
                 ));
        }
Beispiel #4
0
        public ActionResult SADInvoice(long?id, string SearchString, string sort)
        {
            if (User.Identity.IsAuthenticated)
            {
                ViewBag.idd  = sort == "Id" ? "Id desc" : "Id";
                ViewBag.nr   = sort == "Nr" ? "Nr desc" : "Nr";
                ViewBag.date = sort == "Date" ? "Date desc" : "Date";

                List <SAD> all = SADSearch(id, SearchString, sort);
                if (Session["SelectedIdIS"] != null)
                {
                    id = Convert.ToInt32(Session["SelectedIdIS"]);
                }
                if (all.Any())
                {
                    SAD sad = db.SAD.FirstOrDefault(x => x.Id == id);
                    ViewBag.InvoiceToAdd    = GetInvoiceToAdd(sad.Currency);
                    ViewBag.InvoiceToDelete = GetInvoiceToDelete(sad.Id);
                }


                return(View(all.ToList()));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #5
0
        public ActionResult SADDelete(long id)
        {
            SAD sAD = db.SAD.Find(id);

            db.SAD.Remove(sAD);
            db.SaveChanges();
            return(RedirectToAction("SADList"));
        }
 private void onCreateMessageTemplates(object sender, EventArgs e)
 {
     TraceEvent("Entering ClearThroughCustoms.onCreateMessageTemplates", 46, TraceSeverity.Monitorable);
     try
     {
         string _MasterDocumentName = String.Empty;
         using (Entities _entities = new Entities(workflowProperties.WebUrl))
         {
             DisposalRequestLib _Dr = Element.GetAtIndex <DisposalRequestLib>(_entities.DisposalRequestLibrary, workflowProperties.ItemId);
             foreach (CustomsWarehouseDisposal _cwdx in _Dr.CustomsWarehouseDisposal(_entities, false))
             {
                 if (_cwdx.CustomsStatus.Value != CustomsStatus.NotStarted)
                 {
                     continue;
                 }
                 Clearence _newClearance = Clearence.CreataClearence(_entities, "Customs Warehouse Withdraw", _Dr.ClearenceProcedure.Value, TraceEvent);
                 _cwdx.CWL_CWDisposal2ClearanceID = _newClearance;
                 _cwdx.CustomsStatus = CustomsStatus.Started;
                 if (_cwdx.CWL_CWDisposal2CustomsWarehouseID.TobaccoNotAllocated.Value > 0 ||
                     _cwdx.CWL_CWDisposal2CustomsWarehouseID.CustomsWarehouseDisposal(_entities, false).Where <CustomsWarehouseDisposal>(x => x.CustomsStatus.Value == CustomsStatus.NotStarted).Any <CustomsWarehouseDisposal>())
                 {
                     _cwdx.ClearingType = ClearingType.PartialWindingUp;
                 }
                 else
                 {
                     _cwdx.ClearingType         = ClearingType.TotalWindingUp;
                     _cwdx.TobaccoValue        += _cwdx.CWL_CWDisposal2CustomsWarehouseID.Value.Value - _cwdx.CWL_CWDisposal2CustomsWarehouseID.CustomsWarehouseDisposal(_entities, false).Sum <CustomsWarehouseDisposal>(x => x.TobaccoValue.Value);
                     _cwdx.TobaccoValue         = _cwdx.TobaccoValue.Value.RoundValue();
                     _cwdx.CW_SettledNetMass   += _cwdx.CWL_CWDisposal2CustomsWarehouseID.CW_Quantity.Value - _cwdx.CWL_CWDisposal2CustomsWarehouseID.CustomsWarehouseDisposal(_entities, false).Sum <CustomsWarehouseDisposal>(x => x.CW_SettledNetMass.Value);
                     _cwdx.CW_SettledNetMass    = _cwdx.CW_SettledNetMass.Value.RoundValue();
                     _cwdx.CW_SettledGrossMass += _cwdx.CWL_CWDisposal2CustomsWarehouseID.GrossMass.Value - _cwdx.CWL_CWDisposal2CustomsWarehouseID.CustomsWarehouseDisposal(_entities, false).Sum <CustomsWarehouseDisposal>(x => x.CW_SettledGrossMass.Value);
                     _cwdx.CW_SettledGrossMass  = _cwdx.CW_SettledGrossMass.Value.RoundValue();
                 }
                 _MasterDocumentName = _newClearance.SADTemplateDocumentNameFileName(_entities);
                 SAD _sad = CraeteSAD(_entities, _cwdx, _MasterDocumentName);
                 TraceEvent(" ClearThroughCustoms.onCreateMessageTemplates at File.CreateXmlFile", 4756, TraceSeverity.Monitorable);
                 SPFile         _newFile        = File.CreateXmlFile <SAD>(workflowProperties.Web, _sad, _MasterDocumentName, SADConsignment.IPRSADConsignmentLibraryTitle, SAD.StylesheetNmane);
                 SADConsignment _sadConsignment = Element.GetAtIndex <SADConsignment>(_entities.SADConsignment, _newFile.Item.ID);
                 _sadConsignment.Archival = true;
                 _newClearance.SADConsignmentLibraryIndex = _sadConsignment;
                 TraceEvent(" ClearThroughCustoms.onCreateMessageTemplates at SubmitChanges", 80, TraceSeverity.Monitorable);
                 _entities.SubmitChanges();
             }
         }
         logToHistoryListActivity_HistoryOutcome     = "Success";
         logToHistoryListActivity_HistoryDescription = String.Format("Document {0} created successfully", _MasterDocumentName);
     }
     catch (Exception _ex)
     {
         logToHistoryListActivity_HistoryOutcome     = "Exception";
         logToHistoryListActivity_HistoryDescription = _ex.Message;
         TraceEvent(String.Format("Exception {0} at ClearThroughCustoms.onCreateMessageTemplates: {1}; StackTrace: {2}", _ex.GetType().Name, _ex.Message, _ex.StackTrace), 46, TraceSeverity.High);
     }
     TraceEvent("Finishing ClearThroughCustoms.onCreateMessageTemplates", 98, TraceSeverity.Monitorable);
 }
Beispiel #7
0
 public ActionResult SADEdit([Bind(Include = "Id,SadNumber,SadDate,Currency,ExchangeRate,SadStatus,Paid,PaidDate,Remarks")] SAD sAD)
 {
     if (ModelState.IsValid)
     {
         if (sAD.SadNumber.Contains("/"))
         {
             sAD.SadNumber = sAD.SadNumber.Replace("/", String.Empty);
         }
         db.Entry(sAD).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("SADList", new { id = sAD.Id }));
     }
     return(View(sAD));
 }
        //TODO this doesn't pass if executed as "Run All" - the test data must be copied to the working directory.
        public void DeserializationTestMethod()
        {
            SAD _sad = XmlFile.ReadXmlFile <SAD>(@"TestData\TestSAD.xml");

            Assert.IsNotNull(_sad);
            SADCollection _sc = new SADCollection()
            {
                ListOfSAD = new SAD[] { _sad, _sad }
            };

            XmlFile.WriteXmlFile <SADCollection>(_sc, @"TestData\TestSADCollection.xml", System.IO.FileMode.Create, "SADCollection.xls");
            SADCollection _new = XmlFile.ReadXmlFile <SADCollection>(@"TestData\TestSADCollection.xml");

            Assert.IsNotNull(_new);
        }
Beispiel #9
0
        /// <summary>
        /// Returns true if InputSignaturesSignhash instances are equal
        /// </summary>
        /// <param name="other">Instance of InputSignaturesSignhash to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(InputSignaturesSignhash other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     CredentialID == other.CredentialID ||
                     CredentialID != null &&
                     CredentialID.Equals(other.CredentialID)
                     ) &&
                 (
                     SAD == other.SAD ||
                     SAD != null &&
                     SAD.Equals(other.SAD)
                 ) &&
                 (
                     Hash == other.Hash ||
                     Hash != null &&
                     Hash.Equals(other.Hash)
                 ) &&
                 (
                     HashAlgo == other.HashAlgo ||
                     HashAlgo != null &&
                     HashAlgo.Equals(other.HashAlgo)
                 ) &&
                 (
                     SignAlgo == other.SignAlgo ||
                     SignAlgo != null &&
                     SignAlgo.Equals(other.SignAlgo)
                 ) &&
                 (
                     SignAlgoParams == other.SignAlgoParams ||
                     SignAlgoParams != null &&
                     SignAlgoParams.Equals(other.SignAlgoParams)
                 ) &&
                 (
                     ClientData == other.ClientData ||
                     ClientData != null &&
                     ClientData.Equals(other.ClientData)
                 ));
        }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (SAD != null)
         {
             hashCode = hashCode * 59 + SAD.GetHashCode();
         }
         if (ExpiresIn != null)
         {
             hashCode = hashCode * 59 + ExpiresIn.GetHashCode();
         }
         return(hashCode);
     }
 }
Beispiel #11
0
 // GET: Transport/Details/5
 public ActionResult SADDetails(long?id)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         SAD sAD = db.SAD.Find(id);
         if (sAD == null)
         {
             return(HttpNotFound());
         }
         return(View(sAD));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
        /// <summary>
        /// 简单类型工厂创建primitiveType,如ID等
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="product"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public override abstractType Create(compositeType parent, Enum product, string name)
        {
            abstractType tmp = null;

            switch (product)
            {
            case enumPrimitive.DR: tmp = new DR(name); break;

            case enumPrimitive.DT: tmp = new DT(name); break;

            case enumPrimitive.FT: tmp = new FT(name); break;

            case enumPrimitive.ID: tmp = new ID(name); break;

            case enumPrimitive.IS: tmp = new IS(name); break;

            case enumPrimitive.NM: tmp = new NM(name); break;

            case enumPrimitive.SAD: tmp = new SAD(name); break;

            case enumPrimitive.SI: tmp = new SI(name); break;

            case enumPrimitive.ST: tmp = new ST(name); break;

            case enumPrimitive.TM: tmp = new TM(name); break;

            case enumPrimitive.TN: tmp = new TN(name); break;

            case enumPrimitive.TS: tmp = new TS(name); break;

            case enumPrimitive.TX: tmp = new TX(name); break;

            case enumPrimitive.VARIES: tmp = new VARIES(name); break;

            case enumPrimitive.MO: tmp = new MO(name); break;

            default:
                throw new NotSupportedException();
            }
            return(tmp);
        }
        private static SAD CraeteSAD(Entities entities, CustomsWarehouseDisposal disposal, string masterDocumentName)
        {
            SADGood _entrySAD = disposal.CWL_CWDisposal2CustomsWarehouseID.CWL_CW2ClearenceID.Clearence2SadGoodID;
            List <SADZgloszenieTowarDokumentWymagany> _dcsList = new List <SADZgloszenieTowarDokumentWymagany>();
            int _Pos = 1;

            _dcsList.Add(SADZgloszenieTowarDokumentWymagany.Create(_Pos++, Settings.CustomsProcedureCode9DK8, masterDocumentName, String.Empty));
            foreach (SADRequiredDocuments _rdx in _entrySAD.SADRequiredDocuments(entities, false))
            {
                if (Required(_rdx.Code))
                {
                    _dcsList.Add(SADZgloszenieTowarDokumentWymagany.Create(_Pos++, _rdx.Code, _rdx.Number, _rdx.Title));
                }
            }
            decimal _IloscTowaruId = 1;

            SADZgloszenieTowarIloscTowaru[] _IloscTowaruArray = new SADZgloszenieTowarIloscTowaru[]
            {
                SADZgloszenieTowarIloscTowaru.Create(ref _IloscTowaruId, disposal.CW_SettledNetMass.ConvertToDecimal(), disposal.CW_SettledGrossMass.ConvertToDecimal())
            };
            decimal _Value = disposal.TobaccoValue.ConvertToDecimal();
            decimal _SADZgloszenieTowarId = 1;
            string  _CWDocumentNo         = disposal.CWL_CWDisposal2CustomsWarehouseID.DocumentNo;
            string  _CustomsProcedure     = String.IsNullOrEmpty(disposal.CustomsProcedure) ? disposal.CWL_CWDisposal2DisposalRequestLibraryID.ClearenceProcedure.Value.Convert2String() : disposal.CustomsProcedure;

            SADZgloszenieTowar[] _good = new SADZgloszenieTowar[]
            {
                SADZgloszenieTowar.Create
                    (disposal.GoodsName(entities), disposal.CW_PackageToClear.ConvertToDecimal(), _CWDocumentNo, _Value, ref _SADZgloszenieTowarId, disposal.ProductCode,
                    disposal.ProductCodeTaric, _CustomsProcedure, _dcsList.ToArray(), _IloscTowaruArray)
            };
            SADZgloszenieUC _CustomsOffice = SADZgloszenieUC.Create(Settings.GetParameter(entities, SettingsEntry.DefaultCustomsOffice));
            SADZgloszenie   _application   = SADZgloszenie.Create(_good, _CustomsOffice,
                                                                  Settings.GetParameter(entities, SettingsEntry.RecipientOrganization),
                                                                  Vendor.SenderOrganization(entities));

            return(SAD.Create(Settings.GetParameter(entities, SettingsEntry.OrganizationEmail), _application));
        }
        /// <summary>
        /// Returns true if OutputCredentialsExtendTransaction instances are equal
        /// </summary>
        /// <param name="other">Instance of OutputCredentialsExtendTransaction to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OutputCredentialsExtendTransaction other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     SAD == other.SAD ||
                     SAD != null &&
                     SAD.Equals(other.SAD)
                     ) &&
                 (
                     ExpiresIn == other.ExpiresIn ||
                     ExpiresIn != null &&
                     ExpiresIn.Equals(other.ExpiresIn)
                 ));
        }