public string AddAdImageDetails(AdImageDetails adimageDetails)
        {
            try
            {
                /*string[] strImg = new string[5];
                HttpPostedFile postedFile = strImg[0] as HttpPostedFile;
                strImg = adimageDetails.ImagePath.Split(':');
                string path = string.Empty;
                string strImgFinalPath = "";
                string finalPath = string.Empty;
                string filePath = string.Empty;
                int userId = 0;// Convert.ToInt32(Session["UserId"].ToString());
                string sFilename = "";
                if (FileUpload1.PostedFile != null)
                {
                    HttpPostedFile myFile = FileUpload1.PostedFile;
                    int nFileLen = myFile.ContentLength;
                    if (nFileLen != 0)
                    {
                        DirectoryInfo dirInfo = null;
                        fileSavePath = "/Data/TS_" + userId + "/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;
                    }
                }*/
                DALComponent objDAL = new DALComponent();
                objDAL.SetParameters("@imageId", SqlDbType.Int, 4, adimageDetails.ImageId);
                objDAL.SetParameters("@adpostId", SqlDbType.Int, 4, adimageDetails.AdPostId);
                objDAL.SetParameters("@imagePath", SqlDbType.VarChar, 1000, adimageDetails.ImagePath);
                objDAL.SetParameters("@videoLink", SqlDbType.VarChar, 1000, adimageDetails.VideoLink);
                objDAL.SetParameters("@idvalue", SqlDbType.Int, true);

                objDAL.SqlCommandText = "CreateAdImageDetails";
                int x = objDAL.CreateRecord();

                object y = objDAL.GetParameters("@idvalue");

                return y.ToString();
            }
            catch (SqlException sqlEx)
            {
                return sqlEx.Message.ToString();
            }
            catch (Exception ex)
            {
                return ex.Message.ToString();
            }
        }
        public int AddAdPost(AdPostDetails adpostDetails)
        {
            try
            {
                DALComponent objDAL = new DALComponent();
                objDAL.SetParameters("@adpostId", SqlDbType.Int, 4, adpostDetails.AdPostId);
                objDAL.SetParameters("@adpostTitle", SqlDbType.VarChar, 500, adpostDetails.AdPostTitle);
                objDAL.SetParameters("@description", SqlDbType.VarChar, 1000, adpostDetails.Description);
                objDAL.SetParameters("@keywords", SqlDbType.VarChar, 1000, adpostDetails.Keywords);
                objDAL.SetParameters("@userId", SqlDbType.Int, 4, adpostDetails.UserId);
                objDAL.SetParameters("@categoryId", SqlDbType.Int, 4, adpostDetails.CategoryId);
                objDAL.SetParameters("@price", SqlDbType.Decimal, 9, Convert.ToDecimal(adpostDetails.Price));
                objDAL.SetParameters("@stateId", SqlDbType.Int, 4, adpostDetails.StateId);
                objDAL.SetParameters("@cityId", SqlDbType.Int, 4, adpostDetails.CityId);
                objDAL.SetParameters("@countryId", SqlDbType.Int, 4, adpostDetails.CountryId);
                objDAL.SetParameters("@zipCode", SqlDbType.VarChar, 50, adpostDetails.ZipCode);
                objDAL.SetParameters("@adtillDate", SqlDbType.SmallDateTime, 4, adpostDetails.AdTillDate);
                objDAL.SetParameters("@adStatus", SqlDbType.VarChar, 50, adpostDetails.AdStatus);
                objDAL.SetParameters("@paidStatus", SqlDbType.Int, 4, adpostDetails.PaidStatus);
                objDAL.SetParameters("@idvalue", SqlDbType.Int, true);

                objDAL.SqlCommandText = "CreateAdPost";
                int x = objDAL.CreateRecord();

                object y = objDAL.GetParameters("@idvalue");

                if (adpostDetails.AdPostId != 0)
                    return adpostDetails.AdPostId;
                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());
            }
        }