public PackageModel GetFullGraph() { var package = new PackageModel(); package.Trust = new List <TrustModel>(); foreach (var address in Context.Graph.Address) { var issuer = new IssuerModel(); issuer.Id = address.Id; var subjects = new List <SubjectModel>(); if (address.Edges != null) { foreach (var edge in address.Edges) { var child = new SubjectModel(); Context.InitSubjectModel(child, edge); subjects.Add(child); } } if (subjects.Count > 0) { issuer.Subjects = subjects.ToArray(); } var trust = new TrustModel(); trust.Issuer = issuer; package.Trust.Add(trust); } return(package); }
public BulkAPIResponse <ZCRMRecord> InsertIssuer(IssuerModel issuer) { // hardcode ZCRMRestClient.Initialize(config); ZohoOAuthClient client = ZohoOAuthClient.GetInstance(); string refreshToken = "1000.354c162c19b5da4fc4053bc4e38dd27f.1e548f961cc913acbacd82fbad0a3387"; string userMailId = "*****@*****.**"; ZohoOAuthTokens tokens = client.GenerateAccessTokenFromRefreshToken(refreshToken, userMailId); List <ZCRMRecord> records = new List <ZCRMRecord>(); ZCRMRecord record1 = new ZCRMRecord("accounts"); //module api name record1.SetFieldValue("Account_Name", issuer.UserName); record1.SetFieldValue("Full_Name", issuer.FullName); record1.SetFieldValue("Username", issuer.UserName); record1.SetFieldValue("Industry", "1"); record1.SetFieldValue("Company_Name", issuer.BusinessName.ToString()); record1.SetFieldValue("Phone", issuer.MobileNumber); record1.SetFieldValue("Fax", issuer.MobileNumber); record1.SetFieldValue("Employees", 1); record1.SetFieldValue("Total_Amount_Disbursed", issuer.totaldisbursed); record1.SetFieldValue("Last_Repayment_Date", issuer.LastRepaymentDate.Value.ToString()); record1.SetFieldValue("Days_Overdue", issuer.daysoverdue); record1.SetFieldValue("Issuer_Account_Balance", issuer.ActualAmount); record1.SetFieldValue("Outstanding_Amount_with_Late_Fee", issuer.outamountwithlf); record1.SetFieldValue("Outstanding_Amount_no_Late_Fee", issuer.outamountwithoutlf); record1.SetFieldValue("Outstanding_Late_Fee", issuer.outstandinglf); record1.SetFieldValue("Total_Amount_Overdue", issuer.overdueamount); record1.SetFieldValue("Total_Principle_Paid", issuer.totalpaidprincipal); record1.SetFieldValue("Total_Interest_Paid", issuer.totalpaidinterest); record1.SetFieldValue("Total_Late_Fee_Paid", issuer.paidlatefees); record1.SetFieldValue("Total_Late_Interest_Paid", issuer.totalpaidlateinterest); record1.SetFieldValue("Total_Paid_Amount", issuer.TotalPaidAmount); record1.CreatedTime = DateTime.UtcNow.Ticks.ToString(); records.Add(record1); ZCRMModule moduleIns = ZCRMModule.GetInstance("accounts"); //module api name BulkAPIResponse <ZCRMRecord> response = moduleIns.CreateRecords(records); //records - list of ZCRMRecord instances filled with required data for upsert. List <ZCRMRecord> insertedRecords = response.BulkData; //upsertedRecords - list of ZCRMRecord instance foreach (var entityID in response.BulkData) { var newID = new tbl_CheckID { IDZoho = entityID.EntityId, EmailMS = issuer.UserName }; dbzoho.tbl_CheckID.Add(newID); dbzoho.SaveChanges(); } List <EntityResponse> entityResponses = response.BulkEntitiesResponse; //entityResponses - list of EntityResponses instance return(response); }
public void Create(Invoice invoice) { SoldProductModel soldProductModel = new SoldProductModel(); Id = invoice.Id; AcessKey = invoice.AcessKey; IssueDate = invoice.IssueDate; EntryDate = invoice.EntryDate; Addressee = new AddresseeModel(); Addressee.Create(invoice.Addressee); Issuer = new IssuerModel(); Issuer.Create(invoice.Issuer); Tax = new InvoiceTaxModel(); Tax.Create(invoice.InvoiceTax); OperationNature = invoice.OperationNature; Products = new List <SoldProductModel>(); Products = soldProductModel.CreateList(invoice.SoldProducts); if (invoice.ShippingCompany != null) { ShippingCompany = new ShippingCompanyModel(); ShippingCompany.Create(invoice.ShippingCompany); } }
//public BulkAPIResponse<ZCRMRecord> InsertInvestor(InvestorModel investor) //{ // ZCRMRestClient.Initialize(config); // ZohoOAuthClient client = ZohoOAuthClient.GetInstance(); // string refreshToken = "1000.354c162c19b5da4fc4053bc4e38dd27f.1e548f961cc913acbacd82fbad0a3387"; // string userMailId = "*****@*****.**"; // ZohoOAuthTokens tokens = client.GenerateAccessTokenFromRefreshToken(refreshToken, userMailId); // List<ZCRMRecord> records = new List<ZCRMRecord>(); // ZCRMRecord record1 = new ZCRMRecord("accounts"); //module api name // record1.SetFieldValue("Account_Name", investor.UserName); // record1.SetFieldValue("Email", investor.UserName); // record1.SetFieldValue("Username", investor.UserName); // record1.SetFieldValue("Industry", "1"); // record1.SetFieldValue("Status", "1"); // record1.SetFieldValue("Phone", investor.MobileNumber); // record1.SetFieldValue("Fax", investor.MobileNumber); // record1.SetFieldValue("Employees", 1); // record1.SetFieldValue("Age", investor.Age); // record1.SetFieldValue("Gender", investor.Gender); // record1.SetFieldValue("NRIC_Number", investor.NRIC_Number); // record1.SetFieldValue("Passport_Number", investor.PassportNumber); // record1.SetFieldValue("Date_Of_Birth", investor.DateOfBirth.Value); // record1.SetFieldValue("Sign_Up_Date", investor.DateCreated.Value.Date.ToString()); // record1.SetFieldValue("Total_Invested", investor.TotalInvestedAmount); // record1.SetFieldValue("Admin_Verification", investor.AdminVerification); // record1.SetFieldValue("Number_Of_Delinquent_Off_Note", investor.numofdelinquent); // record1.SetFieldValue("Number_Of_Fully_Paid_Note", investor.NumberOfFullyPaidNotes); // record1.SetFieldValue("Number_of_Close_Off_Note", investor.NumOfCloseOff); // record1.SetFieldValue("Qualified_Date", investor.QualifiedDate.Value.Date.ToString()); // if (investor.LastLogin == null) // { // investor.LastLogin = investor.DateCreated; // } // record1.SetFieldValue("Last_Login", investor.LastLogin.Value.Date.ToString()); // record1.SetFieldValue("Number_Of_Deliquent_Note", investor.numofdelinquent); // record1.SetFieldValue("Sum_of_Number_Invested_Note", investor.NumberOfInvested); // record1.SetFieldValue("Current_in_Funding_Amount", investor.CurrentInFunding); // record1.SetFieldValue("Sum_of_Ledge_Amount", investor.ActualAmount); // record1.SetFieldValue("Total_Amount_Received", investor.TotalAmountReceived); // record1.SetFieldValue("Total_Delinquent_Amount", investor.outstandingPI); // record1.SetFieldValue("Outstanding_L", investor.outstanding_I); // record1.SetFieldValue("Outstanding_P", investor.outstanding_P); // record1.SetFieldValue("Principal_Received", investor.PaidP); // record1.SetFieldValue("Interest_Received", investor.PaidI); // record1.CreatedTime = DateTime.UtcNow.Ticks.ToString(); // records.Add(record1); // ZCRMModule moduleIns = ZCRMModule.GetInstance("accounts"); //module api name // BulkAPIResponse<ZCRMRecord> response = moduleIns.CreateRecords(records); //records - list of ZCRMRecord instances filled with required data for upsert. // List<ZCRMRecord> insertedRecords = response.BulkData; //upsertedRecords - list of ZCRMRecord instance // foreach (var entityID in response.BulkData) // { // var newID = new tbl_CheckID // { // IDZoho = entityID.EntityId, // EmailMS = investor.UserName // }; // dbzoho.tbl_CheckID.Add(newID); // dbzoho.SaveChanges(); // } // List<EntityResponse> entityResponses = response.BulkEntitiesResponse; //entityResponses - list of EntityResponses instance // return response; //} public void UpdateIssuer(IssuerModel issuer) { var id = dbzoho.tbl_CheckID.FirstOrDefault(p => p.EmailMS == issuer.UserName); ZCRMRestClient.Initialize(config); ZohoOAuthClient client = ZohoOAuthClient.GetInstance(); string refreshToken = "1000.354c162c19b5da4fc4053bc4e38dd27f.1e548f961cc913acbacd82fbad0a3387"; string userMailId = "*****@*****.**"; ZohoOAuthTokens tokens = client.GenerateAccessTokenFromRefreshToken(refreshToken, userMailId); List <ZCRMRecord> records = new List <ZCRMRecord>(); ZCRMRecord record1 = new ZCRMRecord("accounts"); //module api name record1.EntityId = id.IDZoho; record1.SetFieldValue("id", id.IDZoho); record1.SetFieldValue("Account_Name", issuer.UserName); record1.SetFieldValue("Full_Name", issuer.FullName); record1.SetFieldValue("Username", issuer.UserName); record1.SetFieldValue("Industry", "1"); record1.SetFieldValue("Company_Name", issuer.BusinessName.ToString()); record1.SetFieldValue("Phone", issuer.MobileNumber); record1.SetFieldValue("Fax", issuer.MobileNumber); record1.SetFieldValue("Employees", 1); record1.SetFieldValue("Total_Amount_Disbursed", issuer.totaldisbursed); record1.SetFieldValue("Last_Repayment_Date", issuer.LastRepaymentDate.Value.ToString()); record1.SetFieldValue("Days_Overdue", issuer.daysoverdue); record1.SetFieldValue("Issuer_Account_Balance", issuer.ActualAmount); record1.SetFieldValue("Outstanding_Amount_with_Late_Fee", issuer.outamountwithlf); record1.SetFieldValue("Outstanding_Amount_no_Late_Fee", issuer.outamountwithoutlf); record1.SetFieldValue("Outstanding_Late_Fee", issuer.outstandinglf); record1.SetFieldValue("Total_Amount_Overdue", issuer.overdueamount); record1.SetFieldValue("Total_Principle_Paid", issuer.totalpaidprincipal); record1.SetFieldValue("Total_Interest_Paid", issuer.totalpaidinterest); record1.SetFieldValue("Total_Late_Fee_Paid", issuer.paidlatefees); record1.SetFieldValue("Total_Late_Interest_Paid", issuer.totalpaidlateinterest); record1.SetFieldValue("Total_Paid_Amount", issuer.TotalPaidAmount); records.Add(record1); ZCRMModule moduleIns = ZCRMModule.GetInstance("accounts"); //module api name BulkAPIResponse <ZCRMRecord> responseIns = moduleIns.UpdateRecords(records); //To call the Update record method Console.WriteLine("HTTP Status Code:" + responseIns.HttpStatusCode); //To get Update record http response code foreach (EntityResponse response in responseIns.BulkEntitiesResponse) { Console.WriteLine("Status:" + response.Status); //To get Update record response status Console.WriteLine("Message:" + response.Message); //To get Update record response message Console.WriteLine("Details:" + response.ResponseJSON); //To get Update record response details ZCRMRecord record11 = (ZCRMRecord)response.Data; Console.WriteLine(record11.EntityId); //To get inserted record id Console.WriteLine(record11.CreatedTime); Console.WriteLine(record11.ModifiedTime); ZCRMUser CreatedBy = record11.CreatedBy; if (CreatedBy != null) { Console.WriteLine(CreatedBy.Id); Console.WriteLine(CreatedBy.FullName); } ZCRMUser ModifiedBy = record1.ModifiedBy; if (ModifiedBy != null) { Console.WriteLine(ModifiedBy.Id); Console.WriteLine(ModifiedBy.FullName); } } }
public RootModel(IssuerModel issuer, IEnumerable <ItemModel> items) : this() { this.Issuer = issuer; this.Items.AddRange(items); }