Ejemplo n.º 1
0
    private void UpdatProductFile(int ProductID)
    {
        if (ProductID > 0)
        {
            int nCountColor = rptProducFile.Items.Count;

            for (int i = 1; i <= nCountColor; i++)
            {
                HtmlInputCheckBox chk = (HtmlInputCheckBox)rptProducFile.Items[i - 1].FindControl("chkFile");
                Label lblID = (Label)rptProducFile.Items[i - 1].FindControl("lblProductFileID");
                int nColorID = ConvertData.ConvertToInt(lblID.Text);

                DataTable dtbProductColor = new DataTable();
                ProductAndFile objSetColor = new ProductAndFile();

                dtbProductColor = objSetColor.SearchProductFile(ProductID);
                int nCount = dtbProductColor.Rows.Count;
                for (int j = 1; j <= nCount; j++)
                {
                    int nIDColorExist = (int)dtbProductColor.Rows[j - 1][1];
                    int nIDProductColorExist = (int)dtbProductColor.Rows[j - 1][0];
                    if (nIDColorExist == ConvertData.ConvertToInt(lblID.Text))
                    {
                        ProductAndFile objproductColor = new ProductAndFile();
                        objproductColor.DeleteById(nIDProductColorExist);
                    }
                }
                if (chk.Checked)
                {
                    ProductAndFile objproductColor = new ProductAndFile();
                    objproductColor.Data.ProductFileID = nColorID;
                    objproductColor.Data.ProductID = ProductID;
                    objproductColor.Insert();
                }

            }
        }
    }
Ejemplo n.º 2
0
    private void AddnewProductFile(int ProductID)
    {
        int nCountColor = rptProducFile.Items.Count;

        for (int i = 1; i <= nCountColor; i++)
        {
            HtmlInputCheckBox chk = (HtmlInputCheckBox)rptProducFile.Items[i - 1].FindControl("chkFile");
            Label lblID = (Label)rptProducFile.Items[i - 1].FindControl("lblProductFileID");
            int nColorID = ConvertData.ConvertToInt(lblID.Text);
            if (chk.Checked)
            {
                ProductAndFile objproductColor = new ProductAndFile();
                objproductColor.Data.ProductFileID = nColorID;
                objproductColor.Data.ProductID = ProductID;
                objproductColor.Insert();
            }
        }
    }