protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session[Constants.USER_ID] == null) { Response.Redirect("../Login.aspx"); } else { DealerActions objdealeract = new DealerActions(); DataSet dsUserInfoDetails = objdealeract.DealerDefaultSellerInfo(Session[Constants.DealerCode].ToString(), Convert.ToInt32(Session[Constants.USER_ID].ToString())); //DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(UID); Session["getRegUserdata"] = dsUserInfoDetails; if (dsUserInfoDetails.Tables[1].Rows.Count>0) { if (dsUserInfoDetails.Tables[1].Rows[0][0].ToString() == "") { btnManageAccount.Enabled = false; } } DataSet dsDelaerLogo = objdealeract.GetDealerLogo(dsUserInfoDetails.Tables[0].Rows[0]["sellerID"].ToString()); if (dsDelaerLogo.Tables[0].Rows.Count > 0) { lblImage.ImageUrl = "../" + dsDelaerLogo.Tables[0].Rows[0]["LogoPath"].ToString(); imgLogo.ImageUrl = "../" + dsDelaerLogo.Tables[0].Rows[0]["LogoPath"].ToString(); } lblDealerCode.Text = Session[Constants.DealerCode].ToString(); lblDealerID1.Text = GeneralFunc.ToProper(Session[Constants.NAME].ToString()); lblDealerID.Text = Session[Constants.BusinessName].ToString(); dealerLogo.Text = Session[Constants.BusinessName].ToString().ToUpper(); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session[Constants.NAME] == null) { Response.Redirect("../login.aspx"); } else if (!IsPostBack) { Session["CarID"] = null; Session["PostingID"] = null; Session[Constants.SellerID] = null; Session["CurrentPage"] = "Home"; Session["PageName"] = ""; Session["CurrentPageConfig"] = null; // Session[Constants.NAME]; //lblDealerCode.Text = Session[Constants.DealerCode].ToString(); //lblDealerID1.Text = Session[Constants.NAME].ToString(); //lblDealerID.Text = Session[Constants.NAME].ToString(); Session["UpDatePackageID"] = null; //lblUserName.Text = Session[Constants.NAME].ToString(); if (Session ["DsDropDown"] == null) { dsDropDown = objdropdownBL.Usp_Get_DropDown(); Session["DsDropDown"] = dsDropDown; } else { dsDropDown = (DataSet)Session["DsDropDown"]; } DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(Convert.ToInt32(Session[Constants.USER_ID].ToString())); //lblDealerCode.Text Session["UpDatePackageID"] = null; //lblUserName.Text = Session[Constants.NAME].ToString(); dsDropDown = objdropdownBL.Usp_Get_DropDown(); Session["DsDropDown"] = dsDropDown; // DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserIDForRegLog(Convert.ToInt32(Session["RegUSER_ID"].ToString())); GetAllModels(); GetMakes(); GetBody(); FillYear(); FillFuelTypes(); FillStates(); FillPackage(); FillExteriorColor(); FillInteriorColor(); FillCylinders(); FillDoors(); FillTransmissions(); FillDriveTrain(); FillCondition(); DealerActions objDealerAction = new DealerActions(); DataSet dsSellerInfo = objDealerAction.DealerDefaultSellerInfo(Session[Constants.DealerCode].ToString(), Convert.ToInt32(Session[Constants.USER_ID].ToString())); Session["SellerInfo"] = dsSellerInfo; if (dsSellerInfo.Tables[0].Rows.Count > 0) { txtSellerName.Text = dsSellerInfo.Tables[0].Rows[0]["sellerName"].ToString(); //txta dsSellerInfo.Tables[0].Rows[0]["address1"] txtSellerAddress.Text = dsSellerInfo.Tables[0].Rows[0]["address1"].ToString(); txtCity.Text = dsSellerInfo.Tables[0].Rows[0]["city"].ToString(); ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(ddlLocationState.Items.FindByValue(dsSellerInfo.Tables[0].Rows[0]["state"].ToString())); txtZip.Text = dsSellerInfo.Tables[0].Rows[0]["zip"].ToString(); txtSellerPhone.Text = dsSellerInfo.Tables[0].Rows[0]["phone"].ToString(); txtSellerEmail.Text = dsSellerInfo.Tables[0].Rows[0]["email"].ToString(); chkbx.Checked = true; } if ((Session["PostingID"] != null) && (Session["PostingID"].ToString() != "")) { //btnUpdatePackage.Visible = true; //FillUpdateInfo(); } } }
protected void btnSaveCarDetails_Click(object sender, EventArgs e) { DealerActions objActions = new DealerActions(); try { DataSet dsCheckUser = objActions.DealerCheckUniqueID(txtDealerUniqueID.Text, Session[Constants.DealerCode].ToString()); if (dsCheckUser.Tables[0].Rows.Count > 0) { MdepAlertSave.Show(); lblAlertSave.Visible = true; lblAlertSave.Text = "Dealer inventory id already exist. Please enter a unique Dealer inventory id."; return; } int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString()); objUsedCarsInfo.DealerUniqueID = txtDealerUniqueID.Text; objUsedCarsInfo.YearOfMake = Convert.ToInt32(ddlYear.SelectedItem.Text); Session["SelYear"] = ddlYear.SelectedItem.Text; Session["SelMake"] = ddlMake.SelectedItem.Text; Session["SelModel"] = ddlModel.SelectedItem.Text; objUsedCarsInfo.MakeModelID = Convert.ToInt32(ddlModel.SelectedItem.Value); if (ddlStyle.SelectedItem.Value == "-1") { objUsedCarsInfo.BodytypeID = 0; } else { objUsedCarsInfo.BodytypeID = Convert.ToInt32(ddlStyle.SelectedItem.Value); } //if ((Session["CarID"] == null) || (Session["CarID"].ToString() == "")) //{ // objUsedCarsInfo.Carid = Convert.ToInt32(0); //} //else //{ // objUsedCarsInfo.Carid = Convert.ToInt32(Session["CarID"].ToString()); //} if (txtAskingPrice.Text == "") { objUsedCarsInfo.Price = 0.00; } else { objUsedCarsInfo.Price = Convert.ToDouble(txtAskingPrice.Text); } if (txtCurrentPrice.Text == "") { objUsedCarsInfo.CurrentPrice = "0"; } else { objUsedCarsInfo.CurrentPrice = txtCurrentPrice.Text; } if (txtPurchaseCost.Text == "") { objUsedCarsInfo.PurchaseCost = "0"; } else { objUsedCarsInfo.PurchaseCost = txtPurchaseCost.Text; } if (txtMileage.Text == "") { objUsedCarsInfo.Mileage = "0"; } else { objUsedCarsInfo.Mileage = txtMileage.Text; } objUsedCarsInfo.ExteriorColor = ddlExteriorColor.SelectedItem.Text; objUsedCarsInfo.InteriorColor = ddlInteriorColor.SelectedItem.Text; objUsedCarsInfo.Transmission = ddlTransmission.SelectedItem.Text; objUsedCarsInfo.NumberOfDoors = ddlDoorCount.SelectedItem.Value; objUsedCarsInfo.DriveTrain = ddlDriveTrain.SelectedItem.Value; objUsedCarsInfo.VIN = txtVin.Text; objUsedCarsInfo.NumberOfCylinder = ddlCylinderCount.SelectedItem.Value; objUsedCarsInfo.FueltypeId = Convert.ToInt32(ddlFuelType.SelectedItem.Value); objUsedCarsInfo.CurrentPrice = txtCurrentPrice.Text; objUsedCarsInfo.PurchaseCost = txtPurchaseCost.Text; if (txtZip.Text.Length == 4) { objUsedCarsInfo.Zipcode = "0" + txtZip.Text; } else { objUsedCarsInfo.Zipcode = txtZip.Text; } objUsedCarsInfo.City = GeneralFunc.ToProper(txtCity.Text); objUsedCarsInfo.State = ddlLocationState.SelectedItem.Text; string Condition = string.Empty; string CondiDescrip = string.Empty; Condition = GeneralFunc.ToProper(txtCondition.Text); string Title = txtTitle.Text; CondiDescrip = ddlCondition.SelectedItem.Text; int Isactive; int CarIDs; int FeatureID; objUsedCarsInfo.SellerName = txtSellerName.Text ; objUsedCarsInfo.Address1 = txtSellerAddress.Text; objUsedCarsInfo.City = GeneralFunc.ToProper(txtCity.Text); objUsedCarsInfo.StateID = ddlLocationState.SelectedItem.Value.ToString(); if (txtZip.Text.Length == 4) { objUsedCarsInfo.Zip = "0" + txtZip.Text; } else { objUsedCarsInfo.Zip = txtZip.Text; } objUsedCarsInfo.Phone = txtSellerPhone.Text; objUsedCarsInfo.State = ddlLocationState.SelectedItem.Text.ToString(); if (txtZip.Text.Length == 4) { objUsedCarsInfo.Zip = "0" + txtZip.Text; } else { objUsedCarsInfo.Zip = txtZip.Text; } objUsedCarsInfo.Phone = txtSellerPhone.Text; objUsedCarsInfo.Email = txtSellerEmail.Text; if ((Session[Constants.SellerID] == null) || (Session[Constants.SellerID].ToString() == "")) { objUsedCarsInfo.SellerID = Convert.ToInt32(0); } else { objUsedCarsInfo.SellerID = Convert.ToInt32(Session[Constants.SellerID].ToString()); } //CarIDs = Convert.ToInt32(Session["CarID"].ToString()); DataSet dsPackages = objActions.USP_ChkPackageForAddCar(UID); int PaymentID; //**************************************************???/// //during we need take user package from dealer package id //**************************************************???/// int UserPackID = 0; int PackageID = 0; if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); PackageID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["PackageID"].ToString()); Session["PackageID"] = PackageID; } else { dsPackages = objActions.USP_ChkExistingPackage(UID); if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); PackageID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["PackageID"].ToString()); Session["PackageID"] = PackageID; } } objUsedCarsInfo.AdStatus = resAction1.SelectedItem.Value; int PostingID; if (Session["PostingID"] == null) { PostingID = Convert.ToInt32(0); } else if (Session["PostingID"].ToString() == "") { PostingID = Convert.ToInt32(0); } else { PostingID = Convert.ToInt32(Session["PostingID"]); } PaymentID = Convert.ToInt32(0); if (PackageID == 1) { Session["isActive"] = false; } DataSet dsCarFeature = new DataSet(); DataSet dsPosting = new DataSet(); String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); DataSet dsCarsDetails = objActions.SaveCarAndSellerInfo(objUsedCarsInfo, Condition, CondiDescrip, Title, UID, UID, PackageID, PaymentID, UserPackID, PostingID, strIp, Session[Constants.DealerCode].ToString()); Session["CarID"] = Convert.ToInt32(dsCarsDetails.Tables[0].Rows[0]["CarID"].ToString()); Session["PostingID"] = dsCarsDetails.Tables[0].Rows[0]["PostingID"].ToString(); Session[Constants.SellerID] = dsCarsDetails.Tables[0].Rows[0]["sellerID"].ToString(); for (int i = 1; i < 52; i++) { if (Session["CarID"] == null) { CarIDs = 0; } else { CarIDs = Convert.ToInt32(Session["CarID"].ToString()); } string ChkBoxID = "chkFeatures" + i.ToString(); CheckBox ChkedBox = (CheckBox)form1.FindControl(ChkBoxID); if (ChkedBox.Checked == true) { Isactive = 1; } else { Isactive = 0; } FeatureID = i; dsCarFeature = objActions.USP_SaveCarFeatures(CarIDs, FeatureID, Isactive, UID); } Session["CarID"] = Convert.ToInt32(dsCarFeature.Tables[0].Rows[0]["CarID"].ToString()); //lblErrorMSg.Visible = true; //lblErrorMSg.Text = "You car Details Added"; //MpeAlert.Show(); Session["CarID"] = null; Session["PostingID"] = null; Session[Constants.SellerID] = null; Response.Redirect("PicsUpload.aspx?CarInventoryID=" + dsCarsDetails.Tables[0].Rows[0]["PostingID"].ToString() + "P" + txtDealerUniqueID.Text + ""); } catch (Exception ex) { } }
protected void btnEdit_Click(object sender, EventArgs e) { try { tbl1LblsDisplay.Style["display"] = "none"; tbl2textDisplay.Style["display"] = "table"; DealerActions objdealeract = new DealerActions(); DataSet dsCarSellerInfo = objdealeract.DealerDefaultSellerInfo(Session[Constants.DealerCode].ToString(), Convert.ToInt32(Session[Constants.USER_ID].ToString())); btnEditDetails.Visible = false; btnUpdateDetails.Visible = true; divlblRegName.Style["display"] = "none"; divtxtRegName.Style["display"] = "block"; txtregName.Text = GeneralFunc.ToProper(dsCarSellerInfo.Tables[0].Rows[0]["sellerName"].ToString()).Trim(); txtAltEmail.Text = dsCarSellerInfo.Tables[0].Rows[0]["AltEmail"].ToString(); txtAltPhone.Text = dsCarSellerInfo.Tables[0].Rows[0]["AltPhone"].ToString(); lblRegEmail.Text = dsCarSellerInfo.Tables[0].Rows[0]["email"].ToString(); divlblRegPhone.Style["display"] = "none"; divtxtRegPhone.Style["display"] = "block"; txtRegPhone.Text = dsCarSellerInfo.Tables[0].Rows[0]["Phone"].ToString(); divlblRegCity.Style["display"] = "none"; divtxtRegCity.Style["display"] = "block"; txtRegCity.Text = GeneralFunc.ToProper(dsCarSellerInfo.Tables[0].Rows[0]["City"].ToString()).Trim(); divlblRegState.Style["display"] = "none"; divddlRegState.Style["display"] = "block"; ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(ddlLocationState.Items.FindByValue(dsCarSellerInfo.Tables[0].Rows[0]["State"].ToString())); divlblRegZip.Style["display"] = "none"; divtxtRegZip.Style["display"] = "block"; txtRegZip.Text = dsCarSellerInfo.Tables[0].Rows[0]["Zip"].ToString(); divlblRegAddress.Style["display"] = "none"; divtxtRegAddress.Style["display"] = "none"; txtRegAddress.Text = GeneralFunc.ToProper(dsCarSellerInfo.Tables[0].Rows[0]["Address1"].ToString()).Trim(); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (Session[Constants.NAME] == null) { Response.Redirect("../login.aspx"); } else { if (!IsPostBack) { int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString()); dsDropDown = objdropdownBL.Usp_Get_DropDown(); FillStates(); DealerActions objdealeract = new DealerActions(); DataSet dsUserInfoDetails = objdealeract.DealerDefaultSellerInfo(Session[Constants.DealerCode].ToString(), UID); //DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(UID); Session["getRegUserdata"] = dsUserInfoDetails; lblRegName.Text = dsUserInfoDetails.Tables[0].Rows[0]["sellerName"].ToString(); //lblUserNameData.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString(); //address1, address2, city, state, zip, country, phone, altPhone, fax, , altEmail, notesForBuyers, IsDefault, hdnsellarID.Value = dsUserInfoDetails.Tables[0].Rows[0]["sellerID"].ToString(); DataSet dsDelaerLogo = objdealeract.GetDealerLogo(hdnsellarID.Value); if (dsDelaerLogo.Tables[0].Rows.Count > 0) { imgthumb.ImageUrl = dsDelaerLogo.Tables[0].Rows[0]["LogoPath"].ToString(); } //lblUserAddPack.Text = dsUserInfoDetails.Tables[0].Rows[0]["Name"].ToString(); //lblUnamePW.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserID"].ToString(); lblRegEmail2.Text = dsUserInfoDetails.Tables[0].Rows[0]["email"].ToString(); lblRegEmail.Text = dsUserInfoDetails.Tables[0].Rows[0]["email"].ToString(); //lblEmailReg.Text = dsUserInfoDetails.Tables[0].Rows[0]["UserName"].ToString(); lblRegPhone.Text = objGeneralFunc.filPhnm(dsUserInfoDetails.Tables[0].Rows[0]["Phone"].ToString()); //lblBusinessName.Text = dsUserInfoDetails.Tables[0].Rows[0]["BusinessName"].ToString(); lblAltEmail.Text = dsUserInfoDetails.Tables[0].Rows[0]["AltEmail"].ToString(); lblAltPhone.Text = objGeneralFunc.filPhnm(dsUserInfoDetails.Tables[0].Rows[0]["AltPhone"].ToString()); ArrayList strAddress = new ArrayList(); strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Address1"].ToString().Trim()); strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["City"].ToString().Trim()); strAddress.Add(GetStateName(dsUserInfoDetails.Tables[0].Rows[0]["State"].ToString())); strAddress.Add(dsUserInfoDetails.Tables[0].Rows[0]["Zip"].ToString()); if (strAddress[0].ToString() != "" && (strAddress[1].ToString() != "" || strAddress[2].ToString() != "UN" || strAddress[3].ToString() != "")) { lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim() + ", "; } else { lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim(); } if (strAddress[1].ToString() != "" && (strAddress[2].ToString() != "UN" || strAddress[3].ToString() != "")) { lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim() + ", "; } else { lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim(); } if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() != "")) { lblRegState.Text = strAddress[2].ToString() + " "; } else if ((strAddress[2].ToString() != "UN") && (strAddress[3].ToString() == "")) { lblRegState.Text = strAddress[2].ToString(); } lblRegZip.Text = strAddress[3].ToString(); FillUsers(); } } }
protected void btnUpdateDetails_Click(object sender, EventArgs e) { try { objUserInfo.Name = GeneralFunc.ToProper(txtregName.Text).Trim(); objUserInfo.Address = GeneralFunc.ToProper(txtRegAddress.Text).Trim(); objUserInfo.City = GeneralFunc.ToProper(txtRegCity.Text).Trim(); objUserInfo.StateID = Convert.ToInt32(ddlLocationState.SelectedItem.Value); if (txtRegZip.Text.Length == 4) { objUserInfo.Zip = "0" + txtRegZip.Text; } else { objUserInfo.Zip = txtRegZip.Text; } objUserInfo.PhoneNumber = txtRegPhone.Text; objUserInfo.UId = Convert.ToInt32(Session[Constants.USER_ID].ToString()); objUserInfo.UserName = lblRegEmail.Text; //objUserInfo.BusinessName = txtBusinessName.Text; objUserInfo.AltEmail = txtAltEmail.Text; objUserInfo.AltPhone = txtAltPhone.Text; DealerActions objDealeraction = new DealerActions(); DataSet dsCarDetailsInfo = new DataSet(); dsCarDetailsInfo = objDealeraction.UpdateDealerSellerInfo(objUserInfo, hdnsellarID.Value, Session[Constants.DealerCode].ToString(), lblRegEmail.Text); tbl1LblsDisplay.Style["display"] = "block"; tbl2textDisplay.Style["display"] = "none"; Session["getRegUserdata"] = dsCarDetailsInfo; btnEditDetails.Visible = true; btnUpdateDetails.Visible = false; tbl1LblsDisplay.Style["display"] = "block"; tbl2textDisplay.Style["display"] = "none"; divlblRegName.Style["display"] = "block"; divtxtRegName.Style["display"] = "none"; lblRegName.Text = dsCarDetailsInfo.Tables[0].Rows[0]["sellerName"].ToString(); divlblRegPhone.Style["display"] = "block"; divtxtRegPhone.Style["display"] = "none"; lblRegPhone.Text = objGeneralFunc.filPhnm(dsCarDetailsInfo.Tables[0].Rows[0]["Phone"].ToString()); lblRegEmail2.Text = dsCarDetailsInfo.Tables[0].Rows[0]["email"].ToString(); lblAltEmail.Text = dsCarDetailsInfo.Tables[0].Rows[0]["AltEmail"].ToString(); lblAltPhone.Text = objGeneralFunc.filPhnm(dsCarDetailsInfo.Tables[0].Rows[0]["AltPhone"].ToString()); divlblRegCity.Style["display"] = "block"; divtxtRegCity.Style["display"] = "none"; divlblRegState.Style["display"] = "block"; divddlRegState.Style["display"] = "none"; divlblRegZip.Style["display"] = "block"; divtxtRegZip.Style["display"] = "none"; divlblRegAddress.Style["display"] = "block"; divtxtRegAddress.Style["display"] = "none"; ArrayList strAddress = new ArrayList(); strAddress.Add(dsCarDetailsInfo.Tables[0].Rows[0]["Address1"].ToString().Trim()); strAddress.Add(dsCarDetailsInfo.Tables[0].Rows[0]["City"].ToString().Trim()); strAddress.Add(dsCarDetailsInfo.Tables[0].Rows[0]["State_Code"].ToString()); strAddress.Add(dsCarDetailsInfo.Tables[0].Rows[0]["Zip"].ToString()); lblRegAddress.Text = ""; lblRegCity.Text = ""; lblRegState.Text = ""; lblRegZip.Text = ""; if (strAddress[0].ToString() != "" && (strAddress[1].ToString() != "" || strAddress[2].ToString() != "UN" || strAddress[3].ToString() != "")) { lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim() + ", "; } else { lblRegAddress.Text = GeneralFunc.ToProper(strAddress[0].ToString()).Trim(); } if (strAddress[1].ToString() != "" && (strAddress[2].ToString() != "UN" || strAddress[3].ToString() != "")) { lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim() + ", "; } else { lblRegCity.Text = GeneralFunc.ToProper(strAddress[1].ToString()).Trim(); } if ((strAddress[2].ToString() != "UN") || (strAddress[3].ToString() != "")) { lblRegState.Text = strAddress[2].ToString() + " "; } else if ((strAddress[2].ToString() == "UN") || (strAddress[3].ToString() == "")) { lblRegState.Text = strAddress[2].ToString(); } lblRegZip.Text = strAddress[3].ToString(); } catch (Exception ex) { throw ex; } }
protected void btnSaveLogo_Click(object sender, EventArgs e) { string Filepath = "Dealer//DealerImages//"; string FileNameFullPath = Server.MapPath(Filepath); if (System.IO.Directory.Exists(FileNameFullPath) == false) { System.IO.Directory.CreateDirectory(FileNameFullPath); } fileUP.SaveAs(FileNameFullPath + hdnsellarID.Value + ".jpg"); Bitmap oBitmap = default(Bitmap); oBitmap = new Bitmap(FileNameFullPath + hdnsellarID.Value + ".jpg"); Graphics oGraphic = default(Graphics); int newwidthimg = 105; // Here create a new bitmap object of the same height and width of the image. float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height; int newHeight = Convert.ToInt32(newwidthimg / AspectRatio); Bitmap bmpNew = new Bitmap(newwidthimg, newHeight); oGraphic = Graphics.FromImage(bmpNew); oGraphic.CompositingQuality = CompositingQuality.HighQuality; oGraphic.SmoothingMode = SmoothingMode.HighQuality; oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap.Dispose(); oBitmap = bmpNew; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap.Save(FileNameFullPath + hdnsellarID.Value + ".jpg", ImageFormat.Jpeg); oBitmap.Dispose(); DealerActions objDealerActions = new DealerActions(); string ImageURL = "Dealer/DealerImages/" + hdnsellarID.Value + ".jpg"; DataSet dsSellerInfor = objDealerActions.DealerLogoUpdate(ImageURL, hdnsellarID.Value); if (dsSellerInfor.Tables[0].Rows.Count > 0) { imgthumb.ImageUrl = dsSellerInfor.Tables[0].Rows[0]["LogoPath"].ToString(); } Response.Redirect("ManageAccount.aspx"); //DataSet dsDelaerLogo = objdealeract.GetDealerLogo(hdnsellarID.Value); //if (dsDelaerLogo.Tables[0].Rows.Count > 0) //{ // imgthumb.ImageUrl = dsDelaerLogo.Tables[0].Rows[0]["LogoPath"].ToString(); //} }
protected void imageOrder_Click(object sender, EventArgs e) { try { string CarID = hdnCarID.Value; string Make = hdnMake.Value; string Model = hdnModel.Value; string Year = hdnYear.Value; string Pic0 = hdnPic0.Value; string Pic1 = hdnPic1.Value; string Pic2 = hdnPic2.Value; string Pic3 = hdnPic3.Value; string Pic4 = hdnPic4.Value; string Pic5 = hdnPic5.Value; string Pic6 = hdnPic6.Value; string Pic7 = hdnPic7.Value; string Pic8 = hdnPic8.Value; string Pic9 = hdnPic9.Value; string Pic10 = hdnPic10.Value; string Pic11 = hdnPic11.Value; string Pic12 = hdnPic12.Value; string Pic13 = hdnPic13.Value; string Pic14 = hdnPic14.Value; string Pic15 = hdnPic15.Value; string Pic16 = hdnPic16.Value; string Pic17 = hdnPic17.Value; string Pic18 = hdnPic18.Value; string Pic19 = hdnPic19.Value; string Pic20 = hdnPic20.Value; DataSet dsImagesData = objDealerAction.USP_GetImages(Convert.ToInt32(CarID), 7); //DataSet dsImagesData = Session["GetImages"] as DataSet; UsedCarsInfo objcarsInfo = new UsedCarsInfo(); objcarsInfo.PIC0 = dsImagesData.Tables[0].Rows[0]["pic0"].ToString(); objcarsInfo.PIC1 = dsImagesData.Tables[0].Rows[0]["pic1"].ToString(); objcarsInfo.PIC2 = dsImagesData.Tables[0].Rows[0]["pic2"].ToString(); objcarsInfo.PIC3 = dsImagesData.Tables[0].Rows[0]["pic3"].ToString(); objcarsInfo.PIC4 = dsImagesData.Tables[0].Rows[0]["pic4"].ToString(); objcarsInfo.PIC5 = dsImagesData.Tables[0].Rows[0]["pic5"].ToString(); objcarsInfo.PIC6 = dsImagesData.Tables[0].Rows[0]["pic6"].ToString(); objcarsInfo.PIC7 = dsImagesData.Tables[0].Rows[0]["pic7"].ToString(); objcarsInfo.PIC8 = dsImagesData.Tables[0].Rows[0]["pic8"].ToString(); objcarsInfo.PIC9 = dsImagesData.Tables[0].Rows[0]["pic9"].ToString(); objcarsInfo.PIC10 = dsImagesData.Tables[0].Rows[0]["pic10"].ToString(); objcarsInfo.PIC11 = dsImagesData.Tables[0].Rows[0]["pic11"].ToString(); objcarsInfo.PIC12 = dsImagesData.Tables[0].Rows[0]["pic12"].ToString(); objcarsInfo.PIC13 = dsImagesData.Tables[0].Rows[0]["pic13"].ToString(); objcarsInfo.PIC14 = dsImagesData.Tables[0].Rows[0]["pic14"].ToString(); objcarsInfo.PIC15 = dsImagesData.Tables[0].Rows[0]["pic15"].ToString(); objcarsInfo.PIC16 = dsImagesData.Tables[0].Rows[0]["pic16"].ToString(); objcarsInfo.PIC17 = dsImagesData.Tables[0].Rows[0]["pic17"].ToString(); objcarsInfo.PIC18 = dsImagesData.Tables[0].Rows[0]["pic18"].ToString(); objcarsInfo.PIC19 = dsImagesData.Tables[0].Rows[0]["pic19"].ToString(); objcarsInfo.PIC20 = dsImagesData.Tables[0].Rows[0]["pic20"].ToString(); if ((Pic1 != null) && (Pic1 != "") && (Pic1 != "0")) { if (objcarsInfo.PIC1 != Pic1) { DataSet dsdata = objDealerAction.GetPictureLocationByID(Pic1); string FileNameSaveData1 = Server.MapPath(dsdata.Tables[0].Rows[0]["picturelocation"].ToString() + dsdata.Tables[0].Rows[0]["picturename"].ToString()); string FileNameSaveData = dsdata.Tables[0].Rows[0]["picturelocation"].ToString() + dsdata.Tables[0].Rows[0]["picturename"].ToString(); System.Web.UI.WebControls.Image Image1 = (System.Web.UI.WebControls.Image)form1.FindControl("Img1"); Image1.ImageUrl = "~/" + FileNameSaveData; string SavePath = dsdata.Tables[0].Rows[0]["picturelocation"].ToString(); string path = Server.MapPath(Image1.ImageUrl); //string path = Server.MapPath(ImageName.ImageUrl); string SelModelName = Model.ToString(); SelModelName = SelModelName.Replace("/", "@"); SelModelName = SelModelName.Replace("&", "@"); SelModelName = SelModelName.Replace(" ", "-"); string FileNameThumb = Year + "_" + Make + "_" + SelModelName + "_" + CarID + "_Thumb.jpg"; string FileNameFullThumb = Server.MapPath("~/" + dsdata.Tables[0].Rows[0]["picturelocation"].ToString()); System.Drawing.Image image = System.Drawing.Image.FromFile(path); //int newwidthimg = 250; //float AspectRatio = (float)image.Size.Width / (float)image.Size.Height; //int newHeight = Convert.ToInt32(newwidthimg / AspectRatio); //Bitmap thumbnailBitmap = new Bitmap(newwidthimg, newHeight); //Graphics thumbnailGraph = Graphics.FromImage(thumbnailBitmap); //thumbnailGraph.CompositingQuality = CompositingQuality.HighQuality; //thumbnailGraph.SmoothingMode = SmoothingMode.HighQuality; //thumbnailGraph.InterpolationMode = InterpolationMode.HighQualityBicubic; //var imageRectangle = new Rectangle(0, 0, newwidthimg, newHeight); //thumbnailGraph.DrawImage(image, imageRectangle); //thumbnailBitmap.Save(SavePath, ImageFormat.Jpeg); //thumbnailGraph.Dispose(); //thumbnailBitmap.Dispose(); //image.Dispose(); //if (System.IO.Directory.Exists(FileNameSaveData1) == false) //{ // System.IO.Directory.CreateDirectory(FileNameSaveData1); //} Bitmap oBitmap1 = default(Bitmap); oBitmap1 = new Bitmap(path); Graphics oGraphic1 = default(Graphics); int newwidthimg1 = 250; // Here create a new bitmap object of the same height and width of the image. //float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height; float AspectRatio1 = (float)oBitmap1.Size.Width / (float)oBitmap1.Size.Height; int newHeight1 = Convert.ToInt32(newwidthimg1 / AspectRatio1); Bitmap bmpNew1 = new Bitmap(newwidthimg1, newHeight1); oGraphic1 = Graphics.FromImage(bmpNew1); oGraphic1.CompositingQuality = CompositingQuality.HighQuality; oGraphic1.SmoothingMode = SmoothingMode.HighQuality; oGraphic1.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic1.DrawImage(oBitmap1, new Rectangle(0, 0, bmpNew1.Width, bmpNew1.Height), 0, 0, oBitmap1.Width, oBitmap1.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap1.Dispose(); oBitmap1 = bmpNew1; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap1.Save(FileNameFullThumb + FileNameThumb, ImageFormat.Jpeg); oBitmap1.Dispose(); DealerActions objDealerActions1 = new DealerActions(); DataSet dsImgID1 = objDealerActions1.SavePictures(SavePath, FileNameThumb, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString())); objcarsInfo.PIC0 = dsImgID1.Tables[0].Rows[0]["picID"].ToString(); } objcarsInfo.PIC1 = Pic1; } else { objcarsInfo.PIC0 = ""; objcarsInfo.PIC1 = ""; } if ((Pic2 != null) && (Pic2 != "") && (Pic2 != "0")) { objcarsInfo.PIC2 = Pic2; } else { objcarsInfo.PIC2 = ""; } if ((Pic3 != null) && (Pic3 != "") && (Pic3 != "0")) { objcarsInfo.PIC3 = Pic3; } else { objcarsInfo.PIC3 = ""; } if ((Pic4 != null) && (Pic4 != "") && (Pic4 != "0")) { objcarsInfo.PIC4 = Pic4; } else { objcarsInfo.PIC4 = ""; } if ((Pic5 != null) && (Pic5 != "") && (Pic5 != "0")) { objcarsInfo.PIC5 = Pic5; } else { objcarsInfo.PIC5 = ""; } if ((Pic6 != null) && (Pic6 != "") && (Pic6 != "0")) { objcarsInfo.PIC6 = Pic6; } else { objcarsInfo.PIC6 = ""; } if ((Pic7 != null) && (Pic7 != "") && (Pic7 != "0")) { objcarsInfo.PIC7 = Pic7; } else { objcarsInfo.PIC7 = ""; } if ((Pic8 != null) && (Pic8 != "") && (Pic8 != "0")) { objcarsInfo.PIC8 = Pic8; } else { objcarsInfo.PIC8 = ""; } if ((Pic9 != null) && (Pic9 != "") && (Pic9 != "0")) { objcarsInfo.PIC9 = Pic9; } else { objcarsInfo.PIC9 = ""; } if ((Pic10 != null) && (Pic10 != "") && (Pic10 != "0")) { objcarsInfo.PIC10 = Pic10; } else { objcarsInfo.PIC10 = ""; } if ((Pic11 != null) && (Pic11 != "") && (Pic11 != "0")) { objcarsInfo.PIC11 = Pic11; } else { objcarsInfo.PIC11 = ""; } if ((Pic12 != null) && (Pic12 != "") && (Pic12 != "0")) { objcarsInfo.PIC12 = Pic10; } else { objcarsInfo.PIC12 = ""; } if ((Pic13 != null) && (Pic13 != "") && (Pic13 != "0")) { objcarsInfo.PIC13 = Pic13; } else { objcarsInfo.PIC13 = ""; } if ((Pic14 != null) && (Pic14 != "") && (Pic14 != "0")) { objcarsInfo.PIC14 = Pic14; } else { objcarsInfo.PIC14 = ""; } if ((Pic15 != null) && (Pic15 != "") && (Pic15 != "0")) { objcarsInfo.PIC15 = Pic15; } else { objcarsInfo.PIC15 = ""; } if ((Pic16 != null) && (Pic16 != "") && (Pic16 != "0")) { objcarsInfo.PIC16 = Pic16; } else { objcarsInfo.PIC16 = ""; } if ((Pic17 != null) && (Pic17 != "") && (Pic17 != "0")) { objcarsInfo.PIC17 = Pic17; } else { objcarsInfo.PIC17 = ""; } if ((Pic18 != null) && (Pic18 != "") && (Pic18 != "0")) { objcarsInfo.PIC18 = Pic18; } else { objcarsInfo.PIC18 = ""; } if ((Pic19 != null) && (Pic19 != "") && (Pic19 != "0")) { objcarsInfo.PIC19 = Pic19; } else { objcarsInfo.PIC19 = ""; } if ((Pic20 != null) && (Pic20 != "") && (Pic20 != "0")) { objcarsInfo.PIC20 = Pic20; } else { objcarsInfo.PIC20 = ""; } objcarsInfo.Carid = Convert.ToInt32(CarID); bool bnew = objDealerAction.UpdatePicturesById(objcarsInfo, Convert.ToInt32(Session[Constants.USER_ID].ToString())); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { //if (Session[Constants.NAME] == null) //{ // Response.Redirect("../login.aspx"); //} HttpPostedFile uploads = Request.Files["FileData"]; //HttpContext.Current.Request["RequireUploadifySessionSync"] string FileExt = System.IO.Path.GetExtension(uploads.FileName); //Get The Ext of File //FileName = Server.MapPath(".") + fuAttachments.PostedFile.FileName; /* if (FileExt != ".jpg" || FileExt != ".png"||FileExt != ".jpeg") { //return "You have not selected a Excel File.Kindly select Excel File"; } */ string file = System.IO.Path.GetFileName(uploads.FileName); try { string[] Query1 = Request.QueryString[0].Split('*'); string Make = Query1[0]; string Model = Query1[1]; Model = Model.Replace("/", "@"); Model = Model.Replace("&", "@"); string Year = Query1[2]; string CarID = Query1[3]; int k = 0; if (Session["k"] == null) { k = 0; } else { k = Convert.ToInt32(Session["k"].ToString()) + 1; } string Filepath = "CarImages//" + Year + "//" + Make + "//" + Model + "//" + CarID + "//"; string FileNameFullPath = Server.MapPath("../CarImages/" + Year + "/" + Make + "/" + Model + "/" + CarID); Session["k"] = k; string SelModel = Model.Replace(" ", "-"); string sNewFileName = Year + "_" + Make + "_" + SelModel + "_" + CarID + k + ".jpg"; string sNewFileName1 = Year + "_" + Make + "_" + SelModel + "_" + CarID + k + "Thumb.jpg"; string FileNameSaveData = FileNameFullPath + "//" + sNewFileName; string FileNameSaveData1 = FileNameFullPath + "//" + sNewFileName1; if (System.IO.Directory.Exists(FileNameFullPath) == false) { System.IO.Directory.CreateDirectory(FileNameFullPath); } uploads.SaveAs(FileNameSaveData); Bitmap oBitmap = default(Bitmap); oBitmap = new Bitmap(FileNameSaveData); Graphics oGraphic = default(Graphics); int newwidthimg = 600; // Here create a new bitmap object of the same height and width of the image. float AspectRatio = (float)oBitmap.Size.Width / (float)oBitmap.Size.Height; int newHeight = Convert.ToInt32(newwidthimg / AspectRatio); Bitmap bmpNew = new Bitmap(newwidthimg, newHeight); oGraphic = Graphics.FromImage(bmpNew); oGraphic.CompositingQuality = CompositingQuality.HighQuality; oGraphic.SmoothingMode = SmoothingMode.HighQuality; oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic.DrawImage(oBitmap, new Rectangle(0, 0, bmpNew.Width, bmpNew.Height), 0, 0, oBitmap.Width, oBitmap.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap.Dispose(); oBitmap = bmpNew; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap.Save(FileNameSaveData, ImageFormat.Jpeg); oBitmap.Dispose(); DealerActions objDealerActions = new DealerActions(); DataSet dsImgID = objDealerActions.SavePictures(Filepath, sNewFileName, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString())); ArrayList str = new ArrayList(); //if (Session["Pics"] == null) //{ // Session["Pics"] = str; //} //else //{ // str = (ArrayList)Session["Pics"]; //} //str[k] = dsImgID.Tables[0].Rows[0]["picID"].ToString(); str.Add(dsImgID.Tables[0].Rows[0]["picID"].ToString()); DataSet dsImagesData = objDealerActions.USP_GetImages(Convert.ToInt32(CarID), 7); //DataSet dsImagesData = Session["GetImages"] as DataSet; UsedCarsInfo objcarsInfo = new UsedCarsInfo(); objcarsInfo.PIC0 = dsImagesData.Tables[0].Rows[0]["pic0"].ToString(); objcarsInfo.PIC1 = dsImagesData.Tables[0].Rows[0]["pic1"].ToString(); objcarsInfo.PIC2 = dsImagesData.Tables[0].Rows[0]["pic2"].ToString(); objcarsInfo.PIC3 = dsImagesData.Tables[0].Rows[0]["pic3"].ToString(); objcarsInfo.PIC4 = dsImagesData.Tables[0].Rows[0]["pic4"].ToString(); objcarsInfo.PIC5 = dsImagesData.Tables[0].Rows[0]["pic5"].ToString(); objcarsInfo.PIC6 = dsImagesData.Tables[0].Rows[0]["pic6"].ToString(); objcarsInfo.PIC7 = dsImagesData.Tables[0].Rows[0]["pic7"].ToString(); objcarsInfo.PIC8 = dsImagesData.Tables[0].Rows[0]["pic8"].ToString(); objcarsInfo.PIC9 = dsImagesData.Tables[0].Rows[0]["pic9"].ToString(); objcarsInfo.PIC10 = dsImagesData.Tables[0].Rows[0]["pic10"].ToString(); objcarsInfo.PIC11 = dsImagesData.Tables[0].Rows[0]["pic11"].ToString(); objcarsInfo.PIC12 = dsImagesData.Tables[0].Rows[0]["pic12"].ToString(); objcarsInfo.PIC13 = dsImagesData.Tables[0].Rows[0]["pic13"].ToString(); objcarsInfo.PIC14 = dsImagesData.Tables[0].Rows[0]["pic14"].ToString(); objcarsInfo.PIC15 = dsImagesData.Tables[0].Rows[0]["pic15"].ToString(); objcarsInfo.PIC16 = dsImagesData.Tables[0].Rows[0]["pic16"].ToString(); objcarsInfo.PIC17 = dsImagesData.Tables[0].Rows[0]["pic17"].ToString(); objcarsInfo.PIC18 = dsImagesData.Tables[0].Rows[0]["pic18"].ToString(); objcarsInfo.PIC19 = dsImagesData.Tables[0].Rows[0]["pic19"].ToString(); objcarsInfo.PIC20 = dsImagesData.Tables[0].Rows[0]["pic20"].ToString(); for (int j = 0; j < str.Count; j++) { if (str[j].ToString() != "" && str[j].ToString() != "0" && str[j].ToString() != " ") { if (objcarsInfo.PIC1 == null || objcarsInfo.PIC1 == "" || objcarsInfo.PIC1 == "0") { objcarsInfo.PIC1 = str[j].ToString(); uploads.SaveAs(FileNameSaveData1); Bitmap oBitmap1 = default(Bitmap); oBitmap1 = new Bitmap(FileNameSaveData1); Graphics oGraphic1 = default(Graphics); int newwidthimg1 = 250; // Here create a new bitmap object of the same height and width of the image. float AspectRatio1 = (float)oBitmap1.Size.Width / (float)oBitmap1.Size.Height; int newHeight1 = Convert.ToInt32(newwidthimg1 / AspectRatio); Bitmap bmpNew1 = new Bitmap(newwidthimg1, newHeight1); oGraphic1 = Graphics.FromImage(bmpNew1); oGraphic1.CompositingQuality = CompositingQuality.HighQuality; oGraphic1.SmoothingMode = SmoothingMode.HighQuality; oGraphic1.InterpolationMode = InterpolationMode.HighQualityBicubic; oGraphic1.DrawImage(oBitmap1, new Rectangle(0, 0, bmpNew1.Width, bmpNew1.Height), 0, 0, oBitmap1.Width, oBitmap1.Height, GraphicsUnit.Pixel); // Release the lock on the image file. Of course, // image from the image file is existing in Graphics object oBitmap1.Dispose(); oBitmap1 = bmpNew1; //SolidBrush oBrush = new SolidBrush(Color.Black); //Font ofont = new Font("Arial", 8); //oGraphic.DrawString("Some text to write", ofont, oBrush, 10, 10); //oGraphic.Dispose(); //ofont.Dispose(); //oBrush.Dispose(); oBitmap1.Save(FileNameSaveData1, ImageFormat.Jpeg); oBitmap.Dispose(); DealerActions objDealerActions1 = new DealerActions(); DataSet dsImgID1 = objDealerActions1.SavePictures(Filepath, sNewFileName, "Jpeg", Convert.ToInt32(Session[Constants.USER_ID].ToString())); objcarsInfo.PIC0 = dsImgID1.Tables[0].Rows[0]["picID"].ToString(); } else if (objcarsInfo.PIC2 == null || objcarsInfo.PIC2 == "" || objcarsInfo.PIC2 == "0") { objcarsInfo.PIC2 = str[j].ToString(); } else if (objcarsInfo.PIC3 == null || objcarsInfo.PIC3 == "" || objcarsInfo.PIC3 == "0") { objcarsInfo.PIC3 = str[j].ToString(); } else if (objcarsInfo.PIC4 == null || objcarsInfo.PIC4 == "" || objcarsInfo.PIC4 == "0") { objcarsInfo.PIC4 = str[j].ToString(); } else if (objcarsInfo.PIC5 == null || objcarsInfo.PIC5 == "" || objcarsInfo.PIC5 == "0") { objcarsInfo.PIC5 = str[j].ToString(); } else if (objcarsInfo.PIC6 == null || objcarsInfo.PIC6 == "" || objcarsInfo.PIC6 == "0") { objcarsInfo.PIC6 = str[j].ToString(); } else if (objcarsInfo.PIC7 == null || objcarsInfo.PIC7 == "" || objcarsInfo.PIC7 == "0") { objcarsInfo.PIC7 = str[j].ToString(); } else if (objcarsInfo.PIC8 == null || objcarsInfo.PIC8 == "" || objcarsInfo.PIC8 == "0") { objcarsInfo.PIC8 = str[j].ToString(); } else if (objcarsInfo.PIC9 == null || objcarsInfo.PIC9 == "" || objcarsInfo.PIC9 == "0") { objcarsInfo.PIC9 = str[j].ToString(); } else if (objcarsInfo.PIC10 == null || objcarsInfo.PIC10 == "" || objcarsInfo.PIC10 == "0") { objcarsInfo.PIC10 = str[j].ToString(); } else if (objcarsInfo.PIC11 == null || objcarsInfo.PIC11 == "" || objcarsInfo.PIC11 == "0") { objcarsInfo.PIC11 = str[j].ToString(); } else if (objcarsInfo.PIC12 == null || objcarsInfo.PIC12 == "" || objcarsInfo.PIC12 == "0") { objcarsInfo.PIC12 = str[j].ToString(); } else if (objcarsInfo.PIC13 == null || objcarsInfo.PIC13 == "" || objcarsInfo.PIC13 == "0") { objcarsInfo.PIC13 = str[j].ToString(); } else if (objcarsInfo.PIC14 == null || objcarsInfo.PIC14 == "" || objcarsInfo.PIC14 == "0") { objcarsInfo.PIC14 = str[j].ToString(); } else if (objcarsInfo.PIC15 == null || objcarsInfo.PIC15 == "" || objcarsInfo.PIC15 == "0") { objcarsInfo.PIC15 = str[j].ToString(); } else if (objcarsInfo.PIC16 == null || objcarsInfo.PIC16 == "" || objcarsInfo.PIC16 == "0") { objcarsInfo.PIC16 = str[j].ToString(); } else if (objcarsInfo.PIC17 == null || objcarsInfo.PIC17 == "" || objcarsInfo.PIC17 == "0") { objcarsInfo.PIC17 = str[j].ToString(); } else if (objcarsInfo.PIC18 == null || objcarsInfo.PIC18 == "" || objcarsInfo.PIC18 == "0") { objcarsInfo.PIC18 = str[j].ToString(); } else if (objcarsInfo.PIC19 == null || objcarsInfo.PIC19 == "" || objcarsInfo.PIC19 == "0") { objcarsInfo.PIC19 = str[j].ToString(); } else if (objcarsInfo.PIC20 == null || objcarsInfo.PIC20 == "" || objcarsInfo.PIC20 == "0") { objcarsInfo.PIC20 = str[j].ToString(); } } objcarsInfo.Carid = Convert.ToInt32(CarID); } bool bnew = objDealerActions.UpdatePicturesById(objcarsInfo, Convert.ToInt32(Session[Constants.USER_ID].ToString())); } catch(Exception ex) { } }
private void SaveData() { UsedCarsInfo objcarsInfo = new UsedCarsInfo(); DataSet ds = (DataSet)Session["ExcelData"]; DealerActions objSaveCar = new DealerActions(); try { int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString()); foreach (GridViewRow row in grdIntroInfo.Rows) { objcarsInfo.Make = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMake")).Text).ToString(); objcarsInfo.Model = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblModel")).Text).ToString(); if (GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPrice")).Text).ToString() == "") { objcarsInfo.Price = Convert.ToDouble("0"); } else { objcarsInfo.Price = Convert.ToDouble(GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPrice")).Text).ToString()); } objcarsInfo.YearOfMake = Convert.ToInt32(GenFunc.ExcelTextFormat(((Label)row.FindControl("lblyear")).Text).ToString()); objcarsInfo.Description = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hdnDescription")).Value).ToString(); if (GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMileage")).Text).ToString().Replace("mi", "").Replace(",", "").Trim() == "") { objcarsInfo.Mileage = "0"; } else { objcarsInfo.Mileage = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblMileage")).Text).ToString().Replace("mi", "").Replace(",", "").Trim(); } objcarsInfo.Bodytype = GenFunc.ExcelTextFormat(((Label)row.FindControl("BodyType")).Text).ToString(); objcarsInfo.ExteriorColor = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblExteriorColor")).Text).ToString(); objcarsInfo.InteriorColor = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblInteriorColor")).Text).ToString(); objcarsInfo.VIN = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVIN")).Text).ToString(); objcarsInfo.Fueltype = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblFuelType")).Text).ToString(); objcarsInfo.NumberOfCylinder = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblNumberOfCylinder")).Text).ToString(); objcarsInfo.Transmission = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblTransmission")).Text).ToString(); //objcarsInfo.Wheelbase = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblWheelbase")).Text).ToString(); objcarsInfo.NumberOfDoors = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblDoors")).Text).ToString(); objcarsInfo.DriveTrain = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblDrivetrain")).Text).ToString(); //objcarsInfo.VehicleConditionID = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVehicleCondition")).Text).ToString(); //objcarsInfo.NumberOfCylinder = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblVehicleCondition")).Text).ToString(); objUsedCarsInfo.SellerID = 0; DataSet dsPackages = objSaveCar.USP_ChkPackageForAddCar(UID); int PaymentID; //**************************************************???/// //during we need take user package from dealer package id //**************************************************???/// int UserPackID = 0; if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); } else { dsPackages = objSaveCar.USP_ChkExistingPackage(UID); if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); //objUsedCarsInfo.AdStatus = "6"; } } objUsedCarsInfo.AdStatus = "6"; objcarsInfo.ConditionDescription = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblConditionDescription")).Text).ToString(); string sDealerCarID = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hndDealerUniqueID")).Value).ToString(); objUsedCarsInfo.SellerID = Convert.ToInt32(0); string Source = ""; string SourcePicID = ""; string SellerType = "2"; string SellerID = "0"; objcarsInfo.DealerUniqueID = GenFunc.ExcelTextFormat(((HiddenField)row.FindControl("hndDealerUniqueID")).Value).ToString(); objcarsInfo.Uid = Convert.ToInt32(Session[Constants.USER_ID].ToString()); //UserControl UC = (UserControl)Page.LoadControl("Usercontrol/Header.ascx"); //System.Web.UI.WebControls.Label lblDealerCode = (System.Web.UI.WebControls.Label)UC.FindControl("lblDealerCode"); DataSet dsCarsDetails = objSaveCar.SaveCarDetailsForBulkUploadDealers(objcarsInfo, SellerID, SellerType, SourcePicID, Source, sDealerCarID, UserPackID.ToString(), Session[Constants.DealerCode].ToString()); objcarsInfo.Carid = Convert.ToInt32(dsCarsDetails.Tables[0].Rows[0][0].ToString()); //string sFilePath = GenFunc.ExcelTextFormat(((Label)row.FindControl("lblPicpath")).Text).ToString(); //SaveImages(sFilePath, objcarsInfo.YearOfMake.ToString(), objcarsInfo.Make.ToString(), objcarsInfo.Model.ToString(), objcarsInfo.Carid.ToString()); //if (Session["PaymentID"] == null) //{ // PackageID = Convert.ToInt32(ddlPackage.SelectedItem.Value); // PaymentID = Convert.ToInt32(0); //} //else if (Session["PaymentID"].ToString() == "") //{ // PackageID = Convert.ToInt32(ddlPackage.SelectedItem.Value); // PaymentID = Convert.ToInt32(0); //} //else //{ //} // int PackageID = Convert.ToInt32(Session["PackageID"]); //Convert.ToInt32(ddlPackage.SelectedItem.Value); } } catch (Exception ex) { throw ex; } }
private void ReadExcelData(string sFileName) { ArrayList RowNo = new ArrayList(); ArrayList ColNo = new ArrayList(); ArrayList SArray = new ArrayList(); ExcelReading objExcelData = new ExcelReading(); DataSet ds = new DataSet(); DataSet dsStatus = new DataSet(); DataSet dsSales = new DataSet(); bool bnew = false; grdErrors.DataSource = null; grdErrors.DataBind(); try { lblErrorMsg.Text = ""; ds = objExcelData.GetExcelToDataset(sFileName); Session["ExcelData"] = ds; DataSet dsError = new DataSet(); dsError.Tables.Add(); dsError.Tables["Table1"].Columns.Add("DealerUniqueID"); dsError.Tables["Table1"].Columns.Add("RowNo"); dsError.Tables["Table1"].Columns.Add("Error"); if (ds != null) { if (ds.Tables.Count > 0) { if (ds.Tables[0].Columns.Contains("Price") && ds.Tables[0].Columns.Contains("year") && ds.Tables[0].Columns.Contains("Make") && ds.Tables[0].Columns.Contains("Model") && ds.Tables[0].Columns.Contains("Description") && ds.Tables[0].Columns.Contains("Mileage") && ds.Tables[0].Columns.Contains("BodyStyle") && ds.Tables[0].Columns.Contains("ExteriorColor") && ds.Tables[0].Columns.Contains("InteriorColor") && ds.Tables[0].Columns.Contains("VIN") && ds.Tables[0].Columns.Contains("FuelType") && ds.Tables[0].Columns.Contains("Transmission") && ds.Tables[0].Columns.Contains("Wheelbase") && ds.Tables[0].Columns.Contains("Doors") && ds.Tables[0].Columns.Contains("Drivetrain") && ds.Tables[0].Columns.Contains("SellerNotes") && //ds.Tables[0].Columns.Contains("VehicleCondition") && ds.Tables[0].Columns.Contains("ConditionDescription") && ds.Tables[0].Columns.Contains("NumberOfCylinder") ) { if (ds != null) { if (ds.Tables[0].Rows.Count > 5000) { lblErrorMsg.Text = "Upload Only 5000 rows Only!"; return; } else if (Convert.ToInt32(txtRecordCount.Text) != Convert.ToInt32(ds.Tables[0].Rows.Count)) { lblErrorMsg.Text = "Records Count Does Not Match!"; return; } else if (ds.Tables[0].Rows.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { if (ds.Tables[0].Rows[i]["Make"].ToString().Trim() == "") { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Make in the Excel sheet"; } else if (ds.Tables[0].Rows[i]["Model"].ToString().Trim() == "") { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Valid Model in the Excel sheet"; } else if (!GeneralFunc.IsNumeric(ds.Tables[0].Rows[i]["year"].ToString().Trim())) { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Numeric Year in the Excel sheet"; } else if (!GeneralFunc.CheckCurrentYear(ds.Tables[0].Rows[i]["year"].ToString().Trim())) { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Year which should be less than or equal to current year in Excel Sheet "; } else if (!GeneralFunc.IsNumeric(ds.Tables[0].Rows[i]["Mileage"].ToString().Trim())) { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Numeric Mileage in the Excel sheet"; } if (ds.Tables[0].Rows[i]["Price"].ToString().Trim() == "") { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Price in the Excel sheet"; } else if (!GeneralFunc.IsNumeric(ds.Tables[0].Rows[i]["Price"].ToString().Trim())) { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Numeric Price in the Excel sheet"; } else if (ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim() == "") { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Please Enter Dealer UniqueID in the Excel sheet"; } DealerActions objActions = new DealerActions(); DataSet dsCheckUser = objActions.DealerCheckUniqueID(ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(), Session[Constants.DealerCode].ToString()); if (dsCheckUser.Tables[0].Rows.Count > 0) { dsError.Tables["Table1"].Rows.Add(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["DealerUniqueID"] = ds.Tables[0].Rows[i]["DealerUniqueID"].ToString().Trim(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["RowNo"] = (i + 1).ToString(); dsError.Tables["Table1"].Rows[dsError.Tables["Table1"].Rows.Count - 1]["Error"] = "Dealer Unique already exists"; } } if (dsError.Tables[0].Rows.Count > 0) { grdIntroInfo.DataSource = null; grdIntroInfo.DataBind(); recGrid.Style.Add("display", "block"); grdErrors.DataSource = dsError.Tables["Table1"].DefaultView; grdErrors.DataBind(); //Header.Visible = false; } else { grdErrors.DataSource = null; grdErrors.DataBind(); Header.Visible = true; recGrid.Style.Add("display", "block"); grdIntroInfo.DataSource = ds.Tables[0].DefaultView; grdIntroInfo.DataBind(); btnSubmit.Enabled = false; btnUpload.Enabled = true; } } } } else { btnUpload.Text = "Upload"; lblErrorMsg.Text = "Enter Valid Sales Excel Sheet Contain Proper Columns."; btnSubmit.Enabled = true; } } else { btnUpload.Text = "Upload"; lblErrorMsg.Text = "No Records access from file!"; btnSubmit.Enabled = true; } } } catch (Exception ex) { throw ex; } }
private void SaveDetails() { try { int UID = Convert.ToInt32(Session[Constants.USER_ID].ToString()); objcarsInfo.YearOfMake = Convert.ToInt32(ddlYear.SelectedItem.Text); objcarsInfo.MakeModelID = Convert.ToInt32(ddlModel.SelectedItem.Value); objcarsInfo.BodytypeID = Convert.ToInt32(ddlStyle.SelectedItem.Value); if ((Session["CarID"] == null) || (Session["CarID"].ToString() == "")) { objcarsInfo.Carid = Convert.ToInt32(0); } else { objcarsInfo.Carid = Convert.ToInt32(Session["CarID"].ToString()); } if (txtAskingPrice.Text == "") { objcarsInfo.Price = Convert.ToDouble("0"); } else { objcarsInfo.Price = Convert.ToDouble(txtAskingPrice.Text); } if (txtMileage.Text == "") { objcarsInfo.Mileage = "0"; } else { objcarsInfo.Mileage = txtMileage.Text; } objcarsInfo.ExteriorColor = ddlExteriorColor.SelectedItem.Text; objcarsInfo.InteriorColor = ddlInteriorColor.SelectedItem.Text; objcarsInfo.Transmission = ddlTransmission.SelectedItem.Text; objcarsInfo.DriveTrain = ddlDriveTrain.SelectedItem.Value; objcarsInfo.NumberOfDoors = ddlDoorCount.SelectedItem.Value; objcarsInfo.VIN = txtVin.Text; objcarsInfo.NumberOfCylinder = ddlCylinderCount.SelectedItem.Value; objcarsInfo.FueltypeId = Convert.ToInt32(ddlFuelType.SelectedItem.Value); if (txtZip.Text.Length == 4) { objcarsInfo.Zipcode = "0" + txtZip.Text; } else { objcarsInfo.Zipcode = txtZip.Text; } objcarsInfo.City = GeneralFunc.ToProper(txtCity.Text); objcarsInfo.StateID = ddlLocationState.SelectedItem.Value; string Condition = string.Empty; string CondiDescrip = string.Empty; Condition = GeneralFunc.ToProper(txtCondition.Text); string Title = txtTitle.Text; CondiDescrip = ddlCondition.SelectedItem.Text; objcarsInfo.CurrentPrice = txtCurrentPrice.Text; objcarsInfo.PurchaseCost = txtPurchaseCost.Text; DealerActions objDealer = new DealerActions(); objcarsInfo.Title = txtTitle.Text; DataSet dsCarsDetails = objDealer.USP_SaveCarDetails(objcarsInfo, Condition, CondiDescrip, Title, UID); Session["CarID"] = Convert.ToInt32(dsCarsDetails.Tables[0].Rows[0]["CarID"].ToString()); int Isactive; int CarIDs; int FeatureID; objUsedCarsInfo.SellerName = txtSellerName.Text; objUsedCarsInfo.Address1 = txtSellerAddress.Text; objUsedCarsInfo.City = GeneralFunc.ToProper(txtCity.Text); objUsedCarsInfo.State = ddlLocationState.SelectedItem.Text.ToString(); objUsedCarsInfo.StateID = ddlLocationState.SelectedItem.Value.ToString(); if (txtZip.Text.Length == 4) { objUsedCarsInfo.Zip = "0" + txtZip.Text; } else { objUsedCarsInfo.Zip = txtZip.Text; } objUsedCarsInfo.Phone = txtSellerPhone.Text; objUsedCarsInfo.Email = txtSellerEmail.Text; if ((Session["SellerID"] == null) || (Session["SellerID"].ToString() == "")) { objUsedCarsInfo.SellerID = Convert.ToInt32(0); } else { objUsedCarsInfo.SellerID = Convert.ToInt32(Session["SellerID"].ToString()); } CarIDs = Convert.ToInt32(Session["CarID"].ToString()); int PackageID; int PaymentID; int PostingID; PackageID = Convert.ToInt32(Session["PackageID"]); if (Session["PaymentID"] == null) { PaymentID = Convert.ToInt32(0); } else if (Session["PaymentID"].ToString() == "") { PaymentID = Convert.ToInt32(0); } else { PaymentID = Convert.ToInt32(Session["PaymentID"]); } if (Session["PostingID"] == null) { PostingID = Convert.ToInt32(0); } else if (Session["PostingID"].ToString() == "") { PostingID = Convert.ToInt32(0); } else { PostingID = Convert.ToInt32(Session["PostingID"]); } String strHostName = Request.UserHostAddress.ToString(); string strIp = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString(); int UserPackID = 0; DealerActions objActions = new DealerActions(); DataSet dsPackages = objActions.USP_ChkPackageForAddCar(UID); if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); } else { dsPackages = objActions.USP_ChkExistingPackage(UID); if (dsPackages.Tables[0].Rows.Count > 0) { UserPackID = Convert.ToInt32(dsPackages.Tables[0].Rows[0]["UserPackID"].ToString()); } } DataSet dsposting = new DataSet(); dsposting = objDealer.USP_SaveSellerInfo(objUsedCarsInfo, CarIDs, UID, PackageID, PaymentID, UserPackID, PostingID, strIp); Session["PostingID"] = dsposting.Tables[0].Rows[0]["PostingID"].ToString(); for (int i = 1; i < 52; i++) { if (Session["CarID"] == null) { CarIDs = 0; } else { CarIDs = Convert.ToInt32(Session["CarID"].ToString()); } string ChkBoxID = "chkFeatures" + i.ToString(); CheckBox ChkedBox = (CheckBox)form1.FindControl(ChkBoxID); if (ChkedBox.Checked == true) { Isactive = 1; } else { Isactive = 0; } FeatureID = i; DataSet dsCarFeature = objDealer.USP_SaveCarFeatures(CarIDs, FeatureID, Isactive, UID); Session["CarID"] = Convert.ToInt32(dsCarFeature.Tables[0].Rows[0]["CarID"].ToString()); } mpealteruser.Show(); lblErr.Visible = true; lblErr.Text = "Car details saved successfully <br />Do you want to add photos now?"; // Response.Redirect("placeadPhotos.aspx"); } catch (Exception ex) { throw ex; } }
protected void Page_Load(object sender, EventArgs e) { if (Session[Constants.NAME] == null) { Response.Redirect("../login.aspx"); } else if (!IsPostBack) { Session["CurrentPage"] = "Home"; Session["PageName"] = ""; Session["CurrentPageConfig"] = null; // Session[Constants.NAME]; Session["UpDatePackageID"] = null; //lblUserName.Text = Session[Constants.NAME].ToString(); if (Cache["DsDropDown"] == null) { dsDropDown = objdropdownBL.Usp_Get_DropDown(); Cache["DsDropDown"] = dsDropDown; } else { dsDropDown = (DataSet)Cache["DsDropDown"]; } DealerActions objDealerAction = new DealerActions(); DataSet dsUserInfoDetails = objdropdownBL.USP_GetUSerDetailsByUserID(Convert.ToInt32(Session[Constants.USER_ID].ToString())); GetAllModels(); GetMakes(); GetBody(); FillYear(); FillFuelTypes(); FillStates(); FillExteriorColor(); FillInteriorColor(); FillCylinders(); FillDoors(); FillTransmissions(); FillDriveTrain(); FillCondition(); if (Request.QueryString != null) { string[] str = Request.QueryString[0].Split('P'); Session["PostingID"] = str[1]; if ((Session["PostingID"] != null) && (Session["PostingID"].ToString() != "")) { //btnUpdatePackage.Visible = true; DataSet dsCarDetailsInfo = new DataSet(); DealerActions objDealerActions = new DealerActions(); dsCarDetailsInfo = objDealerActions.USP_GetCustomerDetailsByPostingID(Convert.ToInt32(Session["PostingID"].ToString())); if (dsCarDetailsInfo.Tables[0].Rows.Count > 0) { Session["CarID"] = dsCarDetailsInfo.Tables[0].Rows[0]["carid"].ToString(); Session["PackageID"] = dsCarDetailsInfo.Tables[0].Rows[0]["packageID"].ToString(); Session["PaymentID"] = dsCarDetailsInfo.Tables[0].Rows[0]["PaymentID"].ToString(); Session["UserPackID"] = dsCarDetailsInfo.Tables[0].Rows[0]["UserPackID"].ToString(); Session["SellerID"] = dsCarDetailsInfo.Tables[0].Rows[0]["SellerID"].ToString(); hdnDealerUniqueID.Value = dsCarDetailsInfo.Tables[0].Rows[0]["DealerUniqueID"].ToString(); if (dsCarDetailsInfo.Tables[0].Rows[0]["IsActive"].ToString() == "True") { btnSold.Visible = true; btnWithdraw.Visible = true; btnActive.Visible = false; } else { btnSold.Visible = false; btnWithdraw.Visible = false; btnActive.Visible = true; } FillPackage(); ListItem list1 = new ListItem(); list1.Text = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString(); list1.Value = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString(); ddlYear.SelectedIndex = ddlYear.Items.IndexOf(list1); //ListItem list2 = new ListItem(); //list2.Value = ; //list2.Text = dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString(); ddlMake.SelectedIndex = ddlMake.Items.IndexOf(ddlMake.Items.FindByValue(dsCarDetailsInfo.Tables[0].Rows[0]["MakeID"].ToString())); GetModelsInfo(); ListItem list3 = new ListItem(); list3.Text = dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString(); list3.Value = dsCarDetailsInfo.Tables[0].Rows[0]["makeModelID"].ToString(); ddlModel.SelectedIndex = ddlModel.Items.IndexOf(list3); Session["SelYear"] = dsCarDetailsInfo.Tables[0].Rows[0]["yearOfMake"].ToString(); Session["SelMake"] = dsCarDetailsInfo.Tables[0].Rows[0]["make"].ToString(); Session["SelModel"] = dsCarDetailsInfo.Tables[0].Rows[0]["model"].ToString(); Session["MakeModelID"] = dsCarDetailsInfo.Tables[0].Rows[0]["makeModelID"].ToString(); txtCurrentPrice.Text = dsCarDetailsInfo.Tables[0].Rows[0]["CurrentPrice"].ToString(); txtPurchaseCost.Text = dsCarDetailsInfo.Tables[0].Rows[0]["PurchaseCost"].ToString(); ListItem list4 = new ListItem(); list4.Value = dsCarDetailsInfo.Tables[0].Rows[0]["bodyTypeID"].ToString(); list4.Text = dsCarDetailsInfo.Tables[0].Rows[0]["bodyType"].ToString(); ddlStyle.SelectedIndex = ddlStyle.Items.IndexOf(list4); ddlLocationState.SelectedIndex = ddlLocationState.Items.IndexOf(ddlLocationState.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["State"].ToString())); ddlFuelType.SelectedIndex = ddlFuelType.Items.IndexOf(ddlFuelType.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["fuelType"].ToString())); ddlExteriorColor.SelectedIndex = ddlExteriorColor.Items.IndexOf(ddlExteriorColor.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["exteriorColor"].ToString())); ddlInteriorColor.SelectedIndex = ddlInteriorColor.Items.IndexOf(ddlInteriorColor.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["interiorColor"].ToString())); ddlCylinderCount.SelectedIndex = ddlCylinderCount.Items.IndexOf(ddlCylinderCount.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["numberOfCylinder"].ToString())); ddlDoorCount.SelectedIndex = ddlDoorCount.Items.IndexOf(ddlDoorCount.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["NumberOfDoors"].ToString())); ddlTransmission.SelectedIndex = ddlTransmission.Items.IndexOf(ddlTransmission.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["Transmission"].ToString())); if (ddlTransmission.SelectedIndex == -1) { ddlTransmission.SelectedIndex = 0; } ddlDriveTrain.SelectedIndex = ddlDriveTrain.Items.IndexOf(ddlDriveTrain.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["DriveTrain"].ToString())); ddlCondition.SelectedIndex = ddlCondition.Items.IndexOf(ddlCondition.Items.FindByText(dsCarDetailsInfo.Tables[0].Rows[0]["ConditionDescription"].ToString())); if (ddlCondition.SelectedIndex == -1) { ddlCondition.SelectedIndex = 0; } txtSellerName.Text = dsCarDetailsInfo.Tables[0].Rows[0]["sellerName"].ToString(); txtSellerAddress.Text = GeneralFunc.ToProper(dsCarDetailsInfo.Tables[0].Rows[0]["address1"].ToString()); txtCity.Text = GeneralFunc.ToProper(dsCarDetailsInfo.Tables[0].Rows[0]["city"].ToString()); txtZip.Text = dsCarDetailsInfo.Tables[0].Rows[0]["zip"].ToString(); txtSellerPhone.Text = dsCarDetailsInfo.Tables[0].Rows[0]["phone"].ToString(); txtSellerEmail.Text = dsCarDetailsInfo.Tables[0].Rows[0]["email"].ToString(); if (dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString() == "0.0000") { txtAskingPrice.Text = ""; } else { txtAskingPrice.Text = string.Format("{0:0.00}", Convert.ToDouble(dsCarDetailsInfo.Tables[0].Rows[0]["price"].ToString())); } if (txtAskingPrice.Text.Length > 6) { txtAskingPrice.Text = txtAskingPrice.Text; } if (dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString() == "0.00") { txtMileage.Text = ""; } else { txtMileage.Text = string.Format("{0:0.00}", Convert.ToDouble(dsCarDetailsInfo.Tables[0].Rows[0]["mileage"].ToString())); } if (txtMileage.Text.Length > 6) { txtMileage.Text = txtMileage.Text; } txtVin.Text = dsCarDetailsInfo.Tables[0].Rows[0]["VIN"].ToString(); txtCondition.Text = dsCarDetailsInfo.Tables[0].Rows[0]["description"].ToString(); txtTitle.Text = dsCarDetailsInfo.Tables[0].Rows[0]["Title"].ToString(); for (int i = 1; i < 52; i++) { string ChkBoxID = "chkFeatures" + i.ToString(); CheckBox ChkedBox = (CheckBox)form1.FindControl(ChkBoxID); if (dsCarDetailsInfo.Tables[3].Rows.Count >= i) { if (dsCarDetailsInfo.Tables[3].Rows[i - 1]["Isactive"].ToString() == "True") { ChkedBox.Checked = true; } else { ChkedBox.Checked = false; } } else { ChkedBox.Checked = false; } } if (dsCarDetailsInfo.Tables[4].Rows.Count > 0) { lblExistUrlRes.Visible = false; divlblMultiSite.Style["display"] = "none"; grdMultiSites.Visible = true; grdMultiSites.DataSource = dsCarDetailsInfo.Tables[4]; grdMultiSites.DataBind(); } else { grdMultiSites.Visible = false; lblExistUrlRes.Visible = true; lblExistUrlRes.Text = "Not uploaded..!"; divlblMultiSite.Style["display"] = "block"; } } } } } }