コード例 #1
0
        protected void btnMsgReply_Click(object sender, EventArgs e)
        {
            VendorMessageDetails objVenMsgDet = new VendorMessageDetails();
            objVenMsgDet.VendorMessageId = 0;
            objVenMsgDet.VendorId = Convert.ToInt32(hdnVendorId.Value.ToString());
            objVenMsgDet.SendCustomerId = Convert.ToInt32(hdnCustomerId.Value.ToString());
            objVenMsgDet.QuiryId = Convert.ToInt32(hdnQuoteId.Value.ToString());
            objVenMsgDet.CategoryId = Convert.ToInt32(hdnCategoryId.Value.ToString());
            objVenMsgDet.MessageTitle =  txtReplySubject.Text.Trim();
            objVenMsgDet.Description = txtMsgReply.Text.Trim();
            objVenMsgDet.Status = "1";

            objService = new ServeAtDoorstepService();
            int i = objService.AddVendorMessage(objVenMsgDet);

            this.ModalPopupReply.Hide();
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 public int AddVendorMessage(VendorMessageDetails vendorMsgDetails)
 {
     try
     {
         DALComponent objDALVenMsg = new DALComponent();
         objDALVenMsg.SetParameters("@VendorMessageId", SqlDbType.Int, 4, vendorMsgDetails.VendorMessageId);
         objDALVenMsg.SetParameters("@QuiryId", SqlDbType.Int, 4, vendorMsgDetails.QuiryId);
         objDALVenMsg.SetParameters("@SendCustomerId", SqlDbType.Int, 4, vendorMsgDetails.SendCustomerId);
         objDALVenMsg.SetParameters("@VendorId", SqlDbType.Int, 4, vendorMsgDetails.VendorId);
         objDALVenMsg.SetParameters("@CategoryId", SqlDbType.Int, 4, vendorMsgDetails.CategoryId);
         objDALVenMsg.SetParameters("@MessageTitle", SqlDbType.VarChar, 100, vendorMsgDetails.MessageTitle);
         objDALVenMsg.SetParameters("@Description", SqlDbType.VarChar, 1000, vendorMsgDetails.Description);
         objDALVenMsg.SetParameters("@Status", SqlDbType.VarChar, 10, vendorMsgDetails.Status);
         objDALVenMsg.SetParameters("@idvalue", SqlDbType.Int, true);
         objDALVenMsg.SqlCommandText = "[CreateVendorMessage]";
         int x = objDALVenMsg.CreateRecord();
         object y = objDALVenMsg.GetParameters("@idvalue");
         if (vendorMsgDetails.VendorMessageId != 0)
             return vendorMsgDetails.VendorMessageId;
         else
             return Int32.Parse(y.ToString());
     }
     catch (SqlException sqlEx)
     {
         throw new ApplicationException("Data error=" + sqlEx.Message.ToString());
     }
     catch (Exception ex)
     {
         throw new ApplicationException("Error=" + ex.Message.ToString());
     }
 }