コード例 #1
0
 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, "", "");
         }
     }
 }
コード例 #2
0
 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 = "";
     }
 }
コード例 #3
0
    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);
    }
コード例 #4
0
    private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "")
    {
        objPageFormate = new tblPageFormat();


        objDataTable = objPageFormate.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();
        }

        objPageFormate = null;
    }
コード例 #5
0
    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);
    }
コード例 #6
0
    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;
        }
    }