Example #1
0
        public ActionResult GetCustomerFullData(string Code, string Type)
        {
            Models.Customer.CustomerModel custModel = new Models.Customer.CustomerModel();
            custModel.custRecord = SetCustomerRecordModel(service.getCustomerRecordByCode(Code));
            var ID = custModel.custRecord.ID;

            if (Type == "Character")
            {
                custModel.custCharacter = setCustomerCharacterModel(service.getCustomerCharacterByID(ID));
            }
            if (Type == "Education")
            {
                custModel.custEducation = setCustomerEducationModel(service.getCustomerEducationByID(ID));
            }
            if (Type == "Dependent")
            {
                custModel.custDependents = setCustomerDependentModel(service.getCustomerDependentsByID(ID));
            }
            if (Type == "Address")
            {
                custModel.custAddress = setCustomerAddressModel(service.getCustomerAddressByID(ID));
            }
            if (Type == "Employment")
            {
                custModel.custEmployment = setCustomerEmploymentModel(service.getCustomerEmploymentRecordByID(ID));
            }
            return(Json(custModel, JsonRequestBehavior.AllowGet));
        }
        public CompanyCustomer.Models.Customer.CustomerModel GetCustomerByProvider(string ProviderPublicId, string vCustomerRelated)
        {
            List <System.Data.IDbDataParameter> lstParams = new List <System.Data.IDbDataParameter>();

            lstParams.Add(DataInstance.CreateTypedParameter("vProviderPublicId", ProviderPublicId));
            lstParams.Add(DataInstance.CreateTypedParameter("vCustomerRelated", vCustomerRelated));

            ADO.Models.ADOModelResponse response = DataInstance.ExecuteQuery(new ADO.Models.ADOModelRequest()
            {
                CommandExecutionType = ADO.Models.enumCommandExecutionType.DataTable,
                CommandText          = "CC_GetCustomerByProvider",
                CommandType          = System.Data.CommandType.StoredProcedure,
                Parameters           = lstParams,
            });

            CompanyCustomer.Models.Customer.CustomerModel oReturn = new Models.Customer.CustomerModel();

            if (response.DataTableResult != null &&
                response.DataTableResult.Rows.Count > 0)
            {
                oReturn = new Models.Customer.CustomerModel()
                {
                    RelatedProvider =
                        (from cpri in response.DataTableResult.AsEnumerable()
                         where !cpri.IsNull("CustomerPublicId")
                         group cpri by new
                    {
                        CustomerProviderId = cpri.Field <UInt64>("CustomerProviderId"),
                        CustomerPublicId = cpri.Field <string>("CustomerPublicId"),
                        CustomerName = cpri.Field <string>("CustomerName"),
                        StatusId = cpri.Field <UInt64>("StatusId"),
                        StatusName = cpri.Field <string>("StatusName"),
                        IsRelatedCustomer = cpri.Field <UInt64>("IsRelatedCustomer") == 1 ? true : false,
                    } into cprinf
                         select new ProveedoresOnLine.CompanyCustomer.Models.Customer.CustomerProviderModel()
                    {
                        CustomerProviderId = Convert.ToInt32(cprinf.Key.CustomerProviderId),
                        RelatedProvider = new Company.Models.Company.CompanyModel()
                        {
                            CompanyPublicId = cprinf.Key.CustomerPublicId,
                            CompanyName = cprinf.Key.CustomerName,
                        },
                        Status = new Company.Models.Util.CatalogModel()
                        {
                            ItemId = Convert.ToInt32(cprinf.Key.StatusId),
                            ItemName = cprinf.Key.StatusName,
                        },
                        Enable = cprinf.Key.IsRelatedCustomer,
                    }).ToList(),
                };
            }

            return(oReturn);
        }
        public void AditionalDocumentsUpsert()
        {
            ProveedoresOnLine.CompanyCustomer.Models.Customer.CustomerModel oModel        = new Models.Customer.CustomerModel();
            ProveedoresOnLine.Company.Models.Util.GenericItemModel          oGenericModel = new ProveedoresOnLine.Company.Models.Util.GenericItemModel();

            oModel.RelatedCompany = new Company.Models.Company.CompanyModel();
            oModel.RelatedCompany.CompanyPublicId = "DA5C572E";

            oModel.AditionalDocuments = new List <Company.Models.Util.GenericItemModel>();

            oGenericModel = new Company.Models.Util.GenericItemModel()
            {
                ItemId   = 0,
                ItemName = "Archivo adicional de prueba",
                Enable   = true,
                ItemInfo = new List <Company.Models.Util.GenericItemInfoModel>(),
            };

            oGenericModel.ItemInfo.Add(
                new Company.Models.Util.GenericItemInfoModel()
            {
                ItemInfoId   = 0,
                ItemInfoType = new Company.Models.Util.CatalogModel()
                {
                    ItemId = 220003,
                },
                Value  = "1701001",
                Enable = true,
            });

            oGenericModel.ItemInfo.Add(
                new Company.Models.Util.GenericItemInfoModel()
            {
                ItemInfoId   = 0,
                ItemInfoType = new Company.Models.Util.CatalogModel()
                {
                    ItemId = 220004,
                },
                Value  = "701001",
                Enable = true,
            }
                );

            oModel.AditionalDocuments.Add(oGenericModel);

            oModel = ProveedoresOnLine.CompanyCustomer.Controller.CompanyCustomer.AditionalDocumentsUpsert(oModel);

            Assert.AreEqual(true, oModel != null && oModel.AditionalDocuments != null);
        }
Example #4
0
        public ActionResult Update_CustomerRecord(string Code)
        {
            Models.Customer.CustomerModel custModel = new Models.Customer.CustomerModel();
            var custRecord = service.getCustomerRecordByCode(Code);

            custModel.custRecord = SetCustomerRecordModel(custRecord);
            var ID = custModel.custRecord.ID;

            custModel.custCharacter  = setCustomerCharacterModel(service.getCustomerCharacterByID(ID));
            custModel.custEducation  = setCustomerEducationModel(service.getCustomerEducationByID(ID));
            custModel.custDependents = setCustomerDependentModel(service.getCustomerDependentsByID(ID));
            custModel.custAddress    = setCustomerAddressModel(service.getCustomerAddressByID(ID)).Where(p => p.AddressTypeID.Contains("0")).ToList();
            custModel.custEmployment = setCustomerEmploymentModel(service.getCustomerEmploymentRecordByID(ID));
            custModel.allComponents  = setComponents(custRecord);
            return(View(custModel));
        }
Example #5
0
        public ActionResult FetchCustomerRecordByID(string Code)
        {
            Models.Customer.CustomerModel custModel = new Models.Customer.CustomerModel();
            custModel.custRecord = SetCustomerRecordModel(service.getCustomerRecordByCode(Code));
            var ID = custModel.custRecord.ID;

            custModel.custCharacter  = setCustomerCharacterModel(service.getCustomerCharacterByID(ID));
            custModel.custEducation  = setCustomerEducationModel(service.getCustomerEducationByID(ID));
            custModel.custDependents = setCustomerDependentModel(service.getCustomerDependentsByID(ID));
            custModel.custAddress    = setCustomerAddressModel(service.getCustomerAddressByID(ID));
            custModel.custEmployment = setCustomerEmploymentModel(service.getCustomerEmploymentRecordByID(ID));
            var pvr = new PartialViewResult();

            pvr = PartialView("_Display_CustomerRecord", custModel);
            return(pvr);
        }
Example #6
0
        public ActionResult AddCustomerData(Models.Customer.CustomerModel custModel, List <Models.Customer.CustomerAddress> custAddress, List <Models.Customer.CustomerDependents> custDependents, List <Models.Customer.CustomerEmployment> custEmployment, List <Models.Customer.CustomerEducation> custEducation, List <Models.Customer.CustomerCharacter> custCharacter, string PISID)
        {
            if (custEmployment == null)
            {
                custEmployment = new List <Models.Customer.CustomerEmployment>();
            }
            if (custCharacter == null)
            {
                custCharacter = new List <Models.Customer.CustomerCharacter>();
            }
            if (custDependents == null)
            {
                custDependents = new List <Models.Customer.CustomerDependents>();
            }
            if (custEducation == null)
            {
                custEducation = new List <Models.Customer.CustomerEducation>();
            }
            if (custAddress == null)
            {
                custAddress = new List <Models.Customer.CustomerAddress>();
            }
            custModel.custEmployment = custEmployment;
            custModel.custCharacter  = custCharacter;
            custModel.custDependents = custDependents;
            custModel.custEducation  = custEducation;
            foreach (Models.Customer.CustomerAddress address in custAddress)
            {
                custModel.custAddress.Add(address);
            }
            Mapper.CreateMap <Models.Customer.CustomerAddress, BusinessObjects.CustomerAddress>();
            Mapper.CreateMap <Models.Customer.CustomerCharacter, BusinessObjects.CustomerCharacter>();
            Mapper.CreateMap <Models.Customer.CustomerDependents, BusinessObjects.CustomerDependents>();
            Mapper.CreateMap <Models.Customer.CustomerEducation, BusinessObjects.CustomerEducation>();
            Mapper.CreateMap <Models.Customer.CustomerEmployment, BusinessObjects.CustomerEmployment>();
            Mapper.CreateMap <Models.Customer.CustomerRecord, BusinessObjects.CustomerRecord>();
            Mapper.CreateMap <Models.Customer.CustomerModel, BusinessObjects.CustomerModel>();
            BusinessObjects.CustomerModel       cModel  = Mapper.Map <Models.Customer.CustomerModel, BusinessObjects.CustomerModel>(custModel);
            List <Dictionary <string, object> > session = (List <Dictionary <string, object> >)Session["loginDetails"];
            string UserID = session[0]["ID"].ToString();

            cModel.custRecord.PreparedByID       = UserID;
            cModel.custRecord.DocumentStatusCode = "7";
            cModel.custRecord.Permission         = "5";
            return(Content(service.UpdateCustomerData("Add", cModel, PISID).ToString()));
        }
Example #7
0
        public ActionResult Add_CustomerRecord()
        {
            Models.Customer.CustomerModel          custModel    = new Models.Customer.CustomerModel();
            BusinessObjects.CustomerRecord         custRecord   = new BusinessObjects.CustomerRecord();
            Models.Customer.CustomerRecord         CMcustRecord = new Models.Customer.CustomerRecord();
            List <Models.Customer.CustomerAddress> LCustAddress = new List <Models.Customer.CustomerAddress>();

            Models.Customer.CustomerAddress McustAddress = new Models.Customer.CustomerAddress();
            LCustAddress.Add(McustAddress);
            custModel.custRecord  = CMcustRecord;
            custModel.custAddress = LCustAddress;
            var PISID = System.Guid.NewGuid().ToString();

            custModel.custRecord.ID                = PISID;
            custModel.custAddress[0].ID            = System.Guid.NewGuid().ToString();
            custModel.custAddress[0].PISID         = PISID;
            custModel.custAddress[0].AddressTypeID = "0";
            custModel.allComponents                = setComponents(custRecord);
            return(View(custModel));
        }
Example #8
0
 public ActionResult UpdateCustomerData(Models.Customer.CustomerModel custModel, List <Models.Customer.CustomerAddress> custAddress, List <Models.Customer.CustomerDependents> custDependents, List <Models.Customer.CustomerEmployment> custEmployment, List <Models.Customer.CustomerEducation> custEducation, List <Models.Customer.CustomerCharacter> custCharacter, string PISID)
 {
     if (custEmployment == null)
     {
         custEmployment = new List <Models.Customer.CustomerEmployment>();
     }
     if (custCharacter == null)
     {
         custCharacter = new List <Models.Customer.CustomerCharacter>();
     }
     if (custDependents == null)
     {
         custDependents = new List <Models.Customer.CustomerDependents>();
     }
     if (custEducation == null)
     {
         custEducation = new List <Models.Customer.CustomerEducation>();
     }
     if (custAddress == null)
     {
         custAddress = new List <Models.Customer.CustomerAddress>();
     }
     custModel.custEmployment = custEmployment;
     custModel.custCharacter  = custCharacter;
     custModel.custDependents = custDependents;
     custModel.custEducation  = custEducation;
     foreach (Models.Customer.CustomerAddress address in custAddress)
     {
         custModel.custAddress.Add(address);
     }
     Mapper.CreateMap <Models.Customer.CustomerAddress, BusinessObjects.CustomerAddress>();
     Mapper.CreateMap <Models.Customer.CustomerCharacter, BusinessObjects.CustomerCharacter>();
     Mapper.CreateMap <Models.Customer.CustomerDependents, BusinessObjects.CustomerDependents>();
     Mapper.CreateMap <Models.Customer.CustomerEducation, BusinessObjects.CustomerEducation>();
     Mapper.CreateMap <Models.Customer.CustomerEmployment, BusinessObjects.CustomerEmployment>();
     Mapper.CreateMap <Models.Customer.CustomerRecord, BusinessObjects.CustomerRecord>();
     Mapper.CreateMap <Models.Customer.CustomerModel, BusinessObjects.CustomerModel>();
     BusinessObjects.CustomerModel cModel = Mapper.Map <Models.Customer.CustomerModel, BusinessObjects.CustomerModel>(custModel);
     return(Content(service.UpdateCustomerData("Update", cModel, PISID).ToString()));
 }
        public Models.Customer.CustomerModel GetAditionalDocumentsByCompany(string CustomerPublicId, bool Enable, int PageNumber, int RowCount, out int TotalRows)
        {
            TotalRows = 0;

            List <IDbDataParameter> lstParams = new List <IDbDataParameter>();

            lstParams.Add(DataInstance.CreateTypedParameter("vCustomerPublicId", CustomerPublicId));
            lstParams.Add(DataInstance.CreateTypedParameter("vEnable", Enable));
            lstParams.Add(DataInstance.CreateTypedParameter("vPageNumber", PageNumber));
            lstParams.Add(DataInstance.CreateTypedParameter("vRowCount", RowCount));

            ADO.Models.ADOModelResponse response = DataInstance.ExecuteQuery(new ADO.Models.ADOModelRequest()
            {
                CommandExecutionType = ADO.Models.enumCommandExecutionType.DataTable,
                CommandText          = "CC_GetAditionalDocumentsByCompanyPublicId",
                CommandType          = CommandType.StoredProcedure,
                Parameters           = lstParams,
            });

            Models.Customer.CustomerModel oReturn = null;

            if (response.DataTableResult != null &&
                response.DataTableResult.Rows.Count > 0)
            {
                TotalRows = response.DataTableResult.Rows[0].Field <int>("oTotalRows");

                oReturn = new Models.Customer.CustomerModel()
                {
                    RelatedCompany = new Company.Models.Company.CompanyModel()
                    {
                        CompanyPublicId = response.DataTableResult.Rows[0].Field <string>("CustomerPublicId"),
                    },
                    AditionalDocuments =
                        (from ad in response.DataTableResult.AsEnumerable()
                         where !ad.IsNull("AditionalDocumentId")
                         group ad by new
                    {
                        AditionalDocumentId = ad.Field <int>("AditionalDocumentId"),
                        AditionalDocumentName = ad.Field <string>("AditionalDocumentName"),
                        AditionalDocumnetEnable = ad.Field <UInt64>("AditionalDocumentEnable"),
                    }
                         into adi
                         select new ProveedoresOnLine.Company.Models.Util.GenericItemModel()
                    {
                        ItemId = adi.Key.AditionalDocumentId,
                        ItemName = adi.Key.AditionalDocumentName,
                        Enable = adi.Key.AditionalDocumnetEnable == 1 ? true : false,
                        ItemInfo =
                            (from adinf in response.DataTableResult.AsEnumerable()
                             where !adinf.IsNull("AditionalDocumentInfoId") &&
                             adinf.Field <int>("AditionalDocumentId") == adi.Key.AditionalDocumentId
                             group adinf by new
                        {
                            AditionalDocumentInfoId = adinf.Field <int>("AditionalDocumentInfoId"),
                            AditionalDocumentInfoTypeId = adinf.Field <int>("AditionalDocumentInfoTypeId"),
                            AditionalDocumentInfoTypeName = adinf.Field <string>("AditionalDocumentInfoTypeName"),
                            AditionalDocumentInfoValue = adinf.Field <string>("AditionalDocumentInfoValue"),
                            AditionalDocumentInfoLargeValue = adinf.Field <string>("AditionalDocumentInfoLargeValue"),
                            AditionalDocumentInfoEnable = adinf.Field <UInt64>("AditionalDocumentInfoEnable"),
                        }
                             into adinfi
                             select new ProveedoresOnLine.Company.Models.Util.GenericItemInfoModel()
                        {
                            ItemInfoId = adinfi.Key.AditionalDocumentInfoId,
                            ItemInfoType = new Company.Models.Util.CatalogModel()
                            {
                                ItemId = adinfi.Key.AditionalDocumentInfoTypeId,
                                ItemName = adinfi.Key.AditionalDocumentInfoTypeName,
                            },
                            Value = adinfi.Key.AditionalDocumentInfoValue,
                            LargeValue = adinfi.Key.AditionalDocumentInfoLargeValue,
                            Enable = adinfi.Key.AditionalDocumentInfoEnable == 1 ? true : false,
                        }).ToList(),
                    }).ToList(),
                };
            }

            return(oReturn);
        }
        public CompanyCustomer.Models.Customer.CustomerModel GetCustomerInfoByProvider(int CustomerProviderId, bool Enable, int PageNumber, int RowCount, out int TotalRows)
        {
            TotalRows = 0;

            List <System.Data.IDbDataParameter> lstParams = new List <IDbDataParameter>();

            lstParams.Add(DataInstance.CreateTypedParameter("vCustomerProviderId", CustomerProviderId));
            lstParams.Add(DataInstance.CreateTypedParameter("vEnable", Enable == true ? 1 : 0));
            lstParams.Add(DataInstance.CreateTypedParameter("vPageNumber", PageNumber));
            lstParams.Add(DataInstance.CreateTypedParameter("vRowCount", RowCount));

            ADO.Models.ADOModelResponse response = DataInstance.ExecuteQuery(new ADO.Models.ADOModelRequest()
            {
                CommandExecutionType = ADO.Models.enumCommandExecutionType.DataTable,
                CommandText          = "CC_GetCustomerInfoByProvider",
                CommandType          = CommandType.StoredProcedure,
                Parameters           = lstParams,
            });

            CompanyCustomer.Models.Customer.CustomerModel oReturn = null;

            if (response.DataTableResult != null &&
                response.DataTableResult.Rows.Count > 0)
            {
                TotalRows = response.DataTableResult.Rows[0].Field <int>("TotalRows");

                oReturn = new Models.Customer.CustomerModel()
                {
                    RelatedProvider = new List <Models.Customer.CustomerProviderModel>()
                    {
                        new Models.Customer.CustomerProviderModel()
                        {
                            CustomerProviderId   = response.DataTableResult.Rows[0].Field <int>("CustomerProviderId"),
                            CustomerProviderInfo =
                                (from cpi in response.DataTableResult.AsEnumerable()
                                 where !cpi.IsNull("CustomerProviderInfoId")
                                 group cpi by new
                            {
                                CustomerProviderInfoId = cpi.Field <int>("CustomerProviderInfoId"),
                                TrackingId = cpi.Field <int>("TrackingId"),
                                TrackingName = cpi.Field <string>("TrackingName"),
                                TrackingValue = cpi.Field <string>("TrackingValue"),
                                Enable = cpi.Field <UInt64>("Enable") == 1 ? true : false,
                                CreateDate = cpi.Field <DateTime>("CreateDate"),
                            } into cpinf
                                 select new ProveedoresOnLine.Company.Models.Util.GenericItemInfoModel()
                            {
                                ItemInfoId = cpinf.Key.CustomerProviderInfoId,
                                ItemInfoType = new Company.Models.Util.CatalogModel()
                                {
                                    ItemId = cpinf.Key.TrackingId,
                                    ItemName = cpinf.Key.TrackingName,
                                },
                                LargeValue = cpinf.Key.TrackingValue,
                                Enable = cpinf.Key.Enable,
                                CreateDate = cpinf.Key.CreateDate,
                            }).ToList()
                        }
                    }
                };
            }
            return(oReturn);
        }