Exemplo n.º 1
0
        public void think_a_good_name_and_change_it()
        {
            var printDate = new PrintDate();

            printDate.PrintCurrentDate();

            // I don't know how to test it
        }
Exemplo n.º 2
0
        public string GetRequestParams(string additionAttribute = "")
        {
            StringBuilder sb = new StringBuilder();

            //sb.AppendFormat("<InputValue ClientKey=\"{0}\" UserID=\"{1}\" />", CSession.CLIENT_KEY, CSession.UserID);
            sb.Append("<RequestParams ");
            sb.Append(additionAttribute);
            if (ID > 0)
            {
                sb.Append(string.Format(" ID=\"{0}\"", ID));
            }
            sb.Append(string.Format(" RefNo=\"{0}\"", HtmlEncode(RefNo)));
            sb.Append(string.Format(" RefNumber=\"{0}\"", RefNumber));
            sb.Append(string.Format(" RefType=\"{0}\"", RefType));
            if (RefDate > new DateTime(1900, 01, 01))
            {
                sb.Append(string.Format(" RefDate=\"{0}\"", RefDate.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            sb.Append(string.Format(" ObjectID=\"{0}\"", ObjectID));
            sb.Append(string.Format(" ObjectName=\"{0}\"", HtmlEncode(ObjectName)));
            sb.Append(string.Format(" ObjectAddress=\"{0}\"", HtmlEncode(ObjectAddress)));
            sb.Append(string.Format(" ObjectEmail=\"{0}\"", HtmlEncode(ObjectEmail)));
            sb.Append(string.Format(" ContactName=\"{0}\"", HtmlEncode(ContactName)));
            sb.Append(string.Format(" AssetOwnerID=\"{0}\"", AssetOwnerID));
            sb.Append(string.Format(" AssetOwnerName=\"{0}\"", HtmlEncode(AssetOwnerName)));
            sb.Append(string.Format(" AssetOwnerAddress=\"{0}\"", HtmlEncode(AssetOwnerAddress)));
            sb.Append(string.Format(" AssetType=\"{0}\"", AssetType));
            sb.Append(string.Format(" AssetLicenseNumber=\"{0}\"", HtmlEncode(AssetLicenseNumber)));
            sb.Append(string.Format(" AssetNumberPlate=\"{0}\"", HtmlEncode(AssetNumberPlate)));
            sb.Append(string.Format(" ContractNo=\"{0}\"", HtmlEncode(ContractNo)));
            sb.Append(string.Format(" ContractType=\"{0}\"", ContractType));
            sb.Append(string.Format(" ContractTypeName=\"{0}\"", ContractTypeName));
            sb.Append(string.Format(" WebUserName=\"{0}\"", HtmlEncode(WebUserName)));
            if (WarranterID > 0)
            {
                sb.Append(string.Format(" WarranterID=\"{0}\"", WarranterID));
            }
            sb.Append(string.Format(" WarranterCode=\"{0}\"", HtmlEncode(WarranterCode)));
            sb.Append(string.Format(" FileNumber=\"{0}\"", HtmlEncode(FileNumber)));

            if (WarranterID <= 0 && string.IsNullOrEmpty(WarranterCode) && WarranterList != null && WarranterList.Count > 0)
            {
                sb.Append(string.Format(" WarranterName=\"{0}\"", HtmlEncode(WarranterList[0].ObjectName)));
                sb.Append(string.Format(" WarranterAddress=\"{0}\"", HtmlEncode(WarranterList[0].ObjectAddress)));
            }
            else
            {
                sb.Append(string.Format(" WarranterName=\"{0}\"", HtmlEncode(WarranterName)));
                sb.Append(string.Format(" WarranterAddress=\"{0}\"", HtmlEncode(WarranterAddress)));
            }
            sb.Append(string.Format(" WarranterEmail=\"{0}\"", HtmlEncode(WarranterEmail)));
            sb.Append(string.Format(" RegisTransRefNo=\"{0}\"", HtmlEncode(RegisTransRefNo)));
            sb.Append(string.Format(" OldRefNo=\"{0}\"", HtmlEncode(OldRefNo)));
            sb.Append(string.Format(" OrgRefNo=\"{0}\"", HtmlEncode(OrgRefNo)));
            if (OldRefDate > new DateTime(1900, 01, 01))
            {
                sb.Append(string.Format(" OldRefDate=\"{0}\"", OldRefDate.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            //sb.Append(string.Format(" OldRefDate=\"{0}\"", HtmlEncode(OldRefDate)));
            sb.Append(string.Format(" Type=\"{0}\"", Type));
            sb.Append(string.Format(" TypeName=\"{0}\"", HtmlEncode(TypeName)));
            sb.Append(string.Format(" Description=\"{0}\"", HtmlEncode(Description)));
            if (RefType == 28)
            {
                sb.Append(string.Format(" Note=\"{0}\"", HtmlEncode(Note)));
            }
            else
            {
                sb.Append(string.Format(" Note=\"{0}\"", HtmlEncode("")));
            }
            sb.Append(string.Format(" Status=\"{0}\"", HtmlEncode(Status.ToString())));
            if (PrintDate > new DateTime(1900, 01, 01))
            {
                sb.Append(string.Format(" PrintDate = \"{0}\"", PrintDate.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            if (ExpiredDate > new DateTime(1900, 01, 01))
            {
                sb.Append(string.Format(" ExpiredDate = \"{0}\"", ExpiredDate.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            if (ReceiveDateTime > new DateTime(1900, 01, 01))
            {
                sb.Append(string.Format(" ReceiveDateTime = \"{0}\"", ReceiveDateTime.ToString("yyyy-MM-dd HH:mm:ss")));
            }
            sb.Append(string.Format(" NumPagesAttachment=\"{0}\"", NumPagesAttachment));
            if (AssetPersonalCode != null)
            {
                sb.Append(string.Format(" AssetPersonalCode=\"{0}\"", HtmlEncode(AssetPersonalCode)));
            }
            if (AssetIDCardNo != null)
            {
                sb.Append(string.Format(" AssetIDCardNo=\"{0}\"", HtmlEncode(AssetIDCardNo)));
            }

            sb.Append(" >");
            if (WarranterList != null)
            {
                for (int i = 0; i < WarranterList.Count; i++)
                {
                    sb.Append("<Warranter ");
                    if (WarranterList[i].ID > 0)
                    {
                        sb.Append(string.Format(" ID=\"{0}\"", WarranterList[i].ID));
                    }
                    sb.Append(string.Format(" Code=\"{0}\"", HtmlEncode(WarranterList[i].ObjectCode)));
                    sb.Append(string.Format(" Name=\"{0}\"", HtmlEncode(WarranterList[i].ObjectName)));
                    sb.Append(string.Format(" Address=\"{0}\"", HtmlEncode(WarranterList[i].ObjectAddress)));

                    sb.Append("/>");
                }
            }
            if (AssetOwnnerList != null)
            {
                for (int i = 0; i < AssetOwnnerList.Count; i++)
                {
                    sb.Append("<AssetOwnner ");
                    if (AssetOwnnerList[i].ID > 0)
                    {
                        sb.Append(string.Format(" ID=\"{0}\"", AssetOwnnerList[i].ID));
                    }
                    sb.Append(string.Format(" Code=\"{0}\"", HtmlEncode(AssetOwnnerList[i].ObjectCode)));
                    sb.Append(string.Format(" Name=\"{0}\"", HtmlEncode(AssetOwnnerList[i].ObjectName)));
                    sb.Append(string.Format(" Address=\"{0}\"", HtmlEncode(AssetOwnnerList[i].ObjectAddress)));
                    sb.Append(string.Format(" IDCardNumber=\"{0}\"", HtmlEncode(AssetOwnnerList[i].ObjectIDCardNumber)));
                    sb.Append("/>");
                }
            }
            if (Assets != null)
            {
                for (int i = 0; i < Assets.Count; i++)
                {
                    if (!string.IsNullOrEmpty(Assets[i].AssetLicenseNumber) || !string.IsNullOrEmpty(Assets[i].AssetDescription) || !string.IsNullOrEmpty(Assets[i].AssetNumberPlate))
                    {
                        sb.Append("<Asset ");
                        if (Assets[i].ID > 0)
                        {
                            sb.Append(string.Format(" ID=\"{0}\"", Assets[i].ID));
                        }
                        sb.Append(string.Format(" Type=\"{0}\"", Assets[i].AssetType));
                        sb.Append(string.Format(" LicenseNumber=\"{0}\"", HtmlEncode(Assets[i].AssetLicenseNumber)));
                        sb.Append(string.Format(" NumberPlate=\"{0}\"", HtmlEncode(Assets[i].AssetNumberPlate)));
                        sb.Append(string.Format(" Description=\"{0}\"", HtmlEncode(Assets[i].AssetDescription)));
                        sb.Append(string.Format(" AssetName=\"{0}\"", HtmlEncode(Assets[i].AssetName)));
                        sb.Append(string.Format(" Selected=\"{0}\"", Assets[i].Selected?1:0));
                        sb.Append(string.Format(" RegisType=\"{0}\"", Assets[i].RegisType));
                        sb.Append(string.Format(" IsModify=\"{0}\"", Assets[i].IsModify?1:0));
                        sb.Append(string.Format(" ModifyNote=\"{0}\"", HtmlEncode(Assets[i].ModifyNote)));
                        sb.Append("/>");
                    }
                }
            }
            sb.Append(" </RequestParams>");
            return(sb.ToString());
        }