Exemplo n.º 1
0
        private DocumentAttributeSed SetDocumentAttributesSedItem()
        {
            DocumentAttributeSed docAttribute = new DocumentAttributeSed
            {
                //BranchCode = paramsGridView.Rows[2].Cells[1].Value.ToString(),
                UserFullName = paramsGridView.Rows[1].Cells[1].Value.ToString(),
                UserLogin = paramsGridView.Rows[0].Cells[1].Value.ToString(),
                ModifyDateTime = paramsGridView.Rows[2].Cells[1].Value.ToString()
            };

            for(int i = 3; i < paramsGridView.Rows.Count; i++)
            {
                SedDocument document = new SedDocument
                {
                    Id = Guid.Parse(paramsGridView.Rows[i].Cells[1].Value.ToString()),
                    Version = paramsGridView.Rows[++i].Cells[1].Value.ToString()
                };
                i++;

                while (paramsGridView.Rows[i].Cells[2].Value.ToString() == "SedDocProperties")
                {
                    var prop = new SedDocument.SedDocumentProperties
                    {
                        Name = (DocumentProperties)Enum.Parse(typeof(DocumentProperties), paramsGridView.Rows[i].Cells[0].Value.ToString()),
                        Code = paramsGridView.Rows[i].Cells[1].Value.ToString()
                    };
                    document.PropertiesCollection.Add(prop);
                    i++;

                    if (i == paramsGridView.Rows.Count)
                    {
                        break;
                    }
                }

                docAttribute.Documents.Add(document);
            }

            return docAttribute;
        }
Exemplo n.º 2
0
        public static string SetDocumentAttributesSed(string sessionId, string methodName, DocumentAttributeSed document)
        {
            string result = String.Empty;

            var docInFolder = String.Empty;
            foreach (var doc in document.Documents)
            {
                var properties = String.Empty;

                foreach (var propert in doc.PropertiesCollection)
                {
                    properties += "{";

                    properties += String.Format("\"property_name\":\"{0}\",\"property_value\":\"{1}\"", propert.Name, propert.Code);

                    properties += "},";
                }

                properties = properties.Remove(properties.Length - 1, 1);

                docInFolder += "{";

                docInFolder += String.Format("\"ID\": \"{0}\",\"Version\": \"{1}\", \"values\":[{2}]", doc.Id, doc.Version, properties);

                docInFolder += "},";

                docInFolder = docInFolder.Remove(docInFolder.Length - 1, 1);

            }

            result += "{";
            result +=
                String.Format(
                    "\"sessionid\":\"{0}\",\"method\":\"{1}\",\"params\":[{{\"user_login\":\"{2}\",\"user_fio\":\"{3}\",\"changed\":\"{4}\",\"documents\":[{5}]}}],\"message_id\":\"BARS-MESS-15003\"",
                    sessionId, methodName, document.UserLogin, document.UserFullName, document.ModifyDateTime, docInFolder);

            result += "}";
            return result;
        }
Exemplo n.º 3
0
 private void InitializeEntityForMethod(Methods methodName)
 {
     switch (methodName)
     {
         case Methods.SetDocumentDataWithOutBinary:
             Document doc = new Document(_setParam.UserLoginOther, _setParam.UserNameOther, _setParam.BranchCode, _setParam.ChangeDate, _setParam.CreateDate);
             BuildParamsTable(doc);
             paramsGridView.Rows.RemoveAt(11);
             break;
         case Methods.SetDocumentDataWithBinary:
             Document document = new Document(_setParam.UserLoginOther, _setParam.UserNameOther, _setParam.BranchCode, _setParam.ChangeDate, _setParam.CreateDate);
             BuildParamsTable(document);
             break;
         case Methods.SetClientData:
             Client client = new Client(_setParam.BranchCode, _setParam.ChangeDate, _setParam.CreateDate, _setParam.ClientType, _setParam.BirthDate,
                 _setParam.UserLoginOther, _setParam.UserNameOther);
             BuildParamsTable(client);
             break;
         case Methods.ActualizeIdDocs:
             ActuaalizeDoc actualizeDoc = new ActuaalizeDoc(_setParam.BranchCode, _setParam.UserLoginOther, _setParam.UserNameOther, _setParam.CreateDate);
             BuildParamsTable(actualizeDoc);
             break;
         case Methods.SetAgreementData:
             Agreement agreement = new Agreement(_setParam.ChangeDate, _setParam.CreateDate, _setParam.BranchCode,
                 _setParam.UserLoginOther, _setParam.UserNameOther, _setParam.AgreementType, _setParam.AgreementStatus, _setParam.AgreementOpenDate, new List<LinkedPerson>());
             BuildParamsTable(agreement);
             break;
         case Methods.GetDocumentData:
             DocumentBinary documentBinary = new DocumentBinary();
             BuildParamsTable(documentBinary);
             break;
         case Methods.SetAccountDataU:
             Account account = new Account(_setParam.ChangeDate, _setParam.CreateDate, _setParam.AccountOpenDate, _setParam.UserBranchCodeOther,
                 _setParam.UserLoginOther, _setParam.UserNameOther, _setParam.AccountTypeCode, _setParam.CurrencyCode, _setParam.AccountStatusCode);
             BuildParamsTable(account);
             break;
         case Methods.SetClientDataU:
             CorpClient corpClient = new CorpClient(_setParam.UserBranchCodeOther, _setParam.ChangeDate, _setParam.CreateDate, _setParam.ClientType,
                 _setParam.UserLoginOther, _setParam.UserNameOther, new List<LinkedPerson>() , new List<NoClient>());
             BuildParamsTable(corpClient);
             break;
         case Methods.SetAgreementDataU:
             CorpAgreement corpAgreement = new CorpAgreement(_setParam.ChangeDate, _setParam.CreateDate, _setParam.BranchCode, _setParam.UserLoginOther,
                 _setParam.UserNameOther, _setParam.AgreementType, _setParam.AgreementStatus, _setParam.ClientType, _setParam.AgreementOpenDate);
             BuildParamsTable(corpAgreement);
             break;
         case Methods.SetDictionaryData:
             Branch branch = new Branch();
             BuildParamsTable(branch);
             break;
         case Methods.GetClientDataSed:
             BuildParamsTable(new ClientDataSed());
             break;
         case Methods.GetDocumentMetaDataSed:
             BuildParamsTable(new DocumentMetadataSed());
             break;
         case Methods.GetDictionaryDataSed:
             BuildParamsTable(new DictionaryDataSed());
             break;
         case Methods.SetDocumentAttributesSed:
             var documentAttributeSed = new DocumentAttributeSed();//{ModifyDateTime = _setParam.ChangeDate};
             IFormatProvider theCultureInfo = CultureInfo.InvariantCulture;
             documentAttributeSed.ModifyDateTime = _setParam.ChangeDate.ToString(theCultureInfo);
             BuildParamsTable(documentAttributeSed);
             break;
     }
 }