protected void dgvProduct_RowCommand(object sender, GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "Save") { objCommon = new clsCommon(); objBestSeller = new tblBestSeller(); objBestSeller.AddNew(); objBestSeller.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblBestSeller", tblBestSeller.ColumnNames.AppDisplayOrder); objBestSeller.s_AppProductID = e.CommandArgument.ToString(); objBestSeller.AppIsActive = true; objBestSeller.Save(); objBestSeller = null; objCommon = null; LoadBestSeller1(true, false); LoadDataGrid(true, false); } } }
protected void dgvGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { objCommon = new clsCommon(); hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "Up") { LinkButton inkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent; if (drCurrent.RowIndex > 0) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1]; objCommon.SetDisplayOrder("tblBestSeller", tblBestSeller.ColumnNames.AppBestSellerID, tblBestSeller.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "Down") { LinkButton lnkButton = (LinkButton)e.CommandSource; GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent; if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1) { GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1]; objCommon.SetDisplayOrder("tblBestSeller", tblBestSeller.ColumnNames.AppBestSellerID, tblBestSeller.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[2], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[2]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "IsActive") { objBestSeller = new tblBestSeller(); if (objBestSeller.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { if (objBestSeller.AppIsActive == true) { objBestSeller.AppIsActive = false; } else if (objBestSeller.AppIsActive == false) { objBestSeller.AppIsActive = true; } objBestSeller.Save(); LoadDataGrid(false, false, "", ""); } objBestSeller = null; } } }
public void LoadBestSeller() { objBestSeller = new tblBestSeller(); objDataTable = objBestSeller.LoadBestSeller("8"); divBestSeller.Visible = true; if (objDataTable.Rows.Count <= 0) { divBestSeller.Visible = false; } rpBestSeller.DataSource = objDataTable; rpBestSeller.DataBind(); objBestSeller = null; }
public void LoadBestSeller1(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { tblBestSeller objBestSeller = new tblBestSeller(); // objDataTable = objProduct.LoadBestSeller(ddlCategory.SelectedValue, ddlSubCate.SelectedValue, ddlColor.SelectedValue); objDataTable = objBestSeller.LoadBestSelllerList(ddlCategory.SelectedValue, ddlSubCate.SelectedValue, ddlColor.SelectedValue); if (IsResetPageIndex) { if (dgvProduct.PageCount > 0) { dgvProduct.PageIndex = 0; } } dgvProduct.DataSource = null; dgvProduct.DataBind(); lblProductCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DinfoProduct.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvProduct.AllowPaging = false; } else { dgvProduct.AllowPaging = true; dgvProduct.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblProductCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvProduct.DataSource = objDataTable; dgvProduct.DataBind(); } objBestSeller = null; }
private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objBestSeller = new tblBestSeller(); objDataTable = objBestSeller.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim()); //'Reset PageIndex of gridviews if (IsResetPageIndex) { if (dgvGridView.PageCount > 0) { dgvGridView.PageIndex = 0; } } dgvGridView.DataSource = null; dgvGridView.DataBind(); lblCount.Text = 0.ToString(); hdnSelectedIDs.Value = ""; //'Check for data into datatable if (objDataTable.Rows.Count <= 0) { DInfo.ShowMessage("No data found", Enums.MessageType.Information); return; } else { if (ddlPerPage.SelectedItem.Text.ToLower() == "all") { dgvGridView.AllowPaging = false; } else { dgvGridView.AllowPaging = true; dgvGridView.PageSize = Convert.ToInt32(ddlPerPage.SelectedItem.Text); } lblCount.Text = objDataTable.Rows.Count.ToString(); objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort); dgvGridView.DataSource = objDataTable; dgvGridView.DataBind(); } objBestSeller = null; }
private bool Delete(int intPKID) { bool retval = false; objBestSeller = new tblBestSeller(); var _with1 = objBestSeller; if (_with1.LoadByPrimaryKey(intPKID)) { _with1.MarkAsDeleted(); _with1.Save(); } retval = true; objBestSeller = null; return(retval); }
public static string LoadProductData(string strPageSize, string strPageIndex, string strProperty, string strColor, string strSize, string strOrderBy, string strProduct, string strPrice) { strProduct = strProduct.ToString().Replace(" ", "_"); string strTotalCount = ""; string strMinPrice = ""; string strMaxPrice = ""; if (strPrice != "") { string[] strvalue = strPrice.Split(';'); strMinPrice = strvalue[0]; strMaxPrice = strvalue[1]; } string strRate = "1"; DataTable objDataTable = new DataTable(); if (strProduct == Enums.Enum_SearchTableName.Featured_Products.ToString()) { tblFeaturedProduct objFeatureProduct = new tblFeaturedProduct(); objDataTable = objFeatureProduct.LoadAllProductByPaging(strPageSize, strPageIndex, strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); strTotalCount = objFeatureProduct.GetCountProductByPaging(strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); objFeatureProduct = null; } else if (strProduct == Enums.Enum_SearchTableName.Best_Seller.ToString()) { tblBestSeller objBestSeller = new tblBestSeller(); objDataTable = objBestSeller.LoadAllProductByPaging(strPageSize, strPageIndex, strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); strTotalCount = objBestSeller.GetCountProductByPaging(strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); objBestSeller = null; } else if (strProduct == Enums.Enum_SearchTableName.New_Products.ToString()) { tblNewArrival objNewArrival = new tblNewArrival(); objDataTable = objNewArrival.LoadAllProductByPaging(strPageSize, strPageIndex, strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); strTotalCount = objNewArrival.GetCountProductByPaging(strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); objNewArrival = null; } else if (strProduct == Enums.Enum_SearchTableName.Trending.ToString()) { tblTrending objTrending = new tblTrending(); objDataTable = objTrending.LoadAllProductByPaging(strPageSize, strPageIndex, strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); strTotalCount = objTrending.GetCountProductByPaging(strProperty, strColor, strSize, strOrderBy, strMinPrice, strMaxPrice, strRate); objTrending = null; } StringBuilder strdiv = new StringBuilder(); if (objDataTable.Rows.Count > 0) { PageBase objPage = new PageBase(); string strPageName = objPage.GetAlias("ProductDetail.aspx"); // int i = 0; foreach (DataRow row in objDataTable.Rows) { strdiv.Append(" <div class='col_1_of_3 span_1_of_3'>"); //if (strSubCategory != "") //{ strdiv.Append("<a href='" + strPageName + objPage.generateUrl(row[tblProduct.ColumnNames.AppProductName].ToString()) + "'>"); //} //else //{ // strdiv.Append("<a href='" + strPageName + objPage.generateUrl(strCategory) + "/" + objPage.generateUrl(row[tblProduct.ColumnNames.AppProductName].ToString()) + "'>"); //} strdiv.Append("<div class='inner_content clearfix'>"); strdiv.Append("<div class='product_image'>"); if (Convert.ToInt32(row["appoff"].ToString()) == 0) { strdiv.Append("<span class='discount' style='display:none'>" + row["appoff"].ToString() + "% <span>Off</span></span>"); } else { strdiv.Append("<span class='discount' style='display:block'>" + row["appoff"].ToString() + "% <span>Off</span></span>"); } strdiv.Append("<img src='" + GetServerURL() + "/admin/" + row[tblProductImage.ColumnNames.AppNormalImage].ToString() + "' alt='' />"); strdiv.Append("</div>"); //strdiv.Append(" <div class='sale-box'>"); //strdiv.Append(" <span class='on_sale title_shop'>New</span></div>"); //strdiv.Append("</div>"); strdiv.Append("<div class='price'>"); strdiv.Append("<p class='title'>"); strdiv.Append(row[tblProduct.ColumnNames.AppProductName].ToString()); strdiv.Append("</p>"); strdiv.Append("<div class='cart-left'>"); strdiv.Append("<div class='price1'>"); strdiv.Append(" <span class='actual'>"); strdiv.Append(HttpContext.Current.Session[appFunctions.Session.CurrencyImage.ToString()].ToString() + Math.Round(Convert.ToDecimal(HttpContext.Current.Session[appFunctions.Session.CurrencyInRupee.ToString()].ToString()) * Convert.ToDecimal(row[tblProductDetail.ColumnNames.AppPrice].ToString()), 0).ToString()); strdiv.Append("</span>"); if (Convert.ToInt32(row["appoff"].ToString()) == 0) { strdiv.Append("<span class='priceMiddle' style='display:none'>"); } else { strdiv.Append("<span class='priceMiddle' style='display:block'>"); } strdiv.Append("<strike><span>"); strdiv.Append(HttpContext.Current.Session[appFunctions.Session.CurrencyImage.ToString()].ToString() + Math.Round(Convert.ToDecimal(HttpContext.Current.Session[appFunctions.Session.CurrencyInRupee.ToString()].ToString()) * Convert.ToDecimal(row[tblProductDetail.ColumnNames.AppMRP].ToString()), 0).ToString()); strdiv.Append("</span></strike></span>"); strdiv.Append("</div>"); strdiv.Append("</div>"); strdiv.Append("<a href='javascript:void(0);' Class='cart-right' onclick='AddToCart(" + row[tblProductDetail.ColumnNames.AppProductDetailID].ToString() + "," + row[tblProduct.ColumnNames.AppProductID].ToString() + "," + row[tblProductColor.ColumnNames.AppProductColorID].ToString() + "," + row[tblProductDetail.ColumnNames.AppSizeID].ToString() + ")'>Add To Cart</a>"); strdiv.Append("<div class='clear'>"); strdiv.Append("</div>"); strdiv.Append("</div>"); strdiv.Append("</div>"); strdiv.Append("</a>"); strdiv.Append("</div>"); } } return(strdiv.ToString() + "|" + strTotalCount); }