示例#1
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;
     }
 }
示例#2
0
        public static string SetCorpClientData(string sessionId, string methodName, CorpClient client)
        {
            string result = String.Empty;
            string noClients = String.Empty;
            string linkedPersons = String.Empty;

            if (client.LinkedPersons.Count > 0)
            {
                foreach (var person in client.LinkedPersons)
                {
                    linkedPersons += "{";
                    linkedPersons += String.Format("\"rnk\": {0}, \"personStateID\": {1}", person.Rnk,
                        person.PersonState);
                    linkedPersons += "},";
                }
                linkedPersons = linkedPersons.Remove(linkedPersons.Length - 1);
            }

            if (client.NoClients.Count > 0)
            {
                foreach (var person in client.NoClients)
                {
                    noClients += "{";
                    noClients += String.Format("\"id\": {0}, \"personStateID\": {1}, \"name\": \"{2}\", \"client_type\": {3}, \"inn_edrpou\":\"{4}\"",
                        person.PersonNumber, person.StateId, person.FullName.Replace("\"", "\\\""), person.ClientType, person.Ipn);
                    noClients += "},";
                }
                noClients = noClients.Remove(noClients.Length - 1);
            }

            // {"rnk":1063592,"personStateID":22},{"rnk":1063592,"personStateID":26}
            result += "{";
            result += String.Format("\"sessionid\":\"{0}\",\"method\":\"{1}\",\"params\":" +
                                    "[{{\"branch_id\":\"{2}\",\"rnk\":{3},\"changed\":\"{4}\"," +
                                    "\"created\":\"{5}\",\"client_type\":\"{6}\",\"client_name\":\"{7}\",\"inn_edrpou\":\"{8}\",\"user_login\":\"{9}\"," +
                                    "\"user_fio\":\"{10}\",\"actualized_date\":\"{11}\",\"actualized_by\":\"{12}\",\"third_persons_clients\":[{13}], \"third_persons_non_clients\":[{14}]}}]," +
                                    "\"message_id\":\"BARS-MESS-379518\"", sessionId, methodName, client.BranchCode, client.Rnk, client.ChangeDate,
                                    client.CreateDate, client.ClientTypeCode, client.ClientName.Replace("\"", "\\\""), client.Inn_Edrpou,
                                    client.UserLogin, client.UserFio, client.ActualizeDate, client.ActualizeBy, linkedPersons, noClients);
            result += "}";
            return result;
        }
示例#3
0
        private CorpClient GetCorpClientItem()
        {
            try
            {
                CorpClient client = new CorpClient
                {
                    BranchCode = paramsGridView.Rows[0].Cells[1].Value.ToString(),
                    Rnk = paramsGridView.Rows[1].Cells[1].Value.ToString(),
                    ChangeDate = paramsGridView.Rows[2].Cells[1].Value.ToString(),
                    CreateDate = paramsGridView.Rows[3].Cells[1].Value.ToString(),
                    ClientTypeCode = paramsGridView.Rows[4].Cells[1].Value.ToString(),
                    ClientName = paramsGridView.Rows[5].Cells[1].Value.ToString(),
                    Inn_Edrpou = paramsGridView.Rows[6].Cells[1].Value.ToString(),
                    UserLogin = paramsGridView.Rows[7].Cells[1].Value.ToString(),
                    UserFio = paramsGridView.Rows[8].Cells[1].Value.ToString(),
                    ActualizeDate = paramsGridView.Rows[9].Cells[1].Value.ToString(),
                    ActualizeBy = paramsGridView.Rows[10].Cells[1].Value.ToString(),
                    //ThirdPerson = paramsGridView.Rows[11].Cells[1].Value.ToString()
                };

                //int i = 11;
                for (int i = 11; i < paramsGridView.Rows.Count; i++)
                {
                    if (paramsGridView.Rows[i].Cells[2].Value.ToString().StartsWith("LinkedPerson"))
                    {
                        LinkedPerson lk = new LinkedPerson();
                        lk.Rnk = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        i++;

                        lk.PersonState = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        client.LinkedPersons.Add(lk);

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

                    if (paramsGridView.Rows[i].Cells[2].Value.ToString().StartsWith("NoClient"))
                    {
                        var noClient = new NoClient();
                        noClient.PersonNumber = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        i++;

                        noClient.StateId = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        i++;

                        noClient.FullName = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        i++;

                        noClient.ClientType = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        i++;

                        noClient.Ipn = paramsGridView.Rows[i].Cells[1].Value.ToString();

                        client.NoClients.Add(noClient);

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

                _userHistory.CurrentItem = client;

                return client;
            }
            catch (Exception ex)
            {
                //throw;
                return null;
            }
        }