Пример #1
0
 protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         objCommon = new clsCommon();
         if (e.CommandName == "IsShowInSearch")
         {
             objProperty = new tblProperty();
             if (objProperty.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
             {
                 if (objProperty.AppIsShowInSearch == true)
                 {
                     objProperty.AppIsShowInSearch = false;
                 }
                 else if (objProperty.AppIsShowInSearch == false)
                 {
                     objProperty.AppIsShowInSearch = true;
                 }
                 objProperty.Save();
                 LoadDataGrid(false, false, "", "");
             }
         }
         else 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("tblProperty", tblProperty.ColumnNames.AppPropertyID, tblProperty.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("tblProperty", tblProperty.ColumnNames.AppPropertyID, tblProperty.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;
             }
             objProperty = null;
         }
     }
 }
Пример #2
0
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objProperty = new tblProperty();
         if (objProperty.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtPropertyName.Text      = objProperty.AppPropertyName;
             txtDisplayName.Text       = objProperty.AppDisplayName;
             txtDescription.Text       = objProperty.AppDescription;
             chkIsPredefine.Checked    = objProperty.AppIsPredefine;
             ChkIsShowInSearch.Checked = objProperty.AppIsShowInSearch;
             if (!objProperty.AppIsPredefine)
             {
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "SomeShoW()", true);
             }
             LoadAllData();
         }
         objProperty = null;
     }
 }
Пример #3
0
    private bool SaveData()
    {
        objCommon = new clsCommon();
        if (objCommon.IsRecordExists("tblProperty", tblProperty.ColumnNames.AppPropertyName, tblProperty.ColumnNames.AppPropertyID, txtPropertyName.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("Property Name alredy exits.", Enums.MessageType.Error);
            return(false);
        }
        if (objCommon.IsRecordExists("tblProperty", tblProperty.ColumnNames.AppDisplayName, tblProperty.ColumnNames.AppPropertyID, txtDisplayName.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("Display Name alredy exits.", Enums.MessageType.Error);
            return(false);
        }
        objProperty = new tblProperty();
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objProperty.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objProperty.AddNew();
            objProperty.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblProperty", tblProperty.ColumnNames.AppDisplayOrder);
            objProperty.s_AppCreatedBy  = Session[appFunctions.Session.UserID.ToString()].ToString();
            objProperty.AppCreatedDate  = DateTime.Now;


            // objBanner.AppDisplayOrder = objClsCommon.GetNextDisplayOrder("tblBanner", tblBanner.ColumnNames.AppDisplayOrder);
        }
        objProperty.AppPropertyName   = txtPropertyName.Text;
        objProperty.AppDisplayName    = txtDisplayName.Text;
        objProperty.AppDescription    = txtDescription.Text;
        objProperty.AppIsPredefine    = chkIsPredefine.Checked;
        objProperty.AppIsShowInSearch = ChkIsShowInSearch.Checked;
        objProperty.Save();
        intPkId     = objProperty.AppPropertyID;
        objProperty = null;
        objCommon   = null;
        return(true);
    }