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 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); }