public ActionResult SavePropertyInformation(PropertyInformation model)
        {
            var  serialization = new Serialization();
            var  listingsBA    = new Listings();
            long listingID     = 0;

            if (ModelState.IsValid)
            {
                var HashCriteria   = SetHashCriteriaForPropertyInformation(model);
                var actualCriteria = serialization.SerializeBinary((object)HashCriteria);

                var result = listingsBA.SavePropertyInformation(actualCriteria);
                listingID = Convert.ToInt64(serialization.DeSerializeBinary(Convert.ToString(result)));
            }
            else
            {
                PropertyInformation propertyInformation = new PropertyInformation();
                var result = listingsBA.GetListingDefaultValuesForPropertyInformation();
                propertyInformation = (PropertyInformation)(serialization.DeSerializeBinary(Convert.ToString(result)));
                return(PartialView("_PropertyAndBorrowerInfo", propertyInformation));
            }
            string ListingID  = CipherTool.EncryptString(Convert.ToString(listingID), true);
            var    jsonResult = new[] {
                new { ListingID = ListingID, ID = listingID },
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
        public ActionResult SaveCommentsInformation(CommentsInformation model)
        {
            var  serialization = new Serialization();
            var  listingsBA    = new Listings();
            long listingID     = 0;

            if (ModelState.IsValid)
            {
                Hashtable HashCriteria = new Hashtable();
                HashCriteria.Add("ListingID", model.ID);
                HashCriteria.Add("Comments", model.Comments);
                HashCriteria.Add("IsSellerOffering", model.IsSellerOffering);
                HashCriteria.Add("SellerOfferingPercentage", model.SellerOfferingPercentage);
                HashCriteria.Add("UserID", userID);
                var actualCriteria = serialization.SerializeBinary((object)HashCriteria);
                var result         = listingsBA.SaveCommentsInformation(actualCriteria);
                listingID = Convert.ToInt64(serialization.DeSerializeBinary(Convert.ToString(result)));
            }
            else
            {
                return(PartialView("_Comments", model));
            }
            var ListingID  = CipherTool.EncryptString(Convert.ToString(listingID), true);
            var jsonResult = new[] {
                new { ListingID = ListingID, ID = listingID },
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
        public ActionResult SaveLoanInformation(LoanInformation model)
        {
            var serialization = new Serialization();

            var  listingsBA = new Listings();
            long listingID  = 0;

            if (Request.Form["ginfo-hdn"] != null && Request.Form["ginfo-hdn"] != "")
            {
                JavaScriptSerializer js = new JavaScriptSerializer();
                model.GuarantorInformation = js.Deserialize <List <GuarantorInformation> >(Request.Form["ginfo-hdn"]);
            }

            if (model.IsCompany)
            {
                ModelState.Remove("PrimaryBorrowerFirstName");
                ModelState.Remove("LastName");
            }
            else
            {
                ModelState.Remove("CompanyName");
            }
            if (ModelState.IsValid)
            {
                var HashCriteria   = SetHashCriteriaForLoanInformation(model);
                var actualCriteria = serialization.SerializeBinary((object)HashCriteria);
                var result         = listingsBA.SaveLoanInformation(actualCriteria);
                listingID = Convert.ToInt64(serialization.DeSerializeBinary(Convert.ToString(result)));
            }
            else
            {
                LoanInformation loanInformation = new LoanInformation();
                var             result          = listingsBA.GetListingDefaultValuesForLoanInformation();
                loanInformation                      = (LoanInformation)(serialization.DeSerializeBinary(Convert.ToString(result)));
                loanInformation.ListingType          = GetListingLoanType();
                loanInformation.IsGuaranteed         = model.IsGuaranteed;
                loanInformation.GuarantorInformation = model.GuarantorInformation;
                loanInformation.IsCompany            = model.IsCompany;
                //loanInformation.PrimaryBorrowerFirstName = model.PrimaryBorrowerFirstName;
                //loanInformation.LastName = model.LastName;

                return(PartialView("_LoanInformation", loanInformation));
            }
            string ListingID  = CipherTool.EncryptString(Convert.ToString(listingID), true);
            var    jsonResult = new[] {
                new { ListingID = ListingID, ID = listingID },
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
        public ActionResult ChangePasswordPost(string Email, string Password)
        {
            var loginBA        = new Login();
            var HashCriteria   = new Hashtable();
            var serialization  = new Serialization();
            var actualCriteria = string.Empty;

            HashCriteria.Add("Email", Email);
            var password = CipherTool.EncryptString(Convert.ToString(Password), false);

            HashCriteria.Add("Password", password);
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var result = loginBA.ChangePassword(actualCriteria);

            result = Convert.ToString(serialization.DeSerializeBinary(Convert.ToString(result)));
            if (Convert.ToString(Synoptek.SessionController.UserSession.UserId) == null)
            {
                SessionController.UserSession.EmailAddress = null;
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }