/// <summary>
 /// Function to Update values in ServiceDetails Table
 /// </summary>
 /// <param name="servicedetailsinfo"></param>
 public void ServiceDetailsEdit(ServiceDetailsInfo servicedetailsinfo)
 {
     try
     {
         spServiceDetails.ServiceDetailsEdit(servicedetailsinfo);
     }
     catch (Exception ex)
     {
         MessageBox.Show("AL34:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
        /// <summary>
        /// Function to insert values to ServiceDetails Table and return corresponding row's id
        /// </summary>
        /// <param name="servicedetailsinfo"></param>
        /// <returns></returns>
        public decimal ServiceDetailsAddReturnWithIdentity(ServiceDetailsInfo servicedetailsinfo)
        {
            decimal decIdentity = 0;

            try
            {
                decIdentity = spServiceDetails.ServiceDetailsAddReturnWithIdentity(servicedetailsinfo);
            }
            catch (Exception ex)
            {
                MessageBox.Show("AL33:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            return(decIdentity);
        }
Exemple #3
0
        /// <summary>
        /// Function to get particular values from ServiceDetails Table based on the parameter
        /// </summary>
        /// <param name="serviceDetailsId"></param>
        /// <returns></returns>
        public ServiceDetailsInfo ServiceDetailsView(decimal serviceDetailsId)
        {
            ServiceDetailsInfo servicedetailsinfo = new ServiceDetailsInfo();
            SqlDataReader      sdrreader          = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ServiceDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@serviceDetailsId", SqlDbType.Decimal);
                sprmparam.Value = serviceDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    servicedetailsinfo.ServiceDetailsId = decimal.Parse(sdrreader[0].ToString());
                    servicedetailsinfo.ServiceMasterId  = decimal.Parse(sdrreader[1].ToString());
                    servicedetailsinfo.ServiceId        = decimal.Parse(sdrreader[2].ToString());
                    servicedetailsinfo.Measure          = sdrreader[3].ToString();
                    servicedetailsinfo.Amount           = decimal.Parse(sdrreader[4].ToString());
                    servicedetailsinfo.ExtraDate        = DateTime.Parse(sdrreader[5].ToString());
                    servicedetailsinfo.Extra1           = sdrreader[6].ToString();
                    servicedetailsinfo.Extra2           = sdrreader[7].ToString();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(servicedetailsinfo);
        }
Exemple #4
0
        /// <summary>
        /// Function to insert values to ServiceDetails Table and return corresponding row's id
        /// </summary>
        /// <param name="servicedetailsinfo"></param>
        /// <returns></returns>
        public decimal ServiceDetailsAddReturnWithIdentity(ServiceDetailsInfo servicedetailsinfo)
        {
            decimal decIdentity = 0;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("ServiceDetailsAddReturnWithIdentity", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@serviceMasterId", SqlDbType.Decimal);
                sprmparam.Value = servicedetailsinfo.ServiceMasterId;
                sprmparam       = sccmd.Parameters.Add("@serviceId", SqlDbType.Decimal);
                sprmparam.Value = servicedetailsinfo.ServiceId;
                sprmparam       = sccmd.Parameters.Add("@measure", SqlDbType.VarChar);
                sprmparam.Value = servicedetailsinfo.Measure;
                sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
                sprmparam.Value = servicedetailsinfo.Amount;
                sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
                sprmparam.Value = servicedetailsinfo.ExtraDate;
                sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
                sprmparam.Value = servicedetailsinfo.Extra1;
                sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
                sprmparam.Value = servicedetailsinfo.Extra2;
                decIdentity     = Convert.ToDecimal(sccmd.ExecuteScalar().ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sqlcon.Close();
            }
            return(decIdentity);
        }
Exemple #5
0
 /// <summary>
 /// Function to insert values to ServiceDetails Table
 /// </summary>
 /// <param name="servicedetailsinfo"></param>
 public void ServiceDetailsAdd(ServiceDetailsInfo servicedetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("ServiceDetailsAdd", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@serviceDetailsId", SqlDbType.Decimal);
         sprmparam.Value = servicedetailsinfo.ServiceDetailsId;
         sprmparam       = sccmd.Parameters.Add("@serviceMasterId", SqlDbType.Decimal);
         sprmparam.Value = servicedetailsinfo.ServiceMasterId;
         sprmparam       = sccmd.Parameters.Add("@serviceId", SqlDbType.Decimal);
         sprmparam.Value = servicedetailsinfo.ServiceId;
         sprmparam       = sccmd.Parameters.Add("@measure", SqlDbType.VarChar);
         sprmparam.Value = servicedetailsinfo.Measure;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = servicedetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@extraDate", SqlDbType.DateTime);
         sprmparam.Value = servicedetailsinfo.ExtraDate;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = servicedetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = servicedetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
 /// <summary>
 /// Function to edit the service voucher
 /// </summary>
 /// <param name="decServiceMasterId"></param>
 public void EditFunction(decimal decServiceMasterId)
 {
     try
     {
         ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo();
         ServiceDetailsInfo infoServiceDetails = new ServiceDetailsInfo();
         ServicesBll BllService = new ServicesBll();
         LedgerPostingBll BllLedgerPosting = new LedgerPostingBll();
         LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         int inRowCount = dgvServiceVoucher.RowCount;
         int inValue = 0;
         decimal decLedgerPostingId1 = 0;
         decimal decLedgerPostingId2 = 0;
         List<DataTable> listObjLedgerPostingId = new List<DataTable>();
         listObjLedgerPostingId = BllService.LedgerPostingIdByServiceMaasterId(decServiceMasterId);
         decLedgerPostingId1 = Convert.ToDecimal(listObjLedgerPostingId[0].Rows[0]["ledgerPostingId"].ToString());
         decLedgerPostingId2 = Convert.ToDecimal(listObjLedgerPostingId[0].Rows[1]["ledgerPostingId"].ToString());
         for (int ini = 0; ini < inRowCount - 1; ini++)
         {
             if (dgvServiceVoucher.Rows[ini].Cells["dgvcmbParticulars"].Value != null && dgvServiceVoucher.Rows[ini].Cells["dgvcmbParticulars"].Value.ToString() != string.Empty)
             {
                 inValue++;
             }
         }
         if (inValue > 0)
         {
             infoServiceMaster.ServiceMasterId = decServiceMasterId;
             infoServiceMaster.SuffixPrefixId = decServiceSuffixPrefixId;
             infoServiceMaster.Date = Convert.ToDateTime(txtVoucherDate.Text);
             infoServiceMaster.LedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
             infoServiceMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
             infoServiceMaster.Narration = txtNarration.Text.Trim();
             infoServiceMaster.UserId = PublicVariables._decCurrentUserId;
             infoServiceMaster.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text);
             infoServiceMaster.ServiceAccount = Convert.ToDecimal(cmbServiceAC.SelectedValue.ToString());
             decimal decExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());//spExchangeRate.GetExchangeRateByCurrencyId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()));
             infoServiceMaster.ExchangeRateId = decExchangeRateId;
             infoServiceMaster.EmployeeId = Convert.ToDecimal(cmbSalesman.SelectedValue.ToString());
             infoServiceMaster.Customer = txtCustomer.Text.Trim();
             infoServiceMaster.Discount = Convert.ToDecimal(txtDiscount.Text);
             infoServiceMaster.GrandTotal = Convert.ToDecimal(txtGrandTotal.Text);
             infoServiceMaster.VoucherTypeId = DecServicetVoucherTypeId;
             infoServiceMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
             infoServiceMaster.ExtraDate = PublicVariables._dtCurrentDate;
             infoServiceMaster.Extra1 = string.Empty;
             infoServiceMaster.Extra2 = string.Empty;
             //------------------deleting removed rows----------------------------------------//
             BankReconciliationBll BllBankReconciliation = new BankReconciliationBll();
             foreach (object obj in strArrOfRemove)
             {
                 string str = Convert.ToString(obj);
                 BllService.ServiceDetailsDelete(Convert.ToDecimal(str));
             }
             BllService.ServiceMasterEdit(infoServiceMaster);
             infoServiceDetails.ServiceMasterId = decServiceMasterId;
             infoServiceDetails.Extra1 = string.Empty;
             infoServiceDetails.Extra2 = string.Empty;
             infoServiceDetails.ExtraDate = PublicVariables._dtCurrentDate;
             for (int i = 0; i < inRowCount - 1; i++)
             {
                 if (dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.ServiceId = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value.ToString());
                 }
                 if (dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.Measure = dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value.ToString();
                 }
                 if (dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.Amount = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString());
                     if (dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value.ToString() != string.Empty)
                     {
                         infoServiceDetails.ServiceDetailsId = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvtxtDetailsId"].Value.ToString());
                         infoServiceDetails.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
                         BllService.ServiceDetailsEdit(infoServiceDetails);
                     }
                     else
                     {
                         infoServiceDetails.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
                         decServiceDetailsId = BllService.ServiceDetailsAddReturnWithIdentity(infoServiceDetails);
                     }
                     decSelectedCurrencyRate = BllExchangeRate.GetExchangeRateByExchangeRateId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()));
                     decAmount = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value);
                     decConvertRate += decAmount * decSelectedCurrencyRate;
                 }
             }
             decCredit = 0;
             decDebit = decConvertRate;
             decLedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
             LedgerPostingEdit(decLedgerPostingId1, decLedgerId, decCredit, decDebit);
             decCredit = decConvertRate;
             decDebit = 0;
             decLedgerId = Convert.ToDecimal(cmbServiceAC.SelectedValue.ToString());
             LedgerPostingEdit(decLedgerPostingId2, decLedgerId, decCredit, decDebit);
             AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
             decimal decI = Convert.ToDecimal(bllAccountLedger.AccountGroupIdCheck(cmbCashParty.Text));
             if (decI > 0)
             {
                 PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo();
                 PartyBalanceBll BllPartyBalance = new PartyBalanceBll();
                 infoPartyBalance.PartyBalanceId = decPartyBalanceId;
                 infoPartyBalance.Date = Convert.ToDateTime(txtVoucherDate.Text);
                 infoPartyBalance.LedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
                 infoPartyBalance.VoucherTypeId = DecServicetVoucherTypeId;
                 infoPartyBalance.VoucherNo = strVoucherNo;
                 infoPartyBalance.AgainstVoucherTypeId = 0;
                 infoPartyBalance.AgainstVoucherNo = "0";
                 infoPartyBalance.InvoiceNo = strInvoiceNo;
                 infoPartyBalance.AgainstInvoiceNo = "0";
                 infoPartyBalance.ReferenceType = "New";
                 infoPartyBalance.Debit = decAmount;
                 infoPartyBalance.Credit = 0;
                 infoPartyBalance.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text);
                 infoPartyBalance.ExchangeRateId = decExchangeRateId;
                 infoPartyBalance.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                 infoPartyBalance.Extra1 = string.Empty;
                 infoPartyBalance.Extra2 = string.Empty;
                 BllPartyBalance.PartyBalanceEdit(infoPartyBalance);
             }
             Messages.UpdatedMessage();
             if (cbxPrintAfterSave.Checked)
             {
                 if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decServiceMasterId);
                 }
                 else
                 {
                     Print(decServiceMasterId, infoServiceMaster.ExchangeRateId);
                 }
             }
             this.Close();
             if (frmServiceVoucherRegisterObj != null)
             {
                 frmServiceVoucherRegisterObj.Show();
                 frmServiceVoucherRegisterObj.GridFill();
             }
             else if (frmServiceReportObj != null)
             {
                 frmServiceReportObj.Show();
                 frmServiceReportObj.GridFill();
             }
         }
         else
         {
             Messages.InformationMessage("Can't save Service Voucher without atleast one ledger with complete details");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 24 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save the service voucher
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         ServiceMasterInfo infoServiceMaster = new ServiceMasterInfo();
         ServiceDetailsInfo infoServiceDetails = new ServiceDetailsInfo();
         ServicesBll BllService = new ServicesBll();
         LedgerPostingBll BllLedgerPosting = new LedgerPostingBll();
         LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo();
         ExchangeRateBll BllExchangeRate = new ExchangeRateBll();
         int inRowCount = dgvServiceVoucher.RowCount;
         int inValue = 0;
         for (int ini = 0; ini < inRowCount - 1; ini++)
         {
             if (dgvServiceVoucher.Rows[ini].Cells["dgvcmbParticulars"].Value != null && dgvServiceVoucher.Rows[ini].Cells["dgvcmbParticulars"].Value.ToString() != string.Empty)
             {
                 inValue++;
             }
         }
         if (inValue > 0)
         {
             txtDiscount.Enabled = true;
             infoServiceMaster.InvoiceNo = txtInvoiceNumber.Text;
             if (isAutomatic)
             {
                 infoServiceMaster.VoucherNo = strVoucherNo;
             }
             else
             {
                 infoServiceMaster.VoucherNo = Convert.ToString(BllService.ServiceMasterGetMax(DecServicetVoucherTypeId) + 1);
             }
             infoServiceMaster.SuffixPrefixId = decServiceSuffixPrefixId;
             infoServiceMaster.Date = Convert.ToDateTime(txtVoucherDate.Text);
             infoServiceMaster.LedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
             infoServiceMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text);
             infoServiceMaster.Narration = txtNarration.Text.Trim();
             infoServiceMaster.UserId = PublicVariables._decCurrentUserId;
             infoServiceMaster.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text);
             infoServiceMaster.ServiceAccount = Convert.ToDecimal(cmbServiceAC.SelectedValue.ToString());
             decimal decExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());//spExchangeRate.GetExchangeRateByCurrencyId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()));
             infoServiceMaster.ExchangeRateId = decExchangeRateId;
             infoServiceMaster.EmployeeId = Convert.ToDecimal(cmbSalesman.SelectedValue.ToString());
             infoServiceMaster.Customer = txtCustomer.Text.Trim();
             infoServiceMaster.Discount = Convert.ToDecimal(txtDiscount.Text.Trim());
             infoServiceMaster.GrandTotal = Convert.ToDecimal(txtGrandTotal.Text);
             infoServiceMaster.VoucherTypeId = DecServicetVoucherTypeId;
             infoServiceMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
             infoServiceMaster.ExtraDate = PublicVariables._dtCurrentDate;
             infoServiceMaster.Extra1 = string.Empty;
             infoServiceMaster.Extra2 = string.Empty;
             decServiceMasterId = BllService.ServiceMasterAddReturnWithIdentity(infoServiceMaster);
             infoServiceDetails.ServiceMasterId = decServiceMasterId;
             infoServiceDetails.Extra1 = string.Empty;
             infoServiceDetails.Extra2 = string.Empty;
             infoServiceDetails.ExtraDate = PublicVariables._dtCurrentDate;
             for (int i = 0; i < inRowCount - 1; i++)
             {
                 if (dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.ServiceId = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value.ToString());
                 }
                 if (dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.Measure = dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value.ToString();
                 }
                 if (dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value != null && dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString() != string.Empty)
                 {
                     infoServiceDetails.Amount = Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value.ToString());
                     decAmount += Convert.ToDecimal(dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value);
                 }
                 decServiceDetailsId = BllService.ServiceDetailsAddReturnWithIdentity(infoServiceDetails);
             }
             decSelectedCurrencyRate = BllExchangeRate.GetExchangeRateByExchangeRateId(infoServiceMaster.ExchangeRateId);
             decConvertRate = decAmount * decSelectedCurrencyRate;
             decCredit = 0;
             decDebit = decConvertRate;
             decLedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
             LedgerPosting(decLedgerId, decCredit, decDebit, decServiceDetailsId, infoServiceMaster.VoucherNo);
             AccountLedgerBll bllAccountLedger = new AccountLedgerBll();
             decimal decI = Convert.ToDecimal(bllAccountLedger.AccountGroupIdCheck(cmbCashParty.Text));
             if (decI > 0)
             {
                 PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo();
                 PartyBalanceBll BllPartyBalance = new PartyBalanceBll();
                 infoPartyBalance.Date = Convert.ToDateTime(txtVoucherDate.Text);
                 infoPartyBalance.LedgerId = Convert.ToDecimal(cmbCashParty.SelectedValue.ToString());
                 infoPartyBalance.VoucherTypeId = DecServicetVoucherTypeId;
                 infoPartyBalance.VoucherNo = strVoucherNo;
                 infoPartyBalance.AgainstVoucherTypeId = 0;
                 infoPartyBalance.AgainstVoucherNo = "0";
                 infoPartyBalance.InvoiceNo = strInvoiceNo;
                 infoPartyBalance.AgainstInvoiceNo = "0";
                 infoPartyBalance.ReferenceType = "New";
                 infoPartyBalance.Debit = decAmount;
                 infoPartyBalance.Credit = 0;
                 infoPartyBalance.CreditPeriod = Convert.ToInt32(txtCreditPeriod.Text);
                 infoPartyBalance.ExchangeRateId = decExchangeRateId;
                 infoPartyBalance.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
                 infoPartyBalance.Extra1 = string.Empty;
                 infoPartyBalance.Extra2 = string.Empty;
                 BllPartyBalance.PartyBalanceAdd(infoPartyBalance);
             }
             Messages.SavedMessage();
             if (cbxPrintAfterSave.Checked)
             {
                 if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decServiceMasterId);
                 }
                 else
                 {
                     Print(decServiceMasterId, infoServiceMaster.ExchangeRateId);
                 }
             }
             Clear();
         }
         else
         {
             Messages.InformationMessage("Can't save Service Voucher without atleast one ledger with complete details");
             dgvServiceVoucher.ClearSelection();
             dgvServiceVoucher.CurrentCell = dgvServiceVoucher.Rows[0].Cells["dgvcmbParticulars"];
             dgvServiceVoucher.Rows[0].Cells["dgvcmbParticulars"].Selected = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SV 19 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
Exemple #8
0
        internal ProviderDetailsInfo SendServiceDetail(string hostUrl, ServerBase serverBase)
        {
            //try
            //{
            if (!hostUrl.StartsWith("http://", StringComparison.OrdinalIgnoreCase))
            {
                hostUrl += "http://";
            }
            if (Uri.TryCreate(hostUrl, UriKind.Absolute, out Uri uri))
            {
                hostUrl = uri.Host + ":" + uri.Port;
            }
            using (XmlCommentLoader xmlCommentLoader = new XmlCommentLoader())
            {
                List <Type>         modelTypes = new List <Type>();
                int                 id         = 1;
                ProviderDetailsInfo result     = new ProviderDetailsInfo()
                {
                    Id = id
                };
                foreach (KeyValuePair <string, Type> service in serverBase.RegisteredServiceTypes.Where(x => x.Value.IsServerService()))
                {
                    id++;
                    ServiceDetailsInfo serviceDetail = new ServiceDetailsInfo()
                    {
                        ServiceName   = service.Key,
                        FullNameSpace = service.Value.FullName,
                        NameSpace     = service.Value.Name,
                        Id            = id
                    };
                    result.Services.Add(serviceDetail);
                    List <Type> types = new List <Type>();
                    types.Add(service.Value);
                    foreach (Type item in CSCodeInjection.GetListOfTypes(service.Value))
                    {
                        if (item.GetCustomAttributes <ServiceContractAttribute>(false).Length > 0 && !types.Contains(item))
                        {
                            types.Add(item);
                            types.AddRange(CSCodeInjection.GetListOfTypes(service.Value).Where(x => !types.Contains(x)));
                        }
                    }

                    foreach (Type serviceType in types)
                    {
                        if (serviceType == typeof(object))
                        {
                            continue;
                        }
                        List <MethodInfo> methods = serviceType.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance).Where(x => !(x.IsSpecialName && (x.Name.StartsWith("set_") || x.Name.StartsWith("get_"))) && x.DeclaringType != typeof(object)).ToList();
                        if (methods.Count == 0)
                        {
                            continue;
                        }
                        CommentOfClassInfo comment = xmlCommentLoader.GetComment(serviceType);
                        id++;
                        ServiceDetailsInterface interfaceInfo = new ServiceDetailsInterface()
                        {
                            NameSpace     = serviceType.Name,
                            FullNameSpace = serviceType.FullName,
                            Comment       = comment?.Summery,
                            Id            = id
                        };
                        serviceDetail.Services.Add(interfaceInfo);
                        List <ServiceDetailsMethod> serviceMethods = new List <ServiceDetailsMethod>();
                        foreach (MethodInfo method in methods)
                        {
                            SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(method.ReturnType);
                            if (pType == SerializeObjectType.Enum)
                            {
                                AddEnumAndNewModels(ref id, method.ReturnType, result, SerializeObjectType.Enum, xmlCommentLoader);
                            }
                            CommentOfMethodInfo methodComment = comment == null ? null : (from x in comment.Methods where x.Name == method.Name && x.Parameters.Count == method.GetParameters().Length select x).FirstOrDefault();
                            string exceptions = "";
                            if (methodComment?.Exceptions != null && methodComment?.Exceptions.Count > 0)
                            {
                                foreach (CommentOfExceptionInfo ex in methodComment.Exceptions)
                                {
                                    try
                                    {
                                        if (ex.RefrenceType.LastIndexOf('.') != -1)
                                        {
                                            string baseNameOfEnum = ex.RefrenceType.Substring(0, ex.RefrenceType.LastIndexOf('.'));
                                            Type   type           = GetEnumType(baseNameOfEnum);
#if (NETSTANDARD1_6 || NETCOREAPP1_1)
                                            if (type != null && type.GetTypeInfo().IsEnum)
#else
                                            if (type != null && type.IsEnum)
#endif
                                            {
                                                object value    = Enum.Parse(type, ex.RefrenceType.Substring(ex.RefrenceType.LastIndexOf('.') + 1, ex.RefrenceType.Length - ex.RefrenceType.LastIndexOf('.') - 1));
                                                int    exNumber = (int)value;
                                                exceptions += ex.RefrenceType + $" ({exNumber}) : " + ex.Comment + TextHelper.NewLine;
                                                continue;
                                            }
                                        }
                                    }
                                    catch
                                    {
                                    }

                                    exceptions += ex.RefrenceType + ":" + ex.Comment + TextHelper.NewLine;
                                }
                            }
                            id++;
                            ServiceDetailsMethod info = new ServiceDetailsMethod()
                            {
                                MethodName = method.Name,
#if (!NET35)
                                Requests = new System.Collections.ObjectModel.ObservableCollection <ServiceDetailsRequestInfo>()
                                {
                                    new ServiceDetailsRequestInfo()
                                    {
                                        Name = "Default", Parameters = new List <ServiceDetailsParameterInfo>(), IsSelected = true
                                    }
                                },
#endif
                                ReturnType        = method.ReturnType.GetFriendlyName(),
                                Comment           = methodComment?.Summery,
                                ReturnComment     = methodComment?.Returns,
                                ExceptionsComment = exceptions,
                                Id = id
                            };
                            RuntimeTypeHelper.GetListOfUsedTypes(method.ReturnType, ref modelTypes);
                            foreach (System.Reflection.ParameterInfo paramInfo in method.GetParameters())
                            {
                                pType = SerializeHelper.GetTypeCodeOfObject(paramInfo.ParameterType);
                                if (pType == SerializeObjectType.Enum)
                                {
                                    AddEnumAndNewModels(ref id, paramInfo.ParameterType, result, SerializeObjectType.Enum, xmlCommentLoader);
                                }
                                string parameterComment = "";
                                if (methodComment != null)
                                {
                                    parameterComment = (from x in methodComment.Parameters where x.Name == paramInfo.Name select x.Comment).FirstOrDefault();
                                }
                                id++;
                                ServiceDetailsParameterInfo p = new ServiceDetailsParameterInfo()
                                {
                                    Name         = paramInfo.Name,
                                    Type         = paramInfo.ParameterType.GetFriendlyName(),
                                    FullTypeName = paramInfo.ParameterType.FullName,
                                    Comment      = parameterComment,
                                    Id           = id
                                };
#if (!NET35)
                                info.Requests.First().Parameters.Add(p);
#endif
                                RuntimeTypeHelper.GetListOfUsedTypes(paramInfo.ParameterType, ref modelTypes);
                            }
                            serviceMethods.Add(info);
                        }
                        interfaceInfo.Methods.AddRange(serviceMethods);
                    }
                }



                foreach (KeyValuePair <string, Type> service in serverBase.RegisteredServiceTypes.Where(x => x.Value.IsClientService()))
                {
                    id++;
                    CallbackServiceDetailsInfo serviceDetail = new CallbackServiceDetailsInfo()
                    {
                        ServiceName   = service.Key,
                        FullNameSpace = service.Value.FullName,
                        NameSpace     = service.Value.Name,
                        Id            = id
                    };

                    result.Callbacks.Add(serviceDetail);
                    List <Type> types = new List <Type>();
                    types.Add(service.Value);
                    foreach (Type item in CSCodeInjection.GetListOfTypes(service.Value))
                    {
                        if (item.GetCustomAttributes <ServiceContractAttribute>(false).Length > 0 && !types.Contains(item))
                        {
                            types.Add(item);
                            types.AddRange(CSCodeInjection.GetListOfTypes(service.Value).Where(x => !types.Contains(x)));
                        }
                    }

                    List <MethodInfo> methods = service.Value.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance).Where(x => !(x.IsSpecialName && (x.Name.StartsWith("set_") || x.Name.StartsWith("get_"))) && x.DeclaringType != typeof(object)).ToList();
                    if (methods.Count == 0)
                    {
                        continue;
                    }
                    CommentOfClassInfo          comment        = xmlCommentLoader.GetComment(service.Value);
                    List <ServiceDetailsMethod> serviceMethods = new List <ServiceDetailsMethod>();
                    foreach (MethodInfo method in methods)
                    {
                        SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(method.ReturnType);
                        if (pType == SerializeObjectType.Enum)
                        {
                            AddEnumAndNewModels(ref id, method.ReturnType, result, SerializeObjectType.Enum, xmlCommentLoader);
                        }
                        CommentOfMethodInfo methodComment = comment == null ? null : (from x in comment.Methods where x.Name == method.Name && x.Parameters.Count == method.GetParameters().Length select x).FirstOrDefault();
                        string exceptions = "";
                        if (methodComment?.Exceptions != null && methodComment?.Exceptions.Count > 0)
                        {
                            foreach (CommentOfExceptionInfo ex in methodComment.Exceptions)
                            {
                                try
                                {
                                    if (ex.RefrenceType.LastIndexOf('.') != -1)
                                    {
                                        string baseNameOfEnum = ex.RefrenceType.Substring(0, ex.RefrenceType.LastIndexOf('.'));
                                        Type   type           = GetEnumType(baseNameOfEnum);
#if (NETSTANDARD1_6 || NETCOREAPP1_1)
                                        if (type != null && type.GetTypeInfo().IsEnum)
#else
                                        if (type != null && type.IsEnum)
#endif
                                        {
                                            object value    = Enum.Parse(type, ex.RefrenceType.Substring(ex.RefrenceType.LastIndexOf('.') + 1, ex.RefrenceType.Length - ex.RefrenceType.LastIndexOf('.') - 1));
                                            int    exNumber = (int)value;
                                            exceptions += ex.RefrenceType + $" ({exNumber}) : " + ex.Comment + TextHelper.NewLine;
                                            continue;
                                        }
                                    }
                                }
                                catch
                                {
                                }

                                exceptions += ex.RefrenceType + ":" + ex.Comment + TextHelper.NewLine;
                            }
                        }
                        id++;
                        ServiceDetailsMethod info = new ServiceDetailsMethod()
                        {
                            MethodName = method.Name,
#if (!NET35)
                            Requests = new System.Collections.ObjectModel.ObservableCollection <ServiceDetailsRequestInfo>()
                            {
                                new ServiceDetailsRequestInfo()
                                {
                                    Name = "Default", Parameters = new List <ServiceDetailsParameterInfo>(), IsSelected = true
                                }
                            },
#endif
                            ReturnType        = method.ReturnType.GetFriendlyName(),
                            Comment           = methodComment?.Summery,
                            ReturnComment     = methodComment?.Returns,
                            ExceptionsComment = exceptions,
                            Id = id
                        };
                        RuntimeTypeHelper.GetListOfUsedTypes(method.ReturnType, ref modelTypes);
                        foreach (System.Reflection.ParameterInfo paramInfo in method.GetParameters())
                        {
                            pType = SerializeHelper.GetTypeCodeOfObject(paramInfo.ParameterType);
                            if (pType == SerializeObjectType.Enum)
                            {
                                AddEnumAndNewModels(ref id, paramInfo.ParameterType, result, SerializeObjectType.Enum, xmlCommentLoader);
                            }
                            string parameterComment = "";
                            if (methodComment != null)
                            {
                                parameterComment = (from x in methodComment.Parameters where x.Name == paramInfo.Name select x.Comment).FirstOrDefault();
                            }
                            id++;
                            ServiceDetailsParameterInfo p = new ServiceDetailsParameterInfo()
                            {
                                Name         = paramInfo.Name,
                                Type         = paramInfo.ParameterType.GetFriendlyName(),
                                FullTypeName = paramInfo.ParameterType.FullName,
                                Comment      = parameterComment,
                                Id           = id
                            };
#if (!NET35)
                            info.Requests.First().Parameters.Add(p);
#endif
                            RuntimeTypeHelper.GetListOfUsedTypes(paramInfo.ParameterType, ref modelTypes);
                        }
                        serviceMethods.Add(info);
                    }
                    serviceDetail.Methods.AddRange(serviceMethods);
                }



                foreach (KeyValuePair <string, Type> httpServiceType in serverBase.RegisteredServiceTypes.Where(x => x.Value.IsHttpService()))
                {
                    id++;
                    HttpControllerDetailsInfo controller = new HttpControllerDetailsInfo()
                    {
                        Id  = id,
                        Url = httpServiceType.Value.GetCustomAttributes <ServiceContractAttribute>(true).Length > 0 ? httpServiceType.Value.GetCustomAttributes <ServiceContractAttribute>(true)[0].Name : httpServiceType.Key,
                    };
                    id++;
                    result.WebApiDetailsInfo.Id = id;
                    result.WebApiDetailsInfo.HttpControllers.Add(controller);
                    List <MethodInfo> methods = httpServiceType.Value.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance).Where(x => !(x.IsSpecialName && (x.Name.StartsWith("set_") || x.Name.StartsWith("get_"))) && x.DeclaringType != typeof(object)).ToList();
                    if (methods.Count == 0)
                    {
                        continue;
                    }
                    CommentOfClassInfo          comment        = xmlCommentLoader.GetComment(httpServiceType.Value);
                    List <ServiceDetailsMethod> serviceMethods = new List <ServiceDetailsMethod>();
                    foreach (MethodInfo method in methods)
                    {
                        SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(method.ReturnType);
                        if (pType == SerializeObjectType.Enum)
                        {
                            AddEnumAndNewModels(ref id, method.ReturnType, result, SerializeObjectType.Enum, xmlCommentLoader);
                        }
                        CommentOfMethodInfo methodComment = comment == null ? null : (from x in comment.Methods where x.Name == method.Name && x.Parameters.Count == method.GetParameters().Length select x).FirstOrDefault();
                        string exceptions = "";
                        if (methodComment?.Exceptions != null && methodComment?.Exceptions.Count > 0)
                        {
                            foreach (CommentOfExceptionInfo ex in methodComment.Exceptions)
                            {
                                try
                                {
                                    if (ex.RefrenceType.LastIndexOf('.') != -1)
                                    {
                                        string baseNameOfEnum = ex.RefrenceType.Substring(0, ex.RefrenceType.LastIndexOf('.'));
                                        Type   type           = GetEnumType(baseNameOfEnum);
#if (NETSTANDARD1_6 || NETCOREAPP1_1)
                                        if (type != null && type.GetTypeInfo().IsEnum)
#else
                                        if (type != null && type.IsEnum)
#endif
                                        {
                                            object value    = Enum.Parse(type, ex.RefrenceType.Substring(ex.RefrenceType.LastIndexOf('.') + 1, ex.RefrenceType.Length - ex.RefrenceType.LastIndexOf('.') - 1));
                                            int    exNumber = (int)value;
                                            exceptions += ex.RefrenceType + $" ({exNumber}) : " + ex.Comment + TextHelper.NewLine;
                                            continue;
                                        }
                                    }
                                }
                                catch
                                {
                                }

                                exceptions += ex.RefrenceType + ":" + ex.Comment + TextHelper.NewLine;
                            }
                        }
                        id++;
                        ServiceDetailsMethod info = new ServiceDetailsMethod()
                        {
                            Id         = id,
                            MethodName = method.Name,
#if (!NET35)
                            Requests = new System.Collections.ObjectModel.ObservableCollection <ServiceDetailsRequestInfo>()
                            {
                                new ServiceDetailsRequestInfo()
                                {
                                    Name = "Default", Parameters = new List <ServiceDetailsParameterInfo>(), IsSelected = true
                                }
                            },
#endif
                            ReturnType        = method.ReturnType.GetFriendlyName(),
                            Comment           = methodComment?.Summery,
                            ReturnComment     = methodComment?.Returns,
                            ExceptionsComment = exceptions,
                            TestExample       = hostUrl + "/" + controller.Url + "/" + method.Name
                        };

                        RuntimeTypeHelper.GetListOfUsedTypes(method.ReturnType, ref modelTypes);
                        string testExampleParams = "";
                        foreach (System.Reflection.ParameterInfo paramInfo in method.GetParameters())
                        {
                            pType = SerializeHelper.GetTypeCodeOfObject(paramInfo.ParameterType);
                            if (pType == SerializeObjectType.Enum)
                            {
                                AddEnumAndNewModels(ref id, paramInfo.ParameterType, result, SerializeObjectType.Enum, xmlCommentLoader);
                            }
                            string parameterComment = "";
                            if (methodComment != null)
                            {
                                parameterComment = (from x in methodComment.Parameters where x.Name == paramInfo.Name select x.Comment).FirstOrDefault();
                            }
                            id++;
                            ServiceDetailsParameterInfo p = new ServiceDetailsParameterInfo()
                            {
                                Id           = id,
                                Name         = paramInfo.Name,
                                Type         = paramInfo.ParameterType.Name,
                                FullTypeName = paramInfo.ParameterType.FullName,
                                Comment      = parameterComment
                            };
#if (!NET35)
                            info.Requests.First().Parameters.Add(p);
#endif
                            if (string.IsNullOrEmpty(testExampleParams))
                            {
                                testExampleParams += "?";
                            }
                            else
                            {
                                testExampleParams += "&";
                            }
                            testExampleParams += paramInfo.Name + "=" + DataExchangeConverter.GetDefault(paramInfo.ParameterType) ?? "null";
                            RuntimeTypeHelper.GetListOfUsedTypes(paramInfo.ParameterType, ref modelTypes);
                        }
                        info.TestExample += testExampleParams;
                        serviceMethods.Add(info);
                    }
                    controller.Methods = serviceMethods;
                }

                foreach (Type type in modelTypes)
                {
                    try
                    {
                        SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(type);
                        AddEnumAndNewModels(ref id, type, result, pType, xmlCommentLoader);
                        //                                var mode = SerializeHelper.GetTypeCodeOfObject(type);
                        //                                if (mode == SerializeObjectType.Object)
                        //                                {
                        //                                    if (type.Name.Contains("`") || type == typeof(CustomAttributeTypedArgument) || type == typeof(CustomAttributeNamedArgument) ||
                        //#if (NETSTANDARD1_6 || NETCOREAPP1_1)
                        //                                        type.GetTypeInfo().BaseType == typeof(Attribute))
                        //#else
                        //                                    type.BaseType == typeof(Attribute))
                        //#endif
                        //                                        continue;

                        //                                    var instance = Activator.CreateInstance(type);
                        //                                    string jsonResult = JsonConvert.SerializeObject(instance, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Include });
                        //                                    var refactorResult = (JObject)JsonConvert.DeserializeObject(jsonResult);
                        //                                    foreach (var item in refactorResult.Properties())
                        //                                    {
                        //                                        var find = type.GetProperties().FirstOrDefault(x => x.Name == item.Name);
                        //                                        refactorResult[item.Name] = find.PropertyType.FullName;
                        //                                    }
                        //                                    jsonResult = JsonConvert.SerializeObject(refactorResult, Formatting.Indented, new JsonSerializerSettings() { NullValueHandling = NullValueHandling.Include });

                        //                                    if (jsonResult == "{}" || jsonResult == "[]")
                        //                                        continue;
                        //                                    var comment = xmlCommentLoader.GetComment(type);
                        //                                    id++;
                        //                                    result.ProjectDomainDetailsInfo.Id = id;
                        //                                    id++;
                        //                                    result.ProjectDomainDetailsInfo.Models.Add(new ModelDetailsInfo()
                        //                                    {
                        //                                        Id = id,
                        //                                        Comment = comment?.Summery,
                        //                                        Name = type.Name,
                        //                                        FullNameSpace = type.FullName,
                        //                                        ObjectType = mode,
                        //                                        JsonTemplate = jsonResult
                        //                                    });
                        //                                    foreach (var property in type.GetProperties())
                        //                                    {
                        //                                        var pType = SerializeHelper.GetTypeCodeOfObject(property.PropertyType);
                        //                                        if (pType == SerializeObjectType.Enum)
                        //                                        {
                        //                                            AddEnumAndNewModels(ref id, property.PropertyType, result, SerializeObjectType.Enum, xmlCommentLoader);
                        //                                        }
                        //                                    }
                        //                                }
                    }
                    catch (Exception ex)
                    {
                        serverBase.AutoLogger.LogError(ex, "Model Type Add error: " + ex.ToString());
                    }
                }

                return(result);
                //string json = ServerSerializationHelper.SerializeObject(result, serverBase);
                //List<byte> bytes = new List<byte>
                // {
                //                (byte)DataType.GetServiceDetails,
                //                (byte)CompressMode.None
                // };
                //byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
                //byte[] dataLen = BitConverter.GetBytes(jsonBytes.Length);
                //bytes.AddRange(dataLen);
                //bytes.AddRange(jsonBytes);
                //await client.StreamHelper.WriteToStreamAsync(client.ClientStream, bytes.ToArray());
            }
            //}
            //catch (Exception ex)
            //{
            //    try
            //    {
            //        string json = ServerSerializationHelper.SerializeObject(new Exception(ex.ToString()), serverBase);
            //        List<byte> bytes = new List<byte>
            //         {
            //            (byte)DataType.GetServiceDetails,
            //            (byte)CompressMode.None
            //         };
            //        byte[] jsonBytes = Encoding.UTF8.GetBytes(json);
            //        byte[] dataLen = BitConverter.GetBytes(jsonBytes.Length);
            //        bytes.AddRange(dataLen);
            //        bytes.AddRange(jsonBytes);
            //        await client.StreamHelper.WriteToStreamAsync(client.ClientStream, bytes.ToArray());

            //    }
            //    catch (Exception)
            //    {

            //    }
            //    serverBase.AutoLogger.LogError(ex, $"{client.IPAddress} {client.ClientId} ServerBase CallMethod");
            //}
            //finally
            //{
            //    skippedTypes.Clear();
            //}

            void AddEnumAndNewModels(ref int id, Type type, ProviderDetailsInfo result, SerializeObjectType objType, XmlCommentLoader xmlCommentLoader)
            {
                if (result.ProjectDomainDetailsInfo.Models.Any(x => x.FullNameSpace == type.FullName) || skippedTypes.Contains(type))
                {
                    return;
                }
                id++;
                result.ProjectDomainDetailsInfo.Id = id;
                id++;
                if (objType == SerializeObjectType.Enum)
                {
                    List <string> items = new List <string>();
                    foreach (Enum obj in Enum.GetValues(type))
                    {
                        int x = Convert.ToInt32(obj); // x is the integer value of enum
                        items.Add(obj.ToString() + " = " + x);
                    }

                    result.ProjectDomainDetailsInfo.Models.Add(new ModelDetailsInfo()
                    {
                        Id            = id,
                        Name          = type.Name,
                        FullNameSpace = type.FullName,
                        ObjectType    = objType,
                        JsonTemplate  = JsonConvert.SerializeObject(items, Formatting.Indented, new JsonSerializerSettings()
                        {
                            NullValueHandling = NullValueHandling.Include
                        })
                    });
                }
                else
                {
                    try
                    {
                        if (type.Name.Contains("`") || type == typeof(CustomAttributeTypedArgument) || type == typeof(CustomAttributeNamedArgument) ||
#if (NETSTANDARD1_6 || NETCOREAPP1_1)
                            type.GetTypeInfo().BaseType == typeof(Attribute) || type.GetTypeInfo().BaseType == null)
#else
                            type.BaseType == typeof(Attribute) || type.BaseType == null)
#endif
                        {
                            skippedTypes.Add(type);
                            return;
                        }

                        object instance   = Activator.CreateInstance(type);
                        string jsonResult = JsonConvert.SerializeObject(instance, Formatting.Indented, new JsonSerializerSettings()
                        {
                            NullValueHandling = NullValueHandling.Include
                        });
                        JObject refactorResult = (JObject)JsonConvert.DeserializeObject(jsonResult);
                        foreach (JProperty item in refactorResult.Properties())
                        {
                            PropertyInfo find = type.GetProperties().FirstOrDefault(x => x.Name == item.Name);
                            refactorResult[item.Name] = find.PropertyType.GetFriendlyName();
                        }
                        jsonResult = JsonConvert.SerializeObject(refactorResult, Formatting.Indented, new JsonSerializerSettings()
                        {
                            NullValueHandling = NullValueHandling.Include
                        });

                        if (jsonResult == "{}" || jsonResult == "[]")
                        {
                            skippedTypes.Add(type);
                            return;
                        }
                        CommentOfClassInfo comment = xmlCommentLoader.GetComment(type);
                        id++;
                        result.ProjectDomainDetailsInfo.Id = id;
                        id++;
                        result.ProjectDomainDetailsInfo.Models.Add(new ModelDetailsInfo()
                        {
                            Id            = id,
                            Comment       = comment?.Summery,
                            Name          = type.Name,
                            FullNameSpace = type.FullName,
                            ObjectType    = objType,
                            JsonTemplate  = jsonResult
                        });
                    }
                    catch
                    {
                        skippedTypes.Add(type);
                    }
                }

                foreach (Type item in type.GetListOfGenericArguments())
                {
                    SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(item);
                    AddEnumAndNewModels(ref id, item, result, pType, xmlCommentLoader);
                }

                foreach (Type item in type.GetListOfInterfaces())
                {
                    SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(item);
                    AddEnumAndNewModels(ref id, item, result, pType, xmlCommentLoader);
                }

                foreach (Type item in type.GetListOfNestedTypes())
                {
                    SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(item);
                    AddEnumAndNewModels(ref id, item, result, pType, xmlCommentLoader);
                }

                foreach (Type item in type.GetListOfBaseTypes())
                {
                    SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(item);
                    AddEnumAndNewModels(ref id, item, result, pType, xmlCommentLoader);
                }
                foreach (PropertyInfo property in type.GetProperties())
                {
                    SerializeObjectType pType = SerializeHelper.GetTypeCodeOfObject(property.PropertyType);
                    AddEnumAndNewModels(ref id, property.PropertyType, result, pType, xmlCommentLoader);
                }
            }
        }