Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Update message to incident entity in Pre stage with Pre and Post image 'img'
- * Oracle Reference - E:\oracle\product\10.2.0\db_1\ODP.NET\bin\2.x\Oracle.DataAccess.dll*/
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Microsoft.Crm.Sdk;
- using Microsoft.Crm.SdkTypeProxy;
- using Microsoft.Crm.SdkTypeProxy.Metadata;
- using System.Collections;
- using Microsoft.Crm.Sdk.Query;
- using Oracle.DataAccess.Client;
- using Oracle.DataAccess.Types;
- using System.ComponentModel;
- using System.Data;
- namespace Plugin_Case
- {
- public class plugin
- {
- public class plugin_testHandler : IPlugin
- {
- public void Execute(IPluginExecutionContext context)
- {
- //try
- //{
- DynamicEntity entity = new DynamicEntity();
- if (context.InputParameters.Properties.Contains("Target") && context.InputParameters.Properties["Target"] is DynamicEntity)
- {
- entity = (DynamicEntity)context.InputParameters["Target"];
- //Do some
- //if (!entity.Properties.Contains("new_1") && entity.Properties.Contains("new_name"))
- //{
- //Get PreEntity Image
- DynamicEntity old_entity = (DynamicEntity)context.PreEntityImages["img"];
- //incident
- string taip = "incident";
- Guid keisID = new Guid();
- string neim = "";
- Key keiskey = new Key();
- if (entity.Properties.Contains("incidentid"))
- keiskey = (Key)entity.Properties["incidentid"];
- keisID = keiskey.Value;
- //title
- if (entity.Properties.Contains("title"))
- neim = (string)entity.Properties["title"];
- if (old_entity.Properties.Contains("title"))
- neim = (string)old_entity.Properties["title"];
- Lookup case_lookup = new Lookup();
- case_lookup.type = taip;
- case_lookup.Value = keisID;
- case_lookup.name = neim;
- bool flagform = false;
- CrmBoolean flag2 = new CrmBoolean();
- if (entity.Properties.Contains("new_flag"))
- flag2 = (CrmBoolean)entity.Properties["new_flag"];
- flagform = flag2.Value;
- if (flagform == true)
- {
- try
- {
- int action = 0;
- Picklist picklist = new Picklist();
- if (entity.Properties.Contains("new_action"))
- picklist = (Picklist)entity.Properties["new_action"];
- action = picklist.Value;
- if (action == 2)
- {
- //delete
- Property attrflag2 = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag2).Name = "new_flag3";
- ((CrmBooleanProperty)attrflag2).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag2).Value.Value = true;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attrflag2);
- context.InputParameters.Properties["Target"] = entity;
- }
- else if (action == 3)
- {
- //confirm
- owner own3r = new owner();
- string mpsid = "";
- string subject = "";
- string dkn = "";
- string chasssis = "";
- if (entity.Properties.Contains("new_mpsid"))
- mpsid = (string)entity.Properties["new_mpsid"];
- if (old_entity.Properties.Contains("new_mpsid"))
- mpsid = (string)old_entity.Properties["new_mpsid"];
- if (entity.Properties.Contains("new_chassis"))
- chasssis = (string)entity.Properties["new_chassis"];
- if (old_entity.Properties.Contains("new_chassis"))
- chasssis = (string)old_entity.Properties["new_chassis"];
- if (entity.Properties.Contains("new_regnumber"))
- dkn = (string)entity.Properties["new_regnumber"];
- if (old_entity.Properties.Contains("new_regnumber"))
- dkn = (string)old_entity.Properties["new_regnumber"];
- Lookup lkp = new Lookup();
- if (entity.Properties.Contains("subjectid"))
- {
- lkp = (Lookup)old_entity.Properties["subjectid"];
- subject = lkp.name;
- }
- if (old_entity.Properties.Contains("subjectid"))
- {
- lkp = (Lookup)old_entity.Properties["subjectid"];
- subject = lkp.name;
- //subject = (string)old_entity.Properties["subjectid"];
- }
- //!!!check
- DynamicEntity praznoentity = new DynamicEntity();
- own3r = getowner(mpsid);
- Lookup obj_lkp = new Lookup();
- DynamicEntity existing_object = check_existing_object(dkn, context);
- if (existing_object.Name != null)
- {
- if (existing_object.Properties.Contains("new_subjectofinsuranceid"))
- {
- Key accountid_guid = (Key)existing_object.Properties["new_subjectofinsuranceid"];
- //accountid = accountid_guid.Value.ToString();
- obj_lkp.Value = accountid_guid.Value;
- }
- if (existing_object.Properties.Contains("new_name"))
- {
- obj_lkp.name = (string)existing_object.Properties["new_name"];
- }
- obj_lkp.type = "new_subjectofinsurance";
- }
- else
- obj_lkp = obj_of_ins(dkn, chasssis, mpsid, subject, context);
- Lookup acc_lkp = new Lookup();
- DynamicEntity existing_customer = existing_auto_owner(own3r, context);
- if (existing_customer.Name != null)
- {
- if (own3r.account == true)
- {
- //string accountid = "";
- //string accountname = "";
- acc_lkp.type = "account";
- if (existing_customer.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)existing_customer.Properties["accountid"];
- //accountid = accountid_guid.Value.ToString();
- acc_lkp.Value = accountid_guid.Value;
- }
- if (existing_customer.Properties.Contains("name"))
- {
- acc_lkp.name = (string)existing_customer.Properties["name"];
- }
- }
- else
- {
- acc_lkp.type = "contact";
- if (existing_customer.Properties.Contains("contactid"))
- {
- Key accountid_guid = (Key)existing_customer.Properties["contactid"];
- //accountid = accountid_guid.Value.ToString();
- acc_lkp.Value = accountid_guid.Value;
- }
- if (existing_customer.Properties.Contains("lastname"))
- {
- acc_lkp.name = (string)existing_customer.Properties["lastname"];
- }
- }
- }
- else
- {
- acc_lkp = customer(own3r, context);
- create_object_owner(acc_lkp, obj_lkp, own3r, context);
- }
- create_postradal(obj_lkp, case_lookup, lkp, context);
- //createobjectsSsSs
- //flag
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag2";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = true;
- entity.Properties.Add(attrflag);
- context.InputParameters["Target"] = entity;
- }
- else if (action == 1)
- {
- bool flag = false;
- string regnomer = string.Empty;
- string shasi = string.Empty;
- string pnomer = string.Empty;
- string subject = string.Empty;
- if (entity.Properties.Contains("new_regnumber"))
- regnomer = (string)entity.Properties["new_regnumber"];
- //if (old_entity.Properties.Contains("new_regnumber"))
- // regnomer = (string)old_entity.Properties["new_regnumber"];
- if (entity.Properties.Contains("new_chassis"))
- shasi = (string)entity.Properties["new_chassis"];
- // if (old_entity.Properties.Contains("new_chassis"))
- // shasi = (string)old_entity.Properties["new_chassis"];
- if (entity.Properties.Contains("new_policynumber"))
- pnomer = (string)entity.Properties["new_policynumber"];
- // if (old_entity.Properties.Contains("new_policynumber"))
- // pnomer = (string)old_entity.Properties["new_policynumber"];
- if (entity.Properties.Contains("subjectid"))
- {
- Lookup lkp = (Lookup)old_entity.Properties["subjectid"];
- subject = lkp.name;
- }
- if (old_entity.Properties.Contains("subjectid"))
- {
- Lookup lkp = (Lookup)old_entity.Properties["subjectid"];
- subject = lkp.name;
- //subject = (string)old_entity.Properties["subjectid"];
- }
- if ((subject == "ГО на МПС") || (subject == "ГО на МПС 2007"))
- {
- if (regnomer.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090004, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000202 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000202001 and
- o.F3000202002 = m.F3000090001 and
- m.F3000090003 = '";
- query += regnomer;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string nomer = "";
- string rama = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- string mpsid = "";
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090004" && tmp != null)
- {
- rama = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- }
- //}
- }
- con.Close();
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_chassis";
- ((StringProperty)attr).Value = rama;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- if (shasi.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090003, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000202 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000202001 and
- o.F3000202002 = m.F3000090001 and
- m.F3000090004 = '";
- query += shasi;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string mpsid = "";
- string nomer = "";
- string mps_no = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- //string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090003" && tmp != null)
- {
- mps_no = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- }
- //}
- }
- con.Close();
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_regnumber";
- ((StringProperty)attr).Value = mps_no;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- if (pnomer.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090004, m.F3000090003, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000202 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000202001 and
- o.F3000202002 = m.F3000090001 and
- p.BLANKA = '";
- query += pnomer;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string rama = "";
- string nomer = "";
- string mps_no = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- string mpsid = "";
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- //int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090003" && tmp != null)
- {
- mps_no = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090004" && tmp != null)
- {
- rama = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- }
- //}
- }
- con.Close();
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_regnumber";
- ((StringProperty)attr).Value = mps_no;
- Property attr8 = new StringProperty();
- ((StringProperty)attr8).Name = "new_chassis";
- ((StringProperty)attr8).Value = rama;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr8);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- }
- else if (subject == "Каско на МПС")
- {
- if (regnomer.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090004, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001, o.FA3000102013
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000102 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000102001 and
- o.F3000102002 = m.F3000090001 and
- m.F3000090003 = '";
- query += regnomer;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string nomer = "";
- string rama = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- string inssum = "";
- string mpsid = "";
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090004" && tmp != null)
- {
- rama = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "FA3000102013" && tmp != null)
- {
- inssum = tmp;
- //int asdasd2 = 0;
- }
- }
- //}
- }
- //
- con.Close();
- Property attr166 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr166).Name = "new_policyinsurancesum";
- ((CrmMoneyProperty)attr166).Value = new CrmMoney();
- ((CrmMoneyProperty)attr166).Value.Value = Convert.ToDecimal(inssum);
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_chassis";
- ((StringProperty)attr).Value = rama;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- entity.Properties.Add(attr166);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- if (shasi.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090003, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001, o.FA3000102013
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000102 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000102001 and
- o.F3000102002 = m.F3000090001 and
- m.F3000090004 = '";
- query += shasi;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string nomer = "";
- string mps_no = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- string inssum = "";
- string mpsid = "";
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- //string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090003" && tmp != null)
- {
- mps_no = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "FA3000102013" && tmp != null)
- {
- inssum = tmp;
- //int asdasd2 = 0;
- }
- }
- //}
- }
- con.Close();
- Property attr166 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr166).Name = "new_policyinsurancesum";
- ((CrmMoneyProperty)attr166).Value = new CrmMoney();
- ((CrmMoneyProperty)attr166).Value.Value = Convert.ToDecimal(inssum);
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_regnumber";
- ((StringProperty)attr).Value = mps_no;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- entity.Properties.Add(attr166);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- if (pnomer.Length > 0 && flag == false)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090004, m.F3000090003, p.NOMER, p.DATEIZDAVANE, p.BEGINDATE, p.ENDDATE, p.PREMIADUE_AMOUNT, p.ID_POLICY, m.F3000090001, o.FA3000102013
- from ORAHDI_INSPOLICY.policies p,
- ORAHDI_INSPOLICY.policy_links l,
- ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_DOCSYS.R3000102 o
- where p.ID_POLICY = l.ID_POLICY and
- l.ID_OBJECT = o.F3000102001 and
- o.F3000102002 = m.F3000090001 and
- p.BLANKA = '";
- query += pnomer;
- query += @"'
- order by p.DATEIZDAVANE desc";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- DataSet ds = new DataSet();
- adapter.Fill(ds);
- string rama = "";
- string nomer = "";
- string mps_no = "";
- string dataizd = "";
- string startdata = "";
- string enddata = "";
- string price = "";
- string policyid = "";
- int countpayed = 0;
- int countall = 0;
- decimal sum = 0;
- string inssum = "";
- string mpsid = "";
- danni danni = new danni();
- for (int ij = 0; ij < ds.Tables.Count; ij++)
- {
- //for (int i = 0; i < ds.Tables[ij].Rows.Count; i++)
- //{
- //Application.DoEvents();
- DataRow theRow = ds.Tables[ij].Rows[0];
- //label1.Text = theRow["BLANKA"].ToString();
- for (int j = 0; j < theRow.Table.Columns.Count; j++)
- {
- string tmp = theRow[j].ToString();
- if (theRow.Table.Columns[j].ToString() == "ID_POLICY" && tmp != null)
- {
- policyid = tmp;
- countall = getcount(policyid);
- int x = countall;
- danni = getsumncount(policyid);
- countpayed = (int)danni.count;
- sum = danni.sum;
- }
- if (theRow.Table.Columns[j].ToString() == "NOMER" && tmp != null)
- {
- nomer = tmp;
- // int asdasd = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090003" && tmp != null)
- {
- mps_no = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090004" && tmp != null)
- {
- rama = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "DATEIZDAVANE" && tmp != null)
- {
- dataizd = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "BEGINDATE" && tmp != null)
- {
- startdata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "ENDDATE" && tmp != null)
- {
- enddata = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "PREMIADUE_AMOUNT" && tmp != null)
- {
- price = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "FA3000102013" && tmp != null)
- {
- inssum = tmp;
- //int asdasd2 = 0;
- }
- if (theRow.Table.Columns[j].ToString() == "F3000090001" && tmp != null)
- {
- mpsid = tmp;
- // int asdasd = 0;
- }
- }
- //}
- }
- con.Close();
- Property attr166 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr166).Name = "new_policyinsurancesum";
- ((CrmMoneyProperty)attr166).Value = new CrmMoney();
- ((CrmMoneyProperty)attr166).Value.Value = Convert.ToDecimal(inssum);
- CrmNumber number = new CrmNumber(countall - countpayed);
- Property attr11 = new CrmNumberProperty();
- ((CrmNumberProperty)attr11).Name = "new_countunpayeddefers";
- ((CrmNumberProperty)attr11).Value = number;
- //new_policypayed
- Property attr66 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr66).Name = "new_policypayed";
- ((CrmMoneyProperty)attr66).Value = new CrmMoney();
- ((CrmMoneyProperty)attr66).Value.Value = sum;
- //
- Property attr667 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr667).Name = "new_policynotpayed";
- ((CrmMoneyProperty)attr667).Value = new CrmMoney();
- ((CrmMoneyProperty)attr667).Value.Value = Convert.ToDecimal(price) - sum;
- Property attr = new StringProperty();
- ((StringProperty)attr).Name = "new_regnumber";
- ((StringProperty)attr).Value = mps_no;
- Property attr8 = new StringProperty();
- ((StringProperty)attr8).Name = "new_chassis";
- ((StringProperty)attr8).Value = rama;
- Property attr2 = new StringProperty();
- ((StringProperty)attr2).Name = "new_policynumber";
- ((StringProperty)attr2).Value = nomer;
- //convert
- //try
- //{
- DateTime date_izd = DateTime.Parse(dataizd);
- DateTime date_start = DateTime.Parse(startdata);
- DateTime date_end = DateTime.Parse(enddata);
- //int x = 0;
- dataizd = "";
- startdata = "";
- enddata = "";
- dataizd += date_izd.Month.ToString() + "/" + date_izd.Day.ToString() + "/" + date_izd.Year.ToString();
- startdata += date_start.Month.ToString() + "/" + date_start.Day.ToString() + "/" + date_start.Year.ToString();
- enddata += date_end.Month.ToString() + "/" + date_end.Day.ToString() + "/" + date_end.Year.ToString();
- /*}
- catch
- {
- //
- }*/
- Property attr3 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr3).Name = "new_policyvalidfrom";
- ((CrmDateTimeProperty)attr3).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr3).Value.Value = startdata;
- Property attr4 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr4).Name = "new_policyvalidto";
- ((CrmDateTimeProperty)attr4).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr4).Value.Value = enddata;
- Property attr5 = new CrmDateTimeProperty();
- ((CrmDateTimeProperty)attr5).Name = "new_policyreleaseddate";
- ((CrmDateTimeProperty)attr5).Value = new CrmDateTime();
- ((CrmDateTimeProperty)attr5).Value.Value = dataizd;
- Property attr6 = new CrmMoneyProperty();
- ((CrmMoneyProperty)attr6).Name = "new_policyprice";
- ((CrmMoneyProperty)attr6).Value = new CrmMoney();
- ((CrmMoneyProperty)attr6).Value.Value = Convert.ToDecimal(price);
- DynamicEntity entityaccount = GetOffice(nomer, context);
- string accountid = "";
- string accountname = "";
- if (entityaccount.Properties.Contains("accountid"))
- {
- Key accountid_guid = (Key)entityaccount.Properties["accountid"];
- accountid = accountid_guid.Value.ToString();
- }
- if (entityaccount.Properties.Contains("name"))
- {
- accountname = (string)entityaccount.Properties["name"];
- }
- Guid accid = new Guid(accountid);
- Property attr7 = new LookupProperty();
- ((LookupProperty)attr7).Name = "new_releasedinofficeid";
- ((LookupProperty)attr7).Value = new Lookup();
- ((LookupProperty)attr7).Value.Value = accid;
- ((LookupProperty)attr7).Value.name = accountname;
- ((LookupProperty)attr7).Value.type = "account";
- Property attr123 = new StringProperty();
- ((StringProperty)attr123).Name = "new_mpsid";
- ((StringProperty)attr123).Value = mpsid;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attr123);
- entity.Properties.Add(attr);
- entity.Properties.Add(attr2);
- entity.Properties.Add(attr3);
- entity.Properties.Add(attr4);
- entity.Properties.Add(attr5);
- entity.Properties.Add(attr6);
- entity.Properties.Add(attr7);
- entity.Properties.Add(attr8);
- entity.Properties.Add(attr11);
- entity.Properties.Add(attr66);
- entity.Properties.Add(attr667);
- entity.Properties.Add(attr166);
- context.InputParameters["Target"] = entity;
- flag = true;
- }
- }
- }
- }
- catch
- {
- Property attrflag2 = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag2).Name = "new_flag3";
- ((CrmBooleanProperty)attrflag2).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag2).Value.Value = true;
- Property attrflag = new CrmBooleanProperty();
- ((CrmBooleanProperty)attrflag).Name = "new_flag";
- ((CrmBooleanProperty)attrflag).Value = new CrmBoolean();
- ((CrmBooleanProperty)attrflag).Value.Value = false;
- entity.Properties.Add(attrflag);
- entity.Properties.Add(attrflag2);
- context.InputParameters.Properties["Target"] = entity;
- }
- }
- }
- }
- /*
- public int getcount(string policyid)
- {
- decimal cnt = 0;
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select count(padej.id_policy)
- from orahdi_inspolicy.policy_padeji_pol padej
- where padej.id_policy = '";
- query += policyid;
- query += "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- if (reader[0] != System.DBNull.Value)
- cnt = (decimal)reader[0];
- return (int)cnt;
- }*/
- public int getcount(string policyid)
- {
- decimal cnt = 0;
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select count(padej.id_policy)
- from orahdi_inspolicy.policy_padeji_pol padej
- where padej.id_policy = '";
- query += policyid;
- query += "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- if (reader[0] != System.DBNull.Value)
- cnt = (decimal)reader[0];
- return (int)cnt;
- }
- public danni getsumncount(string policyid)
- {
- decimal cnt = 0;
- decimal sum = 0;
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select count(padej.id_policy), sum(padej.padej_paid_amn)
- from orahdi_inspolicy.policy_padeji_pol padej
- where padej.id_policy = '";
- query += policyid + "'";
- query += "and padej.padej_paid_amn is not null";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- {
- if (reader[0] != System.DBNull.Value)
- cnt = (decimal)reader[0];
- if (reader[1] != System.DBNull.Value)
- sum = (decimal)reader[1];
- }
- danni danni = new danni();
- danni.count = cnt;
- danni.sum = sum;
- return danni;
- //return (int)cnt;
- }
- public owner getowner(string mpsid)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select cu.FIRSTNAME, cu.LASTNAME, cu.EGN, cu.BULSTAT
- from ORAHDI_DOCSYS.R3000090 m,
- ORAHDI_INSPOLICY.auto_owners ao,
- ORAHDI_CUST.customs cu
- where ao.ID_MPS = m.F3000090001 and
- ao.id_cust = cu.ID and
- m.F3000090001 = '";
- query += mpsid + "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- string fname = "";
- string lname = "";
- string egnbul = "";
- bool account = false;
- using (reader)
- while (reader.Read())
- {
- if (reader[0] != System.DBNull.Value)
- fname = (string)reader[0];
- if (reader[1] != System.DBNull.Value)
- lname = (string)reader[1];
- if (reader[2] != System.DBNull.Value)
- egnbul = (string)reader[2];
- if (reader[3] != System.DBNull.Value)
- {
- egnbul = (string)reader[3];
- account = true;
- }
- }
- owner own = new owner();
- if (fname.Length > 0)
- own.fname = fname;
- if (lname.Length > 0)
- own.lname = lname;
- if (egnbul.Length > 0)
- own.egnbul = egnbul;
- own.account = account;
- return own;
- }
- public class kartoteka_mps
- {
- public string vid_mps_id = "";
- public string vid_mps_name = "";
- public Lookup vid_mps_lkp = new Lookup();
- public string marka_id = "";
- public string marka_name = "";
- public Lookup marka_lkp = new Lookup();
- public string model_id = "";
- public string model_name = "";
- public Lookup model_lkp = new Lookup();
- public string modification = "";
- public string vrati = "";
- public CrmNumber godina_proizv = new CrmNumber(0);
- public string class_mps_id = "";
- public string class_pls_name = "";
- public Lookup class_mps_lkp = new Lookup();
- public CrmNumber obem_dvg = new CrmNumber(0);
- public Picklist vid_gorivo = new Picklist(6);
- public Picklist proizvodstvo = new Picklist(2);
- public string shasi = "";
- public string cvqt_id = "";
- public string cvqt_name = "";
- public Lookup cvqt_lkp = new Lookup();
- public string boq_id = "";
- public string boq_name = "";
- public Lookup boq_lkp = new Lookup();
- public Picklist prednaznachenie = new Picklist(6);
- };
- public class owner
- {
- public string fname;
- public string lname;
- public string egnbul;
- public bool account;
- };
- public class danni
- {
- public decimal count;
- public decimal sum;
- };
- public class acc_cont
- {
- public Guid entityID;
- public string name;
- };
- private Lookup customer(owner own3r, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- //check EGN/BULSTAT
- DynamicEntity customer = new DynamicEntity();
- Property accountname = new StringProperty();
- ((StringProperty)accountname).Name = "name";
- ((StringProperty)accountname).Value = own3r.fname + " " + own3r.lname;
- Property contactname = new StringProperty();
- ((StringProperty)contactname).Name = "lastname";
- ((StringProperty)contactname).Value = own3r.fname + " " + own3r.lname;
- Property engbul = new StringProperty();
- ((StringProperty)engbul).Name = "new_egn_bulstat";
- ((StringProperty)engbul).Value = own3r.egnbul;
- Property egn = new StringProperty();
- ((StringProperty)egn).Name = "new_egn";
- ((StringProperty)egn).Value = own3r.egnbul;
- Property acctype = new PicklistProperty();
- ((PicklistProperty)acctype).Name = "new_accounttype";
- ((PicklistProperty)acctype).Value = new Picklist();
- ((PicklistProperty)acctype).Value.Value = 3;
- if (own3r.account == true)
- {
- customer.Name = EntityName.account.ToString();
- customer.Properties = new Microsoft.Crm.Sdk.PropertyCollection();
- customer.Properties.Add(accountname);
- customer.Properties.Add(engbul);
- customer.Properties.Add(acctype);
- }
- else
- {
- customer.Name = EntityName.contact.ToString();
- customer.Properties = new Microsoft.Crm.Sdk.PropertyCollection();
- customer.Properties.Add(contactname);
- customer.Properties.Add(egn);
- }
- Lookup lookup = new Lookup();
- TargetCreateDynamic target = new TargetCreateDynamic();
- target.Entity = customer;
- CreateRequest request = new CreateRequest();
- request.Target = target;
- CreateResponse response = (CreateResponse)service.Execute(request);
- Guid lookupid = new Guid();
- lookupid = response.id;
- string taip = "";
- if (own3r.account == true)
- {
- taip = "account";
- }
- else
- {
- taip = "contact";
- }
- lookup.name = own3r.fname + " " + own3r.lname;
- lookup.type = taip;
- lookup.Value = lookupid;
- return lookup;
- }
- private void create_postradal(Lookup obekt, Lookup case_lkp, Lookup subject, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- /*
- * new_claim_vehicle
- _________________
- new_claim_subjectid //lookup - subj
- new_claimvehicleid //lookup - case
- new_guilt //picklist value = 1/3 kasko/go
- new_name //string dkn
- * new_objectid
- Property namee = new StringProperty();
- ((StringProperty)namee).Name = "new_name";
- ((StringProperty)namee).Value = acc_cont.name;
- */
- DynamicEntity postradal = new DynamicEntity();
- postradal.Name = "new_claim_vehicle";
- postradal.Properties = new Microsoft.Crm.Sdk.PropertyCollection();
- Property namee = new StringProperty();
- ((StringProperty)namee).Name = "new_name";
- ((StringProperty)namee).Value = obekt.name;
- Property obekta = new LookupProperty();
- ((LookupProperty)obekta).Name = "new_objectid";
- ((LookupProperty)obekta).Value = obekt;
- Property subj_lkp = new LookupProperty();
- ((LookupProperty)subj_lkp).Name = "new_claim_subjectid";
- ((LookupProperty)subj_lkp).Value = subject;
- Property keis = new LookupProperty();
- ((LookupProperty)keis).Name = "new_claimvehicleid";
- ((LookupProperty)keis).Value = case_lkp;
- Property new_guilt = new PicklistProperty();
- ((PicklistProperty)new_guilt).Name = "new_guilt";
- ((PicklistProperty)new_guilt).Value = new Picklist();
- string sname = subject.name;
- if (sname == "Каско на МПС")
- {
- ((PicklistProperty)new_guilt).Value.Value = 1;
- }
- else if ((sname == "ГО на МПС") || (sname == "ГО на МПС 2007"))
- {
- ((PicklistProperty)new_guilt).Value.Value = 3;
- }
- postradal.Properties.Add(namee);
- postradal.Properties.Add(keis);
- postradal.Properties.Add(obekta);
- postradal.Properties.Add(new_guilt);
- postradal.Properties.Add(subj_lkp);
- TargetCreateDynamic target = new TargetCreateDynamic();
- target.Entity = postradal;
- CreateRequest request = new CreateRequest();
- request.Target = target;
- CreateResponse response = (CreateResponse)service.Execute(request);
- }
- private void create_object_owner(Lookup acc_cont, Lookup obekt, owner ownr, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- /*
- new_name //string
- new_owneraccountid / new_ownercontactid //lookup
- new_ownership //decimal - 100
- new_objectid //lookup
- */
- Property namee = new StringProperty();
- ((StringProperty)namee).Name = "new_name";
- ((StringProperty)namee).Value = acc_cont.name;
- Property ouner_a_c = new LookupProperty();
- if (ownr.account)
- {
- ((LookupProperty)ouner_a_c).Name = "new_owneraccountid";
- ((LookupProperty)ouner_a_c).Value = new Lookup();
- ((LookupProperty)ouner_a_c).Value.Value = acc_cont.Value;
- ((LookupProperty)ouner_a_c).Value.name = acc_cont.name;
- ((LookupProperty)ouner_a_c).Value.type = "account";
- }
- else
- {
- ((LookupProperty)ouner_a_c).Name = "new_ownercontactid";
- ((LookupProperty)ouner_a_c).Value = new Lookup();
- ((LookupProperty)ouner_a_c).Value.Value = acc_cont.Value;
- ((LookupProperty)ouner_a_c).Value.name = acc_cont.name;
- ((LookupProperty)ouner_a_c).Value.type = "contact";
- }
- Property obekta = new LookupProperty();
- ((LookupProperty)obekta).Name = "new_objectid";
- ((LookupProperty)obekta).Value = new Lookup();
- ((LookupProperty)obekta).Value.Value = obekt.Value;
- ((LookupProperty)obekta).Value.name = obekt.name;
- ((LookupProperty)obekta).Value.type = obekt.type;
- CrmDecimal number = new CrmDecimal(100);
- Property ownership = new CrmDecimalProperty();
- ((CrmDecimalProperty)ownership).Name = "new_ownership";
- ((CrmDecimalProperty)ownership).Value = number;
- DynamicEntity ouner = new DynamicEntity();
- ouner.Name = "new_new_owner";
- ouner.Properties = new Microsoft.Crm.Sdk.PropertyCollection();
- ouner.Properties.Add(namee);
- ouner.Properties.Add(ouner_a_c);
- ouner.Properties.Add(obekta);
- ouner.Properties.Add(ownership);
- TargetCreateDynamic target = new TargetCreateDynamic();
- target.Entity = ouner;
- CreateRequest request = new CreateRequest();
- request.Target = target;
- CreateResponse response = (CreateResponse)service.Execute(request);
- }
- public class mps_marka_model
- {
- public string marka_id = "";
- public string marka_name = "";
- public string model_id = "";
- public string model_name = "";
- public Lookup marka_lkp = new Lookup();
- public Lookup model_lkp = new Lookup();
- public void check_marka(string markaname, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_name";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { markaname };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = "new_mfg";
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = new DynamicEntity();
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- {
- entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- if(entity.Properties.Contains("new_mfgid"))
- {
- Key new_mfgid = (Key)entity.Properties["new_mfgid"];
- this.marka_lkp.Value = new_mfgid.Value;
- }
- this.marka_lkp.type = "new_mfg";
- this.marka_lkp.name = markaname;
- }
- }
- public void check_model(string modelname, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_name";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { modelname };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = "new_model";
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = new DynamicEntity();
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- {
- entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- if (entity.Properties.Contains("new_modelid"))
- {
- Key new_mfgid = (Key)entity.Properties["new_modelid"];
- this.model_lkp.Value = new_mfgid.Value;
- }
- this.model_lkp.type = "new_model";
- this.model_lkp.name = modelname;
- }
- }
- public void get_marka_name(string markaID)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select ma.name_brand
- from orahdi_inspolicy.mpsmarka ma
- where ma.id_nom like '";
- query += markaID + "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- {
- if (reader[0] != System.DBNull.Value)
- this.marka_name = (string)reader[0];
- }
- }
- public void get_model_name(string modelID)
- {
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select mo.name_model
- from orahdi_inspolicy.mpsmodel mo
- where mo.id_nom like '";
- query += modelID + "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- {
- if (reader[0] != System.DBNull.Value)
- this.model_name = (string)reader[0];
- }
- }
- };
- private kartoteka_mps getkartoteka(string mpsid)
- {
- kartoteka_mps kartoteka = new kartoteka_mps();
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select m.F3000090007, m.F3000090008, m.F3000090009, m.F3000090010, m.F3000090024, m.F3000090020, m.F3000090032, m.F3000090021, m.F3000090011, m.F3000090018, m.F3000090016, m.F3000090017, m.F3000090019
- from ORAHDI_DOCSYS.R3000090 m
- where m.F3000090001 = '";
- query += mpsid + "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- {
- if (reader[0] != System.DBNull.Value)
- kartoteka.vid_mps_id = (string)reader[0];
- if (reader[1] != System.DBNull.Value)
- kartoteka.marka_id = (string)reader[1];
- if (reader[2] != System.DBNull.Value)
- kartoteka.model_id = (string)reader[2];
- if (reader[3] != System.DBNull.Value)
- kartoteka.modification = (string)reader[3];
- if (reader[4] != System.DBNull.Value)
- kartoteka.vrati = ((decimal)reader[4]).ToString();
- if (reader[5] != System.DBNull.Value)
- kartoteka.godina_proizv = new CrmNumber(Convert.ToInt32((decimal)reader[5]));
- if (reader[6] != System.DBNull.Value)
- kartoteka.class_mps_id = (string)reader[6];
- if (reader[7] != System.DBNull.Value)
- kartoteka.obem_dvg = new CrmNumber(Convert.ToInt32((decimal)reader[7]));
- if (reader[8] != System.DBNull.Value)
- kartoteka.vid_gorivo = new Picklist(Convert.ToInt32((string)reader[8]));
- if (reader[9] != System.DBNull.Value)
- kartoteka.proizvodstvo = new Picklist(Convert.ToInt32((string)reader[9]));
- if (reader[10] != System.DBNull.Value)
- kartoteka.cvqt_id = (string)reader[10];
- if (reader[11] != System.DBNull.Value)
- kartoteka.boq_id = (string)reader[11];
- if (reader[12] != System.DBNull.Value)
- {
- int taip = 0;
- int picklistvalue = 6;
- string id_ot_oracle = (string)reader[12];
- taip = Convert.ToInt32(id_ot_oracle);
- switch (taip)
- {
- case 1:
- picklistvalue = 1;
- break;
- case 2:
- picklistvalue = 4;
- break;
- case 3:
- picklistvalue = 3;
- break;
- case 8:
- picklistvalue = 2;
- break;
- default:
- picklistvalue = 6;
- break;
- }
- kartoteka.prednaznachenie = new Picklist(picklistvalue);
- }
- }
- return kartoteka;
- }
- public string get_nom_name(string nom_id, string nom_type)
- {
- //nomenklatura nomenkl = new nomenklatura();
- //nomenkl.id = nom_id;
- //nomenkl.type = nom_type;
- //ORACLE
- string conection = "Data Source=hditst; User Id=****; Password=****;";
- //string query = "select name from user$ where name is not null";
- string query = @"select nom.NOM_NAME from ORAHDI_RA.NOM_DATA nom
- where nom.NOM_ID = '";
- query += nom_id +"'";
- query += "and nom.NOM_TYPE = '" + nom_type + "'";
- OracleConnection con = new OracleConnection(conection);
- con.Open();
- //try
- //{
- OracleCommand command = new OracleCommand(query);
- command.Connection = con;
- command.CommandType = CommandType.Text;
- OracleDataReader reader = command.ExecuteReader();
- //OracleDataReader reader = command.ExecuteReader();
- OracleDataAdapter adapter = new OracleDataAdapter(query, con);
- adapter.SelectCommand = command;
- string name = "";
- //DataSet ds = new DataSet();
- //adapter.Fill(ds);
- using (reader)
- while (reader.Read())
- if (reader[0] != System.DBNull.Value)
- name = (string)reader[0];
- return name;
- }
- public Lookup get_crm_lkp(string nom_name,string entity_name, IPluginExecutionContext context)
- {
- Lookup lkp = new Lookup();
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_name";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { nom_name };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = entity_name;
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = new DynamicEntity();
- string keyid = entity_name + "id";
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- {
- entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- if (entity.Properties.Contains(keyid))
- {
- Key accountid_guid = (Key)entity.Properties[keyid];
- //accountid = accountid_guid.Value.ToString();
- lkp.Value = accountid_guid.Value;
- }
- if (entity.Properties.Contains("new_name"))
- {
- lkp.name = (string)entity.Properties["new_name"];
- }
- lkp.type = entity_name;
- }
- return lkp;
- }
- public class nomenklatura
- {
- public string type = "";
- public string id = "";
- public string name = "";
- };
- public Lookup mepese_class(string classID, IPluginExecutionContext context)
- {
- Lookup lkp = new Lookup();
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- string nom_name = "";
- int x = 0;
- x = Convert.ToInt32(classID);
- switch (x)
- {
- case 1:
- nom_name = "A";
- break;
- case 2:
- nom_name = "B";
- break;
- case 3:
- nom_name = "C";
- break;
- case 4:
- nom_name = "Джип";
- break;
- default:
- return lkp;
- }
- string entity_name = "new_vehicleclass";
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_name";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { nom_name };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = entity_name;
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = new DynamicEntity();
- string keyid = entity_name + "id";
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- {
- entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- if (entity.Properties.Contains(keyid))
- {
- Key accountid_guid = (Key)entity.Properties[keyid];
- //accountid = accountid_guid.Value.ToString();
- lkp.Value = accountid_guid.Value;
- }
- if (entity.Properties.Contains("new_name"))
- {
- lkp.name = (string)entity.Properties["new_name"];
- }
- lkp.type = entity_name;
- }
- return lkp;
- }
- private Lookup obj_of_ins(string dkn, string chassis, string mpsid, string subject, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- //CHECK DKN
- //static danni ot crmForm:
- /*
- new_type //picklist value=1
- new_name //string dkn
- new_licenceplate //string
- new_chassis //string
- */
- DynamicEntity obj = new DynamicEntity();
- obj.Name = "new_subjectofinsurance";
- obj.Properties = new Microsoft.Crm.Sdk.PropertyCollection();
- kartoteka_mps kartoteka = getkartoteka(mpsid);
- //string abv = "abv";
- if (kartoteka.vid_mps_id.Length > 0)
- {
- Property attr = new LookupProperty();
- Lookup lkp = new Lookup();
- string nom_name = get_nom_name(kartoteka.vid_mps_id, "InsPolicyAutoType");
- lkp = get_crm_lkp(nom_name, "new_vehicletype", context);
- if(lkp.name != null)
- {
- ((LookupProperty)attr).Name = "new_vehicletypeid";
- ((LookupProperty)attr).Value = lkp;
- obj.Properties.Add(attr);
- }
- }
- mps_marka_model marka_i_model = new mps_marka_model();
- if (kartoteka.marka_id.Length > 0)
- {
- marka_i_model.marka_id = kartoteka.marka_id;
- marka_i_model.get_marka_name(kartoteka.marka_id);
- if (marka_i_model.marka_name.Length > 0)
- {
- marka_i_model.check_marka(marka_i_model.marka_name, context);
- Lookup marka_lkp = new Lookup();
- if (marka_i_model.marka_lkp.name != null)
- {
- marka_lkp = marka_i_model.marka_lkp;
- Property marka_lkp_property = new LookupProperty();
- ((LookupProperty)marka_lkp_property).Name = "new_manufacturerid";
- ((LookupProperty)marka_lkp_property).Value = marka_lkp;
- obj.Properties.Add(marka_lkp_property);
- }
- }
- }
- if (kartoteka.model_id.Length > 0)
- {
- marka_i_model.model_id = kartoteka.model_id;
- marka_i_model.get_model_name(kartoteka.model_id);
- if (marka_i_model.model_name.Length > 0)
- {
- marka_i_model.check_model(marka_i_model.model_name, context);
- Lookup model_lkp = new Lookup();
- if (marka_i_model.model_lkp.name != null)
- {
- model_lkp = marka_i_model.model_lkp;
- Property model_lkp_property = new LookupProperty();
- ((LookupProperty)model_lkp_property).Name = "new_modelid";
- ((LookupProperty)model_lkp_property).Value = model_lkp;
- obj.Properties.Add(model_lkp_property);
- }
- }
- }
- if (kartoteka.cvqt_id.Length > 0)
- {
- Property attr1 = new LookupProperty();
- Lookup lkp = new Lookup();
- string nom_name = get_nom_name(kartoteka.vid_mps_id, "InsPolicyAutoColor");
- lkp = get_crm_lkp(nom_name, "new_color", context);
- if (lkp.name != null)
- {
- ((LookupProperty)attr1).Name = "new_colorid";
- ((LookupProperty)attr1).Value = lkp;
- obj.Properties.Add(attr1);
- }
- }
- if (kartoteka.boq_id.Length > 0)
- {
- Property attr2 = new LookupProperty();
- Lookup lkp = new Lookup();
- string nom_name = get_nom_name(kartoteka.vid_mps_id, "InsPolicyAutoPaint");
- lkp = get_crm_lkp(nom_name, "new_painttype", context);
- if (lkp.name != null)
- {
- ((LookupProperty)attr2).Name = "new_painttypeid";
- ((LookupProperty)attr2).Value = lkp;
- obj.Properties.Add(attr2);
- }
- }
- Property attr3 = new CrmNumberProperty();
- ((CrmNumberProperty)attr3).Name = "new_yearofmanufacture";
- ((CrmNumberProperty)attr3).Value = kartoteka.godina_proizv;
- Property attr4 = new CrmNumberProperty();
- ((CrmNumberProperty)attr4).Name = "new_volume";
- ((CrmNumberProperty)attr4).Value = kartoteka.obem_dvg;
- Property attr5 = new PicklistProperty();
- ((PicklistProperty)attr5).Name = "new_fuel";
- ((PicklistProperty)attr5).Value = kartoteka.vid_gorivo;
- Property attr6 = new PicklistProperty();
- ((PicklistProperty)attr6).Name = "new_manufacture";
- ((PicklistProperty)attr6).Value = kartoteka.proizvodstvo;
- Property new_usedfor = new PicklistProperty();
- ((PicklistProperty)new_usedfor).Name = "new_usedfor";
- ((PicklistProperty)new_usedfor).Value = kartoteka.prednaznachenie;
- if (kartoteka.class_mps_id.Length > 0)
- {
- Property class_lkp = new LookupProperty();
- Lookup lkp = new Lookup();
- //string nom_name = "InsPolicyAutoClass";
- lkp = mepese_class(kartoteka.class_mps_id, context);
- if (lkp.name != null)
- {
- ((LookupProperty)class_lkp).Name = "new_vehicleclassid";
- ((LookupProperty)class_lkp).Value = lkp;
- obj.Properties.Add(class_lkp);
- }
- }
- obj.Properties.Add(attr3);
- obj.Properties.Add(attr4);
- obj.Properties.Add(attr5);
- obj.Properties.Add(attr6);
- obj.Properties.Add(new_usedfor);
- Property namee = new StringProperty();
- ((StringProperty)namee).Name = "new_name";
- ((StringProperty)namee).Value = dkn;
- Property lp = new StringProperty();
- ((StringProperty)lp).Name = "new_licenceplate";
- ((StringProperty)lp).Value = dkn;
- Property chasis = new StringProperty();
- ((StringProperty)chasis).Name = "new_chassis";
- ((StringProperty)chasis).Value = chassis;
- Property objtype = new PicklistProperty();
- ((PicklistProperty)objtype).Name = "new_type";
- ((PicklistProperty)objtype).Value = new Picklist();
- ((PicklistProperty)objtype).Value.Value = 1;
- obj.Properties.Add(namee);
- obj.Properties.Add(lp);
- obj.Properties.Add(chasis);
- obj.Properties.Add(objtype);
- Lookup lookup = new Lookup();
- TargetCreateDynamic target = new TargetCreateDynamic();
- target.Entity = obj;
- CreateRequest request = new CreateRequest();
- request.Target = target;
- //string xx = "xx";
- CreateResponse response = (CreateResponse)service.Execute(request);
- Guid lookupid = new Guid();
- lookupid = response.id;
- string taip = "new_subjectofinsurance";
- //danni MPS ot ORACLE s mpsid
- lookup.name = dkn;
- lookup.type = taip;
- lookup.Value = lookupid;
- return lookup;
- }
- private DynamicEntity GetOffice(string nomernapolica, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- string kodofis = nomernapolica.Substring(6, 4);
- string x = kodofis;
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_officeid";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { kodofis };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = "account";
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- return entity;
- }
- private DynamicEntity existing_auto_owner(owner ownr, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- ConditionExpression con_acc = new ConditionExpression();
- con_acc.AttributeName = "new_egn_bulstat";
- con_acc.Operator = ConditionOperator.Like;
- con_acc.Values = new string[] { ownr.egnbul };
- ConditionExpression con_con = new ConditionExpression();
- con_con.AttributeName = "new_egn";
- con_con.Operator = ConditionOperator.Like;
- con_con.Values = new string[] { ownr.egnbul };
- FilterExpression filter_acc = new FilterExpression();
- filter_acc.FilterOperator = LogicalOperator.And;
- filter_acc.AddCondition(con_acc);
- FilterExpression filter_con = new FilterExpression();
- filter_con.FilterOperator = LogicalOperator.And;
- filter_con.AddCondition(con_con);
- QueryExpression query_acc = new QueryExpression();
- query_acc.EntityName = "account";
- query_acc.ColumnSet = new AllColumns();
- query_acc.Criteria = filter_acc;
- QueryExpression query_con = new QueryExpression();
- query_con.EntityName = "contact";
- query_con.ColumnSet = new AllColumns();
- query_con.Criteria = filter_con;
- RetrieveMultipleRequest retrieveM_C = new RetrieveMultipleRequest();
- retrieveM_C.Query = query_con;
- retrieveM_C.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved_c = (RetrieveMultipleResponse)service.Execute(retrieveM_C);
- RetrieveMultipleRequest retrieveM = new RetrieveMultipleRequest();
- retrieveM.Query = query_con;
- retrieveM.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieveM);
- DynamicEntity entity = new DynamicEntity();
- if (retrieved_c.BusinessEntityCollection.BusinessEntities.Count > 0)
- return (DynamicEntity)retrieved_c.BusinessEntityCollection.BusinessEntities[0];
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- entity = (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- return entity;
- }
- private DynamicEntity check_existing_object(string dkn, IPluginExecutionContext context)
- {
- ICrmService service = (ICrmService)context.CreateCrmService(true);
- ConditionExpression con = new ConditionExpression();
- con.AttributeName = "new_licenceplate";
- con.Operator = ConditionOperator.Like;
- con.Values = new string[] { dkn };
- FilterExpression filter = new FilterExpression();
- filter.FilterOperator = LogicalOperator.And;
- filter.AddCondition(con);
- QueryExpression query = new QueryExpression();
- query.EntityName = "new_subjectofinsurance";
- query.ColumnSet = new AllColumns();
- query.Criteria = filter;
- RetrieveMultipleRequest retrieve = new RetrieveMultipleRequest();
- retrieve.Query = query;
- retrieve.ReturnDynamicEntities = true;
- RetrieveMultipleResponse retrieved = (RetrieveMultipleResponse)service.Execute(retrieve);
- DynamicEntity entity = new DynamicEntity();
- if (retrieved.BusinessEntityCollection.BusinessEntities.Count > 0)
- return (DynamicEntity)retrieved.BusinessEntityCollection.BusinessEntities[0];
- return entity;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement