protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { if (!string.IsNullOrEmpty(e.CommandArgument.ToString())) { hdnPKID.Value = e.CommandArgument.ToString(); if (e.CommandName == "IsActive") { objPageFormate = new tblPageFormat(); if (objPageFormate.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { if (objPageFormate.AppIsActive == true) { objPageFormate.AppIsActive = false; } else if (objPageFormate.AppIsActive == false) { objPageFormate.AppIsActive = true; } objPageFormate.Save(); } objPageFormate = null; LoadDataGrid(false, false, "", ""); } } }
protected void ddlPageFormats_SelectedIndexChanged(object sender, EventArgs e) { if (ddlPageFormats.SelectedValue != "0") { tblPageFormat objPageformat = new tblPageFormat(); if (objPageformat.LoadByPrimaryKey(Convert.ToInt32(ddlPageFormats.SelectedValue))) { if (objPageformat.s_AppImage != "") { imgPageFormat.ImageUrl = objPageformat.s_AppImage; } else { imgPageFormat.ImageUrl = ""; } } else { imgPageFormat.ImageUrl = ""; } } else { imgPageFormat.ImageUrl = ""; } }
private bool Delete(int intPKID) { bool retval = false; objPageFormate = new tblPageFormat(); if (objPageFormate.LoadByPrimaryKey(intPKID)) { objPageFormate.MarkAsDeleted(); objPageFormate.Save(); } retval = true; objPageFormate = null; return(retval); }
private bool SaveData() { objPageFormat = new tblPageFormat(); if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objPageFormat.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)); } else { objPageFormat.AddNew(); objPageFormat.AppCreatedDate = System.DateTime.Now; objPageFormat.AppCreatedBy = Convert.ToInt32(Session[appFunctions.Session.UserID.ToString()]); } objPageFormat.AppPageFormatName = txtPageFormatName.Text; objPageFormat.AppPageName = txtPageName.Text; objPageFormat.AppDescription = txtDescription.Text; objPageFormat.AppIsActive = chkIsActive.Checked; if (FileUploadImg.HasFile) { objClsCommon = new clsCommon(); 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, txtPageFormatName.Text.Trim().Replace(" ", "_") + "_" + Time, "Uploads/PageFormatImages/", ref strError, 0, objPageFormat.s_AppImage); if (strError == "") { objPageFormat.AppImage = strPath; } else { DInfo.ShowMessage(strError, Enums.MessageType.Error); return(false); } } objPageFormat.Save(); iPageFormateid = objPageFormat.AppPageFormatId; objPageFormat = null; objClsCommon = null; return(true); }
private void SetValuesToControls() { if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "") { objPageFormat = new tblPageFormat(); if (objPageFormat.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value))) { txtPageFormatName.Text = objPageFormat.AppPageFormatName; txtDescription.Text = objPageFormat.AppDescription; txtPageName.Text = objPageFormat.AppPageName; chkIsActive.Checked = objPageFormat.AppIsActive; if (objPageFormat.AppImage != "") { imgCurrent.ImageUrl = objPageFormat.AppImage; } } objPageFormat = null; } }