public void LoadHighLight() { tblHighLight objHighLight = new tblHighLight(); objDataTable = objHighLight.LoadHighLight("3"); //RepHightLight.DataSource = objDataTable; //RepHightLight.DataBind(); objHighLight = null; StringBuilder strBulider = new StringBuilder(); strBulider.Append(""); if (objDataTable.Rows.Count > 0) { int i = 1; foreach (DataRow row in objDataTable.Rows) { if (i == 1) { strBulider.Append(" <div class=\"banner-bottom-grids\">"); } strBulider.Append(" <div class=\"col-md-4 "); if (!(i % 2 == 0)) { strBulider.Append("first"); } strBulider.Append(" bottom-grid\" >"); // strBulider.Append("<a href='" + row[tblHighLight.ColumnNames.AppUrl].ToString() != "" ? row[tblHighLight.ColumnNames.AppUrl].ToString() : "#" + "' >"); strBulider.Append(" <img src=\"" + strServerURL + "admin/" + row[tblHighLight.ColumnNames.AppImage].ToString() + "\" alt=\"" + row[tblHighLight.ColumnNames.AppTitle].ToString() + "\" />"); strBulider.Append("<div class=\"bottom-grid-info\">"); strBulider.Append("<a href='"); if (row[tblHighLight.ColumnNames.AppUrl].ToString() != "") { strBulider.Append(row[tblHighLight.ColumnNames.AppUrl].ToString()); } else { strBulider.Append("#"); } strBulider.Append("' >" + row[tblHighLight.ColumnNames.AppTitle].ToString() + " </a>"); strBulider.Append(" </div>"); // strBulider.Append(" </a> "); strBulider.Append("</div>"); i += 1; if (i == 4) { strBulider.Append("<div class=\"clear\">"); strBulider.Append("</div>"); strBulider.Append("</div>"); i = 0; } } } ltHighLight.Text = strBulider.ToString(); }
protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.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("tblHighLight", tblHighLight.ColumnNames.AppHighLightID, tblHighLight.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]); 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("tblBanner", tblBanner.ColumnNames.AppBannerID, tblBanner.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]); objCommon.SetDisplayOrder("tblHighLight", tblHighLight.ColumnNames.AppHighLightID, tblHighLight.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]); LoadDataGrid(false, false); objCommon = null; } } else if (e.CommandName == "IsActive") { objHighLight = new tblHighLight(); if (objHighLight.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { if (objHighLight.AppIsActive == true) { objHighLight.AppIsActive = false; } else if (objHighLight.AppIsActive == false) { objHighLight.AppIsActive = true; } objHighLight.Save(); LoadDataGrid(false, false, "", ""); } objHighLight = null; } } }
private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "") { objHighLight = new tblHighLight(); objDataTable = objHighLight.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(); } objHighLight = null; }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objHighLight = new tblHighLight(); if (objHighLight.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { txtHighLightTitle.Text = objHighLight.AppTitle; chkIsActive.Checked = objHighLight.AppIsActive; txtappUrl.Text = objHighLight.AppUrl; //txtDescription.Text = objBanner.AppDescription; if (objHighLight.AppImage != "") { img.ImageUrl = objHighLight.AppImage; } } objHighLight = null; } }
private bool SaveData() { objClsCommon = new clsCommon(); objHighLight = new tblHighLight(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objHighLight.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objHighLight.AddNew(); objHighLight.AppDisplayOrder = objClsCommon.GetNextDisplayOrder("tblHighLight", tblHighLight.ColumnNames.AppDisplayOrder); } objHighLight.AppTitle = txtHighLightTitle.Text; objHighLight.AppIsActive = chkIsActive.Checked; objHighLight.AppUrl = txtappUrl.Text; //objHighLight.AppDescription = txtDescription.Text; if (FileUploadImg.HasFile) { string strError = ""; string Time = Convert.ToString(DateTime.Now.Month) + Convert.ToString(DateTime.Now.Day) + Convert.ToString(DateTime.Now.Year) + Convert.ToString(DateTime.Now.Hour) + Convert.ToString(DateTime.Now.Minute) + Convert.ToString(DateTime.Now.Second); string strPath = objClsCommon.FileUpload_Images(FileUploadImg.PostedFile, txtHighLightTitle.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/HighLight/", ref strError, 0, objHighLight.s_AppImage, false, 0, 2000); if (strError == "") { objHighLight.AppImage = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } } objHighLight.Save(); iHighLightID = objHighLight.AppHighLightID; objHighLight = null; objClsCommon = null; return(true); }
private bool Delete(int intPKID) { bool retval = false; objHighLight = new tblHighLight(); var _with1 = objHighLight; if (_with1.LoadByPrimaryKey(intPKID)) { if (System.IO.File.Exists(Server.MapPath(objHighLight.s_AppImage))) { System.IO.File.Delete(Server.MapPath(objHighLight.s_AppImage)); } _with1.MarkAsDeleted(); _with1.Save(); } retval = true; objHighLight = null; return(retval); }