예제 #1
0
    protected void dgvProperty_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataControlRowType itemType = e.Row.RowType;

        switch (itemType)
        {
        case DataControlRowType.DataRow:
            bool   IsPreDefine   = Convert.ToBoolean(dgvProperty.DataKeys[e.Row.RowIndex].Values[1].ToString());
            string strPropertyId = dgvProperty.DataKeys[e.Row.RowIndex].Values[0].ToString();
            string strId         = dgvProperty.DataKeys[e.Row.RowIndex].Values[2].ToString();
            Label  lbl           = (Label)e.Row.FindControl("lblValue");
            if (IsPreDefine)
            {
                if (strId != "")
                {
                    tblPropertyPreValue objPropertyPreValue = new tblPropertyPreValue();
                    if (objPropertyPreValue.LoadByPrimaryKey(Convert.ToInt32(strId)))
                    {
                        lbl.Text = objPropertyPreValue.s_AppPreValue;
                    }
                    objPropertyPreValue = null;
                }
            }


            break;
        }
    }
예제 #2
0
    protected void dgvPropertyPreValue_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
        {
            objCommon = new clsCommon();
            if (e.CommandName == "Edit")
            {
                hdnPropertyPreValueId.Value = e.CommandArgument.ToString();
                SetPropertyPreValueValuesToControls();
            }
            else if (e.CommandName == "Up")
            {
                LinkButton  inkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;
                if (drCurrent.RowIndex > 0)
                {
                    GridViewRow drUp = dgvPropertyPreValue.Rows[drCurrent.RowIndex - 1];
                    objCommon.SetDisplayOrder("tblPropertyPreValue", tblPropertyPreValue.ColumnNames.AppPropertyPreValueID, tblPropertyPreValue.ColumnNames.AppDisplayOrder, (int)dgvPropertyPreValue.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvPropertyPreValue.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvPropertyPreValue.DataKeys[drUp.RowIndex].Values[0], (int)dgvPropertyPreValue.DataKeys[drUp.RowIndex].Values[1]);
                    LoadPropertyPreValueData(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "Down")
            {
                LinkButton  lnkButton = (LinkButton)e.CommandSource;
                GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;
                if (drCurrent.RowIndex < dgvPropertyPreValue.Rows.Count - 1)
                {
                    GridViewRow drUp = dgvPropertyPreValue.Rows[drCurrent.RowIndex + 1];
                    objCommon.SetDisplayOrder("tblPropertyPreValue", tblPropertyPreValue.ColumnNames.AppPropertyPreValueID, tblPropertyPreValue.ColumnNames.AppDisplayOrder, (int)dgvPropertyPreValue.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvPropertyPreValue.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvPropertyPreValue.DataKeys[drUp.RowIndex].Values[0], (int)dgvPropertyPreValue.DataKeys[drUp.RowIndex].Values[1]);
                    LoadPropertyPreValueData(false, false);
                    objCommon = null;
                }
            }
            else if (e.CommandName == "IsActive")
            {
                objPropertyPreValue = new tblPropertyPreValue();

                if (objPropertyPreValue.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    if (objPropertyPreValue.AppIsActive == true)
                    {
                        objPropertyPreValue.AppIsActive = false;
                    }
                    else if (objPropertyPreValue.AppIsActive == false)
                    {
                        objPropertyPreValue.AppIsActive = true;
                    }
                    objPropertyPreValue.Save();
                    LoadPropertyPreValueData(false, false);
                }
                objPropertyPreValue = null;
            }
        }
    }
예제 #3
0
 private void SetPropertyPreValueValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPropertyPreValueId.Value) && hdnPropertyPreValueId.Value != "")
     {
         objPropertyPreValue = new tblPropertyPreValue();
         if (objPropertyPreValue.LoadByPrimaryKey(Convert.ToInt32(hdnPropertyPreValueId.Value)))
         {
             txtPreValue.Text = objPropertyPreValue.AppPreValue;
             chkPropertyPreValueIsActive.Checked = objPropertyPreValue.AppIsActive;
         }
         objPropertyPreValue = null;
     }
 }
예제 #4
0
    private bool DeletePropertyPreValue(int intPKID)
    {
        bool retval = false;

        objPropertyPreValue = new tblPropertyPreValue();
        var _with1 = objPropertyPreValue;

        if (_with1.LoadByPrimaryKey(intPKID))
        {
            _with1.MarkAsDeleted();
            _with1.Save();
        }
        retval = true;
        objPropertyPreValue = null;
        return(retval);
    }
예제 #5
0
    public void LoadPropertyPreValueData(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "")
    {
        objPropertyPreValue = new tblPropertyPreValue();

        objDataTable = objPropertyPreValue.LoadGridData(ddlPropertyPreValueFields.SelectedValue, txtPropertyPreValueSearch.Text, hdnPKID.Value);

        //'Reset PageIndex of gridviews
        if (IsResetPageIndex)
        {
            if (dgvPropertyPreValue.PageCount > 0)
            {
                dgvPropertyPreValue.PageIndex = 0;
            }
        }

        dgvPropertyPreValue.DataSource = null;
        dgvPropertyPreValue.DataBind();
        lblPropertyPreValueCount.Text = 0.ToString();
        hdnSelectedIDs.Value          = "";

        //'Check for data into datatable
        if (objDataTable.Rows.Count <= 0)
        {
            DinfoPropertyPreValueData.ShowMessage("No data found", Enums.MessageType.Information);
            return;
        }
        else
        {
            if (ddlPropertyPreValuePerPage.SelectedItem.Text.ToLower() == "all")
            {
                dgvPropertyPreValue.AllowPaging = false;
            }
            else
            {
                dgvPropertyPreValue.AllowPaging = true;
                dgvPropertyPreValue.PageSize    = Convert.ToInt32(ddlPropertyPreValuePerPage.SelectedItem.Text);
            }

            lblPropertyPreValueCount.Text = objDataTable.Rows.Count.ToString();
            objDataTable = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort);
            dgvPropertyPreValue.DataSource = objDataTable;
            dgvPropertyPreValue.DataBind();
        }

        objPropertyPreValue = null;
    }
 protected void RepProperty_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
     {
         HiddenField hdn = (HiddenField)e.Item.FindControl("hdnPkId");
         if (hdn != null)
         {
             tblPropertyPreValue objValue = new tblPropertyPreValue();
             objDataTable = objValue.LoadOtherCategoryWisePropertyValue(hdn.Value, hdnTableName.Value);
             if (objDataTable.Rows.Count > 0)
             {
                 Repeater Rep = (Repeater)e.Item.FindControl("RepPropertyValue");
                 Rep.DataSource = objDataTable;
                 Rep.DataBind();
             }
             objValue = null;
         }
     }
 }
예제 #7
0
    private bool SavePropertyPreValueData()
    {
        if (hdnPKID.Value != "")
        {
            objCommon = new clsCommon();
            if (objCommon.IsRecordExists("tblPropertyPreValue", tblPropertyPreValue.ColumnNames.AppPreValue, tblPropertyPreValue.ColumnNames.AppPropertyPreValueID, txtPreValue.Text, hdnPropertyPreValueId.Value, tblPropertyPreValue.ColumnNames.AppPropertyID + "=" + hdnPKID.Value))
            {
                DInfoPropertyPreValue.ShowMessage("Pre-Value alredy exits.", Enums.MessageType.Error);
                return(false);
            }
            objPropertyPreValue = new tblPropertyPreValue();

            if (!string.IsNullOrEmpty(hdnPropertyPreValueId.Value) && hdnPropertyPreValueId.Value != "")
            {
                objPropertyPreValue.LoadByPrimaryKey(Convert.ToInt32(hdnPropertyPreValueId.Value));
            }
            else
            {
                objPropertyPreValue.AddNew();
                objPropertyPreValue.s_AppCreatedBy  = Session[appFunctions.Session.UserID.ToString()].ToString();
                objPropertyPreValue.AppCreatedDate  = DateTime.Now;
                objPropertyPreValue.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblPropertyPreValue", tblPropertyPreValue.ColumnNames.AppDisplayOrder, tblPropertyPreValue.ColumnNames.AppPropertyID + "=" + hdnPKID.Value);
            }
            objPropertyPreValue.s_AppPropertyID = hdnPKID.Value;
            objPropertyPreValue.AppPreValue     = txtPreValue.Text;
            objPropertyPreValue.AppIsActive     = chkPropertyPreValueIsActive.Checked;

            objPropertyPreValue.Save();
            objPropertyPreValue = null;
            objCommon           = null;
            return(true);
        }
        else
        {
            return(false);
        }
    }