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);
 }
Ejemplo n.º 2
0
        public async Task <string> AddUpdateSubCategory(SubCategoryDomainModel subCategory)
        {
            string status = "";

            if (subCategory.subCat_id > 0)
            {
                tblSubCategory subCategoryToUpdate = await subCategoryRepository.SingleOrDefault(s => s.subCat_id == subCategory.subCat_id);

                if (subCategoryToUpdate != null)
                {
                    subCategoryToUpdate.subCat_id = subCategory.subCat_id;
                    subCategoryToUpdate.name      = subCategory.name;
                    subCategoryToUpdate.cat_id    = subCategory.cat_id;

                    await subCategoryRepository.Update(subCategoryToUpdate);

                    status = "updated";
                }
            }
            else
            {
                tblSubCategory subCategoryToAdd = new tblSubCategory();
                subCategoryToAdd.subCat_id = subCategory.subCat_id;
                subCategoryToAdd.name      = subCategory.name;
                subCategoryToAdd.cat_id    = subCategory.cat_id;

                await subCategoryRepository.Insert(subCategoryToAdd);

                status = "added";
            }
            return(status);
        }
Ejemplo n.º 3
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;
     }
 }
Ejemplo n.º 5
0
    private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "")
    {
        objSubCategory = new tblSubCategory();

        objDataTable = objSubCategory.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim(), ddlCategory.SelectedValue);

        //'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();
        }

        objSubCategory = null;
    }
Ejemplo n.º 6
0
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objSubCategory = new tblSubCategory();

        var _with1 = objSubCategory;

        if (_with1.LoadByPrimaryKey(intPKID))
        {
            _with1.MarkAsDeleted();
            _with1.Save();
        }

        retval         = true;
        objSubCategory = null;
        return(retval);
    }
Ejemplo n.º 7
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;
     }
 }
Ejemplo n.º 8
0
    protected void dgvCategory_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataControlRowType itemType = e.Row.RowType;

        switch (itemType)
        {
        case DataControlRowType.DataRow:
            string strID = dgvCategory.DataKeys[e.Row.RowIndex].Values[0].ToString();
            Label  lbl   = (Label)e.Row.FindControl("lblCategory");

            tblSubCategory objSubCategory = new tblSubCategory();

            objCommon = new clsCommon();
            lbl.Text  = ": " + objCommon.JoinWithComma(objSubCategory.GetAllSubCategoryProductWise(hdnPKID.Value, strID), tblSubCategory.ColumnNames.AppSubCategory, Enums.Enum_DataType.sString);
            objCommon = null;

            objSubCategory = null;
            break;
        }
    }
Ejemplo n.º 9
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;
     }
 }
Ejemplo n.º 10
0
 void IRepo <tblSubCategory> .remove(tblSubCategory entity)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 11
0
        public IEnumerable <tblSubCategory> find(tblSubCategory v)
        {
            var filteredList = subCategoriesList.Where(current => current.SubCategory_Name == v.SubCategory_Name);

            return(filteredList);
        }
Ejemplo n.º 12
0
    private void SetValuesToControls()
    {
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            tblProduct objproduct = new tblProduct();
            if (objproduct.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
            {
                lblProductCode.Text      = objproduct.AppProductCode;
                lblProductName.Text      = objproduct.AppProductName;
                lblProductTag.Text       = objproduct.AppProductTag;
                divDescription.InnerHtml = objproduct.AppDescription;
                if (objproduct.s_AppIsColor != "")
                {
                    if (objproduct.AppIsColor)
                    {
                        lblIsColor.Text = "Yes";
                    }
                }

                if (objproduct.s_AppIsSize != "")
                {
                    if (objproduct.AppIsSize)
                    {
                        lblIsSize.Text = "Yes";
                    }
                }


                divMetaKeyWord.InnerHtml     = objproduct.AppMetaKeyWord;
                divMetaDescription.InnerHtml = objproduct.AppMetaDescription;


                tblSubCategory objSubCategory = new tblSubCategory();
                objDataTable           = objSubCategory.GetAllCategoryProductWise(objproduct.s_AppProductID);
                dgvCategory.DataSource = null;
                dgvCategory.DataBind();
                if (objDataTable.Rows.Count > 0)
                {
                    divCategory.Style.Add("display", "block");
                    dgvCategory.DataSource = objDataTable;
                    dgvCategory.DataBind();
                }
                else
                {
                    divCategory.Style.Add("display", "none");
                }
                objSubCategory = null;

                tblProductColor objProductColor = new tblProductColor();
                objDataTable        = objProductColor.LoadGridData(objproduct.s_AppProductID, "0");
                dgvColor.DataSource = null;
                dgvColor.DataBind();
                if (objDataTable.Rows.Count > 0)
                {
                    divColor.Style.Add("display", "block");
                    dgvColor.DataSource = objDataTable;
                    dgvColor.DataBind();
                }
                else
                {
                    divColor.Style.Add("display", "none");
                }
                objProductColor = null;

                tblRelatedProduct objRelatedProduct = new tblRelatedProduct();
                objDataTable = objRelatedProduct.LoadRelatedProduct(objproduct.s_AppProductID);
                dgvRelatedProduct.DataSource = null;
                dgvRelatedProduct.DataBind();
                if (objDataTable.Rows.Count > 0)
                {
                    divRelatedProduct.Style.Add("display", "block");
                    dgvRelatedProduct.DataSource = objDataTable;
                    dgvRelatedProduct.DataBind();
                }
                else
                {
                    divRelatedProduct.Style.Add("display", "none");
                }
                objRelatedProduct = null;

                tblProductProperty objProductProperty = new tblProductProperty();

                objDataTable           = objProductProperty.LoadGridData(hdnPKID.Value);
                dgvProperty.DataSource = null;
                dgvProperty.DataBind();
                if (objDataTable.Rows.Count > 0)
                {
                    divProperty.Style.Add("display", "block");
                    dgvProperty.DataSource = objDataTable;
                    dgvProperty.DataBind();
                }
                else
                {
                    divProperty.Style.Add("display", "none");
                }
                objProductProperty = null;
            }
            objproduct = null;
        }
    }
Ejemplo n.º 13
0
    public void SetupStaticMenu(ref StringBuilder targetString)
    {
        tblCategory objCategory = new tblCategory();
        DataTable   dtCategory  = objCategory.LoadAllCategory();

        if (dtCategory.Rows.Count > 0)
        {
            string PageName = "";
            PageName = GetAlias("Products.aspx");
            tblSubCategory objSubCategory = new tblSubCategory();
            DataTable      dtSubCategory  = objSubCategory.LoadAllSubCategory();
            objSubCategory = null;
            foreach (DataRow Row in dtCategory.Rows)
            {
                targetString.Append("<li>");
                targetString.Append("<a href='" + PageName + generateUrl(Row[tblCategory.ColumnNames.AppCategory].ToString()) + "'>" + Row[tblCategory.ColumnNames.AppCategory].ToString() + "</a>");
                targetString.Append("<a class=\"plus\">+</a>");

                DataRow[] Subdr = dtSubCategory.Select(tblSubCategory.ColumnNames.AppCategoryID + "=" + Row[tblCategory.ColumnNames.AppCategoryID], tblSubCategory.ColumnNames.AppDisplayOrder + " Asc");
                if (Subdr.Length > 0)
                {
                    targetString.Append("<div class=\"megapanel\">");
                    targetString.Append(" <div class=\"row\">");
                    targetString.Append(" <div class=\"col2\">");
                    targetString.Append(" <div class=\"h_nav\">");
                    targetString.Append(" <h4>");
                    targetString.Append(Row[tblCategory.ColumnNames.AppCategory].ToString());
                    targetString.Append("</h4>");

                    int i = 0;
                    targetString.Append("<ul>");
                    foreach (DataRow SubRow in Subdr)
                    {
                        targetString.Append("<li>");
                        //if (i == Subdr.Length - 1)
                        //{

                        //    targetString.Append(" last");
                        //}
                        //targetString.Append(" \">");
                        targetString.Append("<a href='" + PageName + generateUrl(Row[tblCategory.ColumnNames.AppCategory].ToString()) + "/" + generateUrl(SubRow[tblSubCategory.ColumnNames.AppSubCategory].ToString()) + "'>" + SubRow[tblSubCategory.ColumnNames.AppSubCategory].ToString() + "</a>");
                        targetString.Append("</li>");
                        i++;
                    }
                    targetString.Append("</ul>");
                    targetString.Append("</div>");
                    targetString.Append("</div>");
                    tblExclusive objExclusive = new tblExclusive();
                    DataTable    dt           = objExclusive.LoadTop2Data(Row[tblCategory.ColumnNames.AppCategoryID].ToString());
                    if (dt.Rows.Count > 0)
                    {
                        foreach (DataRow dtRow in dt.Rows)
                        {
                            //targetString.Append("<a href='" + projectPrefix + Row["appAlias"].ToString() + "'>");
                            //if (Row["appMenuItemType"].ToString() == "Home")
                            //{
                            //    targetString.Append("<img src=\"" + projectPrefix + "Images/home.png\" width=\"16px\" style=\"padding:2px 0px;\" />");
                            //}

                            targetString.Append("<a href='" + dtRow[tblExclusive.ColumnNames.AppLink].ToString() + "'>");
                            targetString.Append("<div class=\"col2\"><div class=\"h_nav\"><h4>");
                            if (dtRow[tblExclusive.ColumnNames.AppTitle].ToString() != "")
                            {
                                targetString.Append(dtRow[tblExclusive.ColumnNames.AppTitle].ToString());
                            }
                            else
                            {
                                targetString.Append("Exclusive");
                            }
                            targetString.Append("</h4><div class=\"menuimg\"><img src=\"" + strServerURL + "admin/" + dtRow[tblExclusive.ColumnNames.AppImage].ToString() + "\"  /></div></div></div>");
                            targetString.Append("</a>");
                            //targetString.Append("<div class=\"col2\"><div class=\"h_nav\"><h4>Exclusive</h4><img src=\"" + strServerURL + "images/222.jpg\" width=\"100%\" /></div></div>");
                        }
                    }
                    objExclusive = null;

                    targetString.Append("</div>");
                    targetString.Append("</div>");
                }
                targetString.Append("</li>");
            }
        }
        dtCategory  = null;
        objCategory = null;
        //string PageName = "";
        //if (Enums.Enums_Type.Solution == intEnum)
        //{
        //    tblSolution objSolution = new tblSolution();
        //    objData = objSolution.GetAllSolution();
        //    objSolution = null;
        //    PageName = GetAlias("SolutionDetails.aspx");
        //}
        //else if (Enums.Enums_Type.Product == intEnum)
        //{
        //    tblProduct objProduct = new tblProduct();
        //    objData = objProduct.GetAllProduct();
        //    objProduct = null;
        //    PageName = GetAlias("ProductDetails.aspx");
        //}
        //if (objData.Rows.Count > 0)
        //{
        //    targetString.Append("<ul class=\"dropdown-menu\" > ");
        //    foreach (DataRow row in objData.Rows)
        //    {
        //        targetString.Append("<li><a href='" + PageName + generateUrl(row["appPage"].ToString()) + "'>" + row["appPage"].ToString() + "</a></li>");
        //    }

        //    targetString.Append("</ul>");
        //}
        //objData = null;
    }