void LoadProfile()
        {
            objService = new ServeAtDoorstepService();
            DataTable dtVen = objService.GetCustomerById(Convert.ToInt32(sLoginId));
            if (dtVen.Rows.Count > 0)
            {
                spnCusImage.InnerHtml = "<a class='example-image-link' href='image/Vendor.jpg' data-lightbox='example-1'" +
                                    "title='Vendor'>" +
                                    "<img class='example-image' src='image/Vendor.jpg' alt='Vendor' width='150' height='150' /></a>";

                lblLoginName.Text = dtVen.Rows[0]["LoginName"].ToString();
                lblEmail.Text = dtVen.Rows[0]["VendorEmail"].ToString();
                txtVendorName.Value = dtVen.Rows[0]["VendorName"].ToString();

            //        txtFirstName.Value = dtCus.Rows[0]["FirstName"].ToString();// +" " + dtCus.Rows[0]["LastName"].ToString();
            //        txtLastName.Value = dtCus.Rows[0]["LastName"].ToString();
            //        sLoginname = dtCus.Rows[0]["LoginName"].ToString();
            //        sPassword = dtCus.Rows[0]["LoginPassword"].ToString();
            //        sImagePath = dtCus.Rows[0]["ImagePath"].ToString();
            //        txtEmail.Value = dtCus.Rows[0]["Email"].ToString();
            //        txtMobile.Value = dtCus.Rows[0]["Mobile"].ToString();
            //        rdoGender.SelectedValue = dtCus.Rows[0]["Gender"].ToString();
            //        for (int i = 0; i < ddlCountry.Items.Count; i++)
            //        {
            //            if (ddlCountry.Items[i].Text == dtCus.Rows[0]["CountryName"].ToString())
            //                ddlCountry.SelectedIndex = i;
            //        }
            //        for (int i = 0; i < ddlState.Items.Count; i++)
            //        {
            //            if (ddlState.Items[i].Text == dtCus.Rows[0]["StateName"].ToString())
            //                ddlState.SelectedIndex = i;
            //        }
            //        string sState = dtCus.Rows[0]["StateName"].ToString();
            //        string sStateId = dtCus.Rows[0]["StateId"].ToString();
            //        DataTable dtCy = objService.SelectCityByStateId(Convert.ToInt32(sStateId));
            //        ddlCity.Items.Clear();
            //        ListItem listItem = new ListItem();
            //        listItem.Text = "<Select City>";
            //        listItem.Value = "0";
            //        ddlCity.Items.Add(listItem);
            //        for (int i = 0; i < dtCy.Rows.Count; i++)
            //        {
            //            listItem = new ListItem();
            //            listItem.Text = dtCy.Rows[i]["CityName"].ToString();
            //            listItem.Value = dtCy.Rows[i]["CityId"].ToString();
            //            ddlCity.Items.Add(listItem);
            //        }
            //        for (int i = 0; i < ddlCity.Items.Count; i++)
            //        {
            //            if (ddlCity.Items[i].Text == dtCus.Rows[0]["CityName"].ToString())
            //                ddlCity.SelectedIndex = i;
            //        }
            //        txtAddress.Value = dtCus.Rows[0]["Address"].ToString();
            //        txtStreetname.Value = dtCus.Rows[0]["StreetName"].ToString();
            //        txtZipcode.Value = dtCus.Rows[0]["ZipCode"].ToString();
            //        sBankId = dtCus.Rows[0]["BankId"].ToString();

            //        hdnAddress.Value = dtCus.Rows[0]["CityName"].ToString().Trim() + ", " + dtCus.Rows[0]["StateName"].ToString() + ", US";
            }
        }
        protected void btnPost_Click(object sender, EventArgs e)
        {
            #region .. VALIDATION ..

            int intError = 0;
            string strErrorMsg = "";
            if (txtQuoteTitle.Value.ToString() == "")
            {
                strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;Quiry Title should not be empty. <br/>";
                intError++;
            }
            if (ddlCategory.SelectedIndex == 0)
            {
                strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;Please Select Category. <br/>";
                intError++;
            }
            if (FileUpload1.PostedFile.ContentLength == 0 || Request.Form["fileName1"] == null)
            {
                strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;Please Upload atleast one image. <br/>";
                intError++;
            }
            if (FileUpload1.PostedFile != null)
            {
                if (FileUpload1.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUpload1.PostedFile.FileName + " Exceeds maximum limit 50 KB. <br/>";
                    intError++;
                }
            }
            if (FileUpload2.PostedFile != null)
            {
                if (FileUpload2.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUpload2.PostedFile.FileName + " Exceeds maximum limit 50 KB. <br/>";
                    intError++;
                }
            }
            if (FileUpload3.PostedFile != null)
            {
                if (FileUpload3.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUpload3.PostedFile.FileName + " Exceeds maximum limit 50 KB. <br/>";
                    intError++;
                }
            }
            if (FileUpload4.PostedFile != null)
            {
                if (FileUpload4.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUpload4.PostedFile.FileName + " Exceeds maximum limit 50 KB. <br/>";
                    intError++;
                }
            }
            if (FileUpload5.PostedFile != null)
            {
                if (FileUpload5.PostedFile.ContentLength > (50 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUpload5.PostedFile.FileName + " Exceeds maximum limit 50 KB. <br/>";
                    intError++;
                }
            }

            if (FileUploadVid.PostedFile != null)
            {
                if (FileUploadVid.PostedFile.ContentLength > (500 * 1024))
                {
                    strErrorMsg += "&nbsp;&nbsp;<img src='image/error.jpg' height='40px' width='40px' />&nbsp;&nbsp;" + FileUploadVid.PostedFile.FileName + " Exceeds maximum limit 500 KB. <br/>";
                    intError++;
                }
            }
            #endregion

            if (intError == 0)
            {
                InquiryDetails objQuiry = new InquiryDetails();
                objQuiry.InquiryID = 0;
                objQuiry.InquiryTitle = txtQuoteTitle.Value.ToString();
                objQuiry.Description = txtQuoteDesc.Value.ToString();
                objQuiry.Keywords = "";// txtQuoteKey.Value.ToString();
                objQuiry.CategoryId = Convert.ToInt32(ddlCategory.Value.ToString());
                objQuiry.CustomerId = Convert.ToInt32(Session["LoginId"].ToString());
                objQuiry.CityId = 0;
                objQuiry.ImagePath = "";
                objQuiry.VideoPath = "";

                objService = new ServeAtDoorstepService();
                int intQuoId = objService.AddInquiryDetails(objQuiry);

                #region .. CREATE INQUIRY IMAGE ..

                string path = string.Empty;
                string strImgFinalPath = "";
                string finalPath = string.Empty;
                string filePath = string.Empty;
                int iLoginId = Convert.ToInt32(Session["LoginId"].ToString());
                string sFilename = "";
                if (FileUpload1.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload1.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        DirectoryInfo dirInfo = null;
                        fileSavePath = "/Data/IQU_" + iLoginId + "_" + intQuoId + "/Images/";
                        path = Server.MapPath("~" + fileSavePath);
                        if (!Directory.Exists(path))
                        {
                            dirInfo = Directory.CreateDirectory(path);
                        }
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload1.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                    }
                }
                strImgFinalPath = finalPath;

                if (FileUpload2.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload2.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        path = Server.MapPath("~" + fileSavePath);
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload2.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);

                        strImgFinalPath = strImgFinalPath + ":" + finalPath;
                    }
                }

                if (FileUpload3.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload3.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        path = Server.MapPath("~" + fileSavePath);
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload3.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                        strImgFinalPath = strImgFinalPath + ":" + finalPath;
                    }
                }

                if (FileUpload4.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload4.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        path = Server.MapPath("~" + fileSavePath);
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload4.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                        strImgFinalPath = strImgFinalPath + ":" + finalPath;
                    }
                }

                if (FileUpload5.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload5.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        path = Server.MapPath("~" + fileSavePath);
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUpload5.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                        strImgFinalPath = strImgFinalPath + ":" + finalPath;
                    }
                }

                sFilename = ""; finalPath = "";
                if (FileUploadVid.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUploadVid.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        DirectoryInfo dirInfo = null;
                        fileSavePath = "/Data/IQU_" + iLoginId + "_" + intQuoId + "/Video/";
                        path = Server.MapPath("~" + fileSavePath);
                        if (!Directory.Exists(path))
                        {
                            dirInfo = Directory.CreateDirectory(path);
                        }
                        sFilename = System.IO.Path.GetFileName(myFile.FileName);
                        path = path + "/" + sFilename;
                        FileUploadVid.PostedFile.SaveAs(path);

                        finalPath = Path.Combine(fileSavePath, sFilename);
                    }
                }
                string strVidFinalPath = finalPath;

                InquiryDetails objIQ = new InquiryDetails();
                objIQ.InquiryID = intQuoId;
                objIQ.ImagePath = strImgFinalPath;
                objIQ.VideoPath = strVidFinalPath;

                objService.UpdateInquiryImages(objIQ);

                #endregion

                #region .. GET CUSTOMER CITY AND ZIPCODE ..

                string strCusCity = "";
                string strCusZipcode = "";
                string strVACity = "";
                string strVAZipcode = "";
                DataTable dtCus = objService.GetCustomerById(Convert.ToInt32(Session["LoginId"].ToString()));
                if (dtCus.Rows.Count > 0)
                {
                    strCusCity = dtCus.Rows[0]["CityName"].ToString();
                    strCusZipcode = dtCus.Rows[0]["ZipCode"].ToString();
                }

                #endregion

                DataTable dt = objService.SelectVendorByCategory(objQuiry.CategoryId);
                if (dt.Rows.Count > 0)
                {
                    for (int intVen = 0; intVen < dt.Rows.Count; intVen++)
                    {
                        string sVenEmail = dt.Rows[intVen]["VendorEmail"].ToString();

                        #region .. GET VENDOR AREA ..
                        strVACity = "";
                        strVAZipcode = "";
                        DataTable dtVenArea = objService.SelectAreaByVendorId(Convert.ToInt32(dt.Rows[intVen]["VendorID"].ToString()));
                        if (dtVenArea.Rows.Count > 0)
                        {

                            for (int k = 0; k < dtVenArea.Rows.Count; k++)
                            {
                                strVACity = dtVenArea.Rows[k]["VACityName"].ToString();
                                strVAZipcode = dtVenArea.Rows[k]["VAZipcode"].ToString();

                                if (strVAZipcode == strCusZipcode)
                                {
                                    VendorMessageDetails objVenMsgDet = new VendorMessageDetails();
                                    objVenMsgDet.VendorMessageId = 0;
                                    objVenMsgDet.VendorId = Convert.ToInt32(dt.Rows[intVen]["VendorID"].ToString());
                                    objVenMsgDet.SendCustomerId = objQuiry.CustomerId;
                                    objVenMsgDet.QuiryId = intQuoId;
                                    objVenMsgDet.CategoryId = Convert.ToInt32(objQuiry.CategoryId);
                                    objVenMsgDet.MessageTitle = txtQuoteTitle.Value.ToString();
                                    objVenMsgDet.Description = txtQuoteDesc.Value.ToString();
                                    objVenMsgDet.Status = "0";

                                    int intVenMsg = objService.AddVendorMessage(objVenMsgDet);
                                }
                            }
                        }

                        #endregion

                    }
                }

                divErrorMessage.InnerHtml = "";
                divMessage.InnerHtml = "Your Inquiry posted sucessfully.";

                txtQuoteTitle.Value = "";
                txtQuoteDesc.Value = "";
                ddlCategory.SelectedIndex = 0;
            }
            else
            {
                divErrorMessage.InnerHtml = strErrorMsg;
            }
        }
        void LoadProfile()
        {
            objService = new ServeAtDoorstepService();
            DataTable dtCus = objService.GetCustomerById(Convert.ToInt32(sLoginId));
            sCustomerId = sLoginId;
            if (dtCus.Rows.Count > 0)
            {
                spnCusImage.InnerHtml = "<a class='example-image-link' href='" + dtCus.Rows[0]["ImagePath"].ToString() + "' data-lightbox='example-1'" +
                                    "title='Or press the right arrow on your keyboard.'>" +
                                    "<img class='example-image' src='" + dtCus.Rows[0]["ImagePath"].ToString() + "' alt='Plants: image 2 0f 4 thumb' width='150' height='150' /></a>";

                lblCusName.Text = dtCus.Rows[0]["FirstName"].ToString() + " " + dtCus.Rows[0]["LastName"].ToString();
                lblCusLogName.Text = dtCus.Rows[0]["LoginName"].ToString();
                lblCusLogPwd.Text = dtCus.Rows[0]["LoginPassword"].ToString();
                lblCusEmail.Text = dtCus.Rows[0]["Email"].ToString();
                lblCusMobile.Text = dtCus.Rows[0]["Mobile"].ToString();
                string sGender = dtCus.Rows[0]["Gender"].ToString();
                if (sGender == "0")
                    lblCusGender.Text = "Rather not say";
                else if (sGender == "1")
                    lblCusGender.Text = "Male";
                else if (sGender == "2")
                    lblCusGender.Text = "Female";
                lblCusState.Text = dtCus.Rows[0]["StateName"].ToString();
                lblCusCity.Text = dtCus.Rows[0]["CityName"].ToString();
                lblCusCountry.Text = dtCus.Rows[0]["CountryName"].ToString();
                lblCusAddr.Text = dtCus.Rows[0]["Address"].ToString();
                lblCusStreet.Text = dtCus.Rows[0]["StreetName"].ToString();
                lblCusZip.Text = dtCus.Rows[0]["ZipCode"].ToString();
                sBankId = dtCus.Rows[0]["BankId"].ToString();
                lblBankName.Text = dtCus.Rows[0]["BankName"].ToString();
                lblCardNo.Text = dtCus.Rows[0]["CreditCardNumber"].ToString();
                lblHolderName.Text = dtCus.Rows[0]["CardHolderName"].ToString();
                lblCVC.Text = dtCus.Rows[0]["CVCNumber"].ToString();

                hdnAddress.Value = dtCus.Rows[0]["CityName"].ToString().Trim() + ", " + dtCus.Rows[0]["StateName"].ToString() + ", US";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            isShowHideControl = "0";
            lblWelcomeMsg.Visible = false;
            lblDashboard.Visible = false;
            btnPostButton.Visible = false;

            if (Request.Cookies["LoginType"] != null)
            {
                Session.Add("LoginType", Request.Cookies["LoginType"].Value.ToString());
            }
            if (Request.Cookies["LoginId"] != null)
            {
                Session.Add("LoginId", Request.Cookies["LoginId"].Value.ToString());
            }

            if (Session["LoginId"] != null && (Session["LoginType"] != null && Session["LoginType"].ToString() == "3"))
            {
                lblWelcomeMsg.Visible = true;
                lblDashboard.Visible = true;
                btnPostButton.Visible = false;
                isShowHideControl = "3"; // Admin
            }
            else if (Session["LoginId"] != null && (Session["LoginType"] != null && Session["LoginType"].ToString() == "2"))
            {
                lblWelcomeMsg.Visible = true;
                lblDashboard.Visible = true;
                btnPostButton.Visible = false;
                isShowHideControl = "2"; // Vendor
            }
            else if (Session["LoginId"] != null && (Session["LoginType"] != null && Session["LoginType"].ToString() == "1"))
            {
                lblWelcomeMsg.Visible = true;
                lblDashboard.Visible = true;
                btnPostButton.Visible = true;
                isShowHideControl = "1"; // Customer
            }

            if (Session["LoginId"] != null)
                strLoginId = Session["LoginId"].ToString();
            if (Session["LoginType"] != null)
                strLoginType = Session["LoginType"].ToString();

            if(strLoginType == "1")
            {
                objService = new ServeAtDoorstepService();
                DataTable dt = objService.GetCustomerById(Convert.ToInt32(strLoginId));
                if (dt.Rows.Count > 0)
                {
                    strLoginName = dt.Rows[0]["LoginName"].ToString();
                }

                lblWelcomeMsg.Text = "Welcome " + strLoginName;
            }
            else if (strLoginType == "2")
            {
                objService = new ServeAtDoorstepService();
                DataTable dt = objService.GetVendorById(Convert.ToInt32(strLoginId));
                if (dt.Rows.Count > 0)
                {
                    strLoginName = dt.Rows[0]["LoginName"].ToString();
                }

                lblWelcomeMsg.Text = "Welcome " + strLoginName;
            }
            else if (strLoginType == "3")
            {
                lblWelcomeMsg.Text = "Welcome Admin";

            }
        }
        void LoadProfile()
        {
            objService = new ServeAtDoorstepService();
            DataTable dtCus = objService.GetCustomerById(Convert.ToInt32(sLoginId));
            if (dtCus.Rows.Count > 0)
            {
                spnCusImage.InnerHtml = "<a class='example-image-link' href='" + dtCus.Rows[0]["ImagePath"].ToString() + "' data-lightbox='example-1'" +
                                    "title='Or press the right arrow on your keyboard.'>" +
                                    "<img class='example-image' src='" + dtCus.Rows[0]["ImagePath"].ToString() + "' alt='Plants: image 2 0f 4 thumb' width='150' height='150' /></a>";

                txtFirstName.Value = dtCus.Rows[0]["FirstName"].ToString();// +" " + dtCus.Rows[0]["LastName"].ToString();
                txtLastName.Value = dtCus.Rows[0]["LastName"].ToString();
                lblLoginName.Text = dtCus.Rows[0]["LoginName"].ToString();
                sLoginname = dtCus.Rows[0]["LoginName"].ToString();
                sPassword = dtCus.Rows[0]["LoginPassword"].ToString();
                sImagePath = dtCus.Rows[0]["ImagePath"].ToString();
                lblEmail.Text = dtCus.Rows[0]["Email"].ToString();
                txtEmail.Value = dtCus.Rows[0]["Email"].ToString();
                txtMobile.Value = dtCus.Rows[0]["Mobile"].ToString();
                rdoGender.SelectedValue = dtCus.Rows[0]["Gender"].ToString();
                for (int i = 0; i < ddlCountry.Items.Count; i++)
                {
                    if (ddlCountry.Items[i].Text == dtCus.Rows[0]["CountryName"].ToString())
                        ddlCountry.SelectedIndex = i;
                }
                for (int i = 0; i < ddlState.Items.Count; i++)
                {
                    if (ddlState.Items[i].Text == dtCus.Rows[0]["StateName"].ToString())
                        ddlState.SelectedIndex = i;
                }
                string sState = dtCus.Rows[0]["StateName"].ToString();
                string sStateId = dtCus.Rows[0]["StateId"].ToString();
                DataTable dtCy = objService.SelectCityByStateId(Convert.ToInt32(sStateId));
                ddlCity.Items.Clear();
                ListItem listItem = new ListItem();
                listItem.Text = "<Select City>";
                listItem.Value = "0";
                ddlCity.Items.Add(listItem);
                for (int i = 0; i < dtCy.Rows.Count; i++)
                {
                    listItem = new ListItem();
                    listItem.Text = dtCy.Rows[i]["CityName"].ToString();
                    listItem.Value = dtCy.Rows[i]["CityId"].ToString();
                    ddlCity.Items.Add(listItem);
                }
                for (int i = 0; i < ddlCity.Items.Count; i++)
                {
                    if (ddlCity.Items[i].Text == dtCus.Rows[0]["CityName"].ToString())
                        ddlCity.SelectedIndex = i;
                }
                txtAddress.Value = dtCus.Rows[0]["Address"].ToString();
                txtStreetname.Value = dtCus.Rows[0]["StreetName"].ToString();
                txtZipcode.Value = dtCus.Rows[0]["ZipCode"].ToString();
                sBankId = dtCus.Rows[0]["BankId"].ToString();

                hdnAddress.Value = dtCus.Rows[0]["CityName"].ToString().Trim() + ", " + dtCus.Rows[0]["StateName"].ToString() + ", US";
            }
        }