Example #1
0
        public DocumentsInformation GetDocumentInformationDetails(Hashtable listingCriteria)
        {
            var _db  = new DBUtility();
            var temp = new DocumentsInformation();
            var _dt  = new DataTable();

            _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "GP_SP_GetDocumentInformationDetails";

            _cmd.Parameters.AddWithValue("@UserId", Convert.ToString(listingCriteria["UserID"]));
            _cmd.Parameters.AddWithValue("@ListingDetailsID", Convert.ToInt64(listingCriteria["ID"]));

            _dt = _db.FillDataTable(_cmd, _dt);
            if (_dt.Rows.Count > 0)
            {
                foreach (DataRow dr in _dt.Rows)
                {
                    temp.ID = Convert.ToInt64(dr["ID"]);
                    temp.ListingStatusID  = Convert.ToInt32(dr["ListingStatusID"]);
                    temp.IsSponsored      = Convert.ToBoolean(dr["IsSponsored"]);
                    temp.ChainAssignments = Convert.ToInt32(dr["ChainAssignments"]);
                }
            }
            return(temp);
        }
        public ActionResult SaveDocumentsInformation(DocumentsInformation model)
        {
            var  serialization = new Serialization();
            var  listingsBA    = new Listings();
            long listingID     = 0;

            if (ModelState.IsValid)
            {
                var HashCriteria   = SetHashCriteriaForDocumentInformation(model);
                var actualCriteria = serialization.SerializeBinary((object)HashCriteria);
                var result         = listingsBA.SaveDocumentsInformation(actualCriteria);
                listingID = Convert.ToInt64(serialization.DeSerializeBinary(Convert.ToString(result)));
                SaveListingDocuments(Convert.ToInt64(listingID));
                SaveListingImages(Convert.ToInt64(listingID));
                Session["ListingDocuments"] = null;
                Session["ListingImages"]    = null;
            }
            else
            {
                return(PartialView("_Documents", model));
            }
            string ListingID  = Synoptek.SessionManagement.CipherTool.EncryptString(Convert.ToString(listingID), true);
            var    jsonResult = new[] {
                new { ListingID = ListingID, ID = listingID },
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
        private Hashtable SetHashCriteriaForDocumentInformation(DocumentsInformation document)
        {
            var HashCriteria = new Hashtable();

            HashCriteria.Add("ListingID", document.ID);
            HashCriteria.Add("ListingStatusID", document.ListingStatusID);
            HashCriteria.Add("IsSponsored", document.IsSponsored);
            HashCriteria.Add("ChainAssignments", document.ChainAssignments);
            HashCriteria.Add("UserID", userID);
            return(HashCriteria);
        }
        public ActionResult EditDocumentInformation(string listingID)
        {
            var serialization    = new Serialization();
            var listingsBA       = new Listings();
            var actualCriteria   = string.Empty;
            var listingEditModel = new DocumentsInformation();
            var listing_ID       = Convert.ToInt64(CipherTool.DecryptString(listingID, true));

            var HashCriteria = new Hashtable();

            HashCriteria.Add("UserID", userID);
            HashCriteria.Add("ID", listing_ID);
            HashCriteria.Add("CurrentTab", "DocumentInformation");
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var result = listingsBA.EditCurrentListing(actualCriteria);

            listingEditModel = (DocumentsInformation)(serialization.DeSerializeBinary(Convert.ToString(result)));

            HashCriteria   = new Hashtable();
            actualCriteria = string.Empty;
            HashCriteria.Add("UserID", userID);
            HashCriteria.Add("ID", listing_ID);
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var resultDocuments = listingsBA.GetLoanDocuments(actualCriteria);

            listingEditModel.ListingLoanDocuments = (List <ListingLoanDocuments>)(serialization.DeSerializeBinary(Convert.ToString(resultDocuments)));

            HashCriteria   = new Hashtable();
            actualCriteria = string.Empty;
            HashCriteria.Add("UserID", userID);
            HashCriteria.Add("ID", listing_ID);
            actualCriteria = serialization.SerializeBinary((object)HashCriteria);
            var resultImages = listingsBA.GetLoanImages(actualCriteria);

            listingEditModel.ListingImages = (List <ListingImage>)(serialization.DeSerializeBinary(Convert.ToString(resultImages)));
            foreach (var item in listingEditModel.ListingImages)
            {
                item.ImagePath = CheckFileExists(item.FileName, "ListingImagePath", Convert.ToString(listing_ID));
            }
            Session["ListingDocuments"] = listingEditModel.ListingLoanDocuments;
            Session["ListingImages"]    = listingEditModel.ListingImages;
            return(PartialView("_Documents", listingEditModel));
        }