Пример #1
0
        public HttpResponseMessage SaveOrderEntry([FromBody] OrderEntryDetailRequest request)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Please provide all the required fields."));
            }


            return(Request.CreateResponse(HttpStatusCode.OK, _orderEntryServices.SaveOrderEntry(request)));
        }
        private XmlElement GetBorrowerList(OrderEntryDetailRequest request)
        {
            XmlDocument xmlDoc      = new XmlDocument();
            XmlElement  rootElement = xmlDoc.CreateElement("BorrowerList");

            if (request.BorrowerList != null && request.BorrowerList.Count > 0)
            {
                foreach (var item in request.BorrowerList)
                {
                    XmlElement tableElement = xmlDoc.CreateElement("Borrowers");

                    XmlAttribute columnAttribute1  = GetAttribute("OrderNo", item.OrderNo.ToString(), xmlDoc);
                    XmlAttribute columnAttribute2  = GetAttribute("EnteredBy", item.EnteredBy, xmlDoc);
                    XmlAttribute columnAttribute3  = GetAttribute("LastModBy", item.LastModBy, xmlDoc);
                    XmlAttribute columnAttribute4  = GetAttribute("Type", item.Type, xmlDoc);
                    XmlAttribute columnAttribute5  = GetAttribute("FullName", item.FullName, xmlDoc);
                    XmlAttribute columnAttribute6  = GetAttribute("HomePhone", item.HomePhone, xmlDoc);
                    XmlAttribute columnAttribute7  = GetAttribute("CellPhone", item.CellPhone, xmlDoc);
                    XmlAttribute columnAttribute8  = GetAttribute("Email", item.Email, xmlDoc);
                    XmlAttribute columnAttribute9  = GetAttribute("SSN", item.SSN, xmlDoc);
                    XmlAttribute columnAttribute10 = GetAttribute("MaritalStatusId", item.MaritalStatusId.ToString(), xmlDoc);
                    XmlAttribute columnAttribute11 = GetAttribute("FirstName", item.FirstName, xmlDoc);
                    XmlAttribute columnAttribute12 = GetAttribute("LastName", item.LastName, xmlDoc);
                    XmlAttribute columnAttribute13 = GetAttribute("Password", item.Password, xmlDoc);

                    tableElement.Attributes.Append(columnAttribute1);
                    tableElement.Attributes.Append(columnAttribute2);
                    tableElement.Attributes.Append(columnAttribute3);
                    tableElement.Attributes.Append(columnAttribute4);
                    tableElement.Attributes.Append(columnAttribute5);
                    tableElement.Attributes.Append(columnAttribute6);
                    tableElement.Attributes.Append(columnAttribute7);
                    tableElement.Attributes.Append(columnAttribute8);
                    tableElement.Attributes.Append(columnAttribute9);
                    tableElement.Attributes.Append(columnAttribute10);
                    tableElement.Attributes.Append(columnAttribute11);
                    tableElement.Attributes.Append(columnAttribute12);
                    tableElement.Attributes.Append(columnAttribute13);

                    rootElement.AppendChild(tableElement);
                }
            }

            return(rootElement);
        }
        private XmlElement GetTransactionTypeList(OrderEntryDetailRequest request)
        {
            XmlDocument xmlDoc      = new XmlDocument();
            XmlElement  rootElement = xmlDoc.CreateElement("TransactionTypeList");

            if (request.TransactionTypeList != null && request.TransactionTypeList.Count > 0)
            {
                foreach (var item in request.TransactionTypeList)
                {
                    XmlElement tableElement = xmlDoc.CreateElement("TransactionTypes");

                    XmlAttribute columnAttribute1  = GetAttribute("ClientContactId", item.ClientContactId.ToString(), xmlDoc);
                    XmlAttribute columnAtrribute2  = GetAttribute("ProductCode", item.ProductCode, xmlDoc);
                    XmlAttribute columnAtrribute3  = GetAttribute("ProductCategory", item.ProductCategory, xmlDoc);
                    XmlAttribute columnAtrribute4  = GetAttribute("BranchId", item.BranchId, xmlDoc);
                    XmlAttribute columnAtrribute5  = GetAttribute("ClientRefNo", item.ClientRefNo, xmlDoc);
                    XmlAttribute columnAtrribute6  = GetAttribute("Status", item.Status, xmlDoc);
                    XmlAttribute columnAtrribute7  = GetAttribute("ManualAssignEnabled", item.ManualAssignEnabled.ToString(), xmlDoc);
                    XmlAttribute columnAtrribute8  = GetAttribute("ShowOnOrderWIP", item.ShowOnOrderWIP.ToString(), xmlDoc);
                    XmlAttribute columnAtrribute9  = GetAttribute("ClientBundleID", item.ClientBundleID.ToString(), xmlDoc);
                    XmlAttribute columnAtrribute10 = GetAttribute("BundleDetailsID", item.BundleDetailsID.ToString(), xmlDoc);
                    XmlAttribute columnAtrribute11 = GetAttribute("Ordered", item.Ordered.ToString(), xmlDoc);

                    tableElement.Attributes.Append(columnAttribute1);
                    tableElement.Attributes.Append(columnAtrribute2);
                    tableElement.Attributes.Append(columnAtrribute3);
                    tableElement.Attributes.Append(columnAtrribute4);
                    tableElement.Attributes.Append(columnAtrribute5);
                    tableElement.Attributes.Append(columnAtrribute6);
                    tableElement.Attributes.Append(columnAtrribute7);
                    tableElement.Attributes.Append(columnAtrribute8);
                    tableElement.Attributes.Append(columnAtrribute9);
                    tableElement.Attributes.Append(columnAtrribute10);
                    tableElement.Attributes.Append(columnAtrribute11);

                    rootElement.AppendChild(tableElement);
                }
            }

            return(rootElement);
        }
        public int SaveOrderEntry(OrderEntryDetailRequest request)
        {
            foreach (BorrowersEntity item in request.BorrowerList)
            {
                if (item.SSN != "")
                {
                    item.SSN = EncryptDecrypt.EncryptString(item.SSN);
                }
                item.Password = EncryptDecrypt.EncryptString("YW_" + item.LastName);
            }

            XmlElement listElement1 = GetTransactionTypeList(request);
            XmlElement listElement2 = GetBorrowerList(request);

            int orderNo = _unitOfWork.SaveOrderEntry(request.EnteredBy, request.OrderSource, request.OrderOrigination, request.ClientId, request.HaveAddress,
                                                     request.HaveZip, request.StreetNo, request.StreetName, request.Address2, request.City, request.State, request.Zip, request.County,
                                                     request.LoanNo, request.LoanAmount, request.LoanType, request.PropertyType, request.Note, request.ContactType, request.ContactName,
                                                     listElement1.OuterXml, listElement2.OuterXml);

            return(orderNo);
        }