private bool SaveData()
 {
     objCommon = new clsCommon();
     if (objCommon.IsRecordExists("tblSubCategory", tblSubCategory.ColumnNames.AppSubCategory, tblSubCategory.ColumnNames.AppSubCategoryID, txtSubCategoryName.Text, hdnPKID.Value, tblSubCategory.ColumnNames.AppCategoryID + "=" + ddlCategory.SelectedValue))
     {
         DInfo.ShowMessage("Sub Category Name alredy exits.", Enums.MessageType.Error);
         return(false);
     }
     objSubCategory = new tblSubCategory();
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objSubCategory.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
     }
     else
     {
         objSubCategory.AddNew();
         objSubCategory.s_AppCreatedBy  = Session[appFunctions.Session.UserID.ToString()].ToString();
         objSubCategory.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblSubCategory", tblSubCategory.ColumnNames.AppDisplayOrder, tblSubCategory.ColumnNames.AppCategoryID + "=" + ddlCategory.SelectedValue);
         // objSubCategory.s_AppCreatedDate = FormatDateString(DateTime.Now.ToString(strInputDateFormat), strInputDateFormat, strOutputDateFormat);
         objSubCategory.AppCreatedDate = DateTime.Now;
     }
     objSubCategory.s_AppSubCategory = txtSubCategoryName.Text;
     objSubCategory.s_AppCategoryID  = ddlCategory.SelectedValue;
     objSubCategory.AppIsActive      = chkIsActive.Checked;
     objSubCategory.Save();
     intPkId        = objSubCategory.AppSubCategoryID;
     objSubCategory = null;
     objCommon      = null;
     return(true);
 }
Exemplo n.º 2
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 == "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("tblSubCategory", tblSubCategory.ColumnNames.AppSubCategoryID, tblSubCategory.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("tblSubCategory", tblSubCategory.ColumnNames.AppSubCategoryID, tblSubCategory.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")
            {
                objSubCategory = new tblSubCategory();
                if (objSubCategory.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
                {
                    if (objSubCategory.AppIsActive == true)
                    {
                        objSubCategory.AppIsActive = false;
                    }
                    else if (objSubCategory.AppIsActive == false)
                    {
                        objSubCategory.AppIsActive = true;
                    }
                    objSubCategory.Save();
                    LoadDataGrid(false, false, "", "");
                }
                objSubCategory = null;
            }
        }
    }
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objSubCategory = new tblSubCategory();
         if (objSubCategory.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             ddlCategory.SelectedValue = objSubCategory.s_AppCategoryID;
             txtSubCategoryName.Text   = objSubCategory.AppSubCategory;
             chkIsActive.Checked       = objSubCategory.AppIsActive;
         }
         objSubCategory = null;
     }
 }
Exemplo n.º 4
0
 private void SetSubCategoryValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnSubCategoryId.Value) && hdnSubCategoryId.Value != "")
     {
         objPropertySubCategory = new tblPropertySubCategory();
         if (objPropertySubCategory.LoadByPrimaryKey(Convert.ToInt32(hdnSubCategoryId.Value)))
         {
             tblSubCategory objTemp = new tblSubCategory();
             if (objTemp.LoadByPrimaryKey(objPropertySubCategory.AppSubCategoryID))
             {
                 ddlCategory.SelectedValue = objTemp.s_AppCategoryID;
                 objCommon = new clsCommon();
                 objCommon = null;
             }
             objTemp = null;
         }
         objPropertySubCategory = null;
     }
 }
Exemplo n.º 5
0
 private void SetSubCategoryValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnSubCategoryId.Value) && hdnSubCategoryId.Value != "")
     {
         objSizeSubCategory = new tblSizeSubCategory();
         if (objSizeSubCategory.LoadByPrimaryKey(Convert.ToInt32(hdnSubCategoryId.Value)))
         {
             tblSubCategory objTemp = new tblSubCategory();
             if (objTemp.LoadByPrimaryKey(objSizeSubCategory.AppSubCategoryID))
             {
                 ddlCategory.SelectedValue = objTemp.s_AppCategoryID;
                 objCommon = new clsCommon();
                 //  objCommon.FillDropDownList(ddlSubCategory, "tblSubCategory ", tblSubCategory.ColumnNames.AppSubCategory, tblSubCategory.ColumnNames.AppSubCategoryID, "--Select Sub Category--", tblSubCategory.ColumnNames.AppSubCategory, appFunctions.Enum_SortOrderBy.Asc, tblSubCategory.ColumnNames.AppCategoryID + "=" + ddlCategory.SelectedValue);
                 objCommon = null;
                 // ddlSubCategory.SelectedValue = objSizeSubCategory.s_AppSubCategoryID;
             }
             objTemp = null;
         }
         objSizeSubCategory = null;
     }
 }