jbisono 51 Posting Pro in Training

Hi.
Can you show the example code?.

jbisono 51 Posting Pro in Training

its hard to say, because every business has their own way to do things but anyway every single business has to have some security, in a database i have a table with every single form and its controls and these tables related with users so i can deny or allow any user to certain areas or certain controls into a form. this recursive function its working for me, maybe its not the best approach but im happy with it. it recieve as paramenter a control collection from the form the user is entering, specific id to find in the control collection, the control type and a bool value to determine wether or not allow the access.

public static void SetControls(ControlCollection Controlsa, string id, string type, bool enable)
        {
            foreach (Control cntrl in Controlsa)
            {
                if (cntrl.ID == id)
                {
                    switch (type)
                    {
                        case "LinkButton" :
                            ((LinkButton)cntrl).Enabled = enable;
                            break;
                        case "TextBox" :
                            ((TextBox)cntrl).Enabled = enable;
                            break;
                        case "ImageButton":
                            ((ImageButton)cntrl).Enabled = enable; 
                            break;
                        case "Button":
                            ((Button)cntrl).Enabled = enable;
                            break;
                        case "RadioButton":
                            ((RadioButton)cntrl).Enabled = enable;
                            break;
                        case "DropDownList":
                            ((DropDownList)cntrl).Enabled = enable;
                            break;
                        case "CheckBox":
                            ((CheckBox)cntrl).Enabled = enable;
                            break;
                        case "Panel":
                            ((Panel)cntrl).Visible = enable;
                            break;
                        default : 
                            break;
                    }
                }
                if (cntrl.HasControls())
                {
                    SetControls(cntrl.Controls,id,type,enable);
                }
            }
        }

i put some controls examples. hope that help.

jbisono 51 Posting Pro in Training
string find = "AAD";
            string result = "<table><tr><td>AAD</td><td>35%</td></tr><tr><td>hola</td><td>40%</td></tr></table>";
            string[] arrLines = Regex.Split(result, @"<tr.*?>",RegexOptions.IgnoreCase);

            foreach (string strLine in arrLines)
            {
                string[] strCol = Regex.Split(strLine, @"<td.*?>",RegexOptions.IgnoreCase);
                for (int i = 0; i < strCol.Length; i+=1)
                {
                    string test = Regex.Replace(strCol[i], @"<[^>]*>", "");
                    if (test == find)
                    {
                        String Rate += Regex.Replace(strCol[i + 1], @"<[^>]*>", "");
                    }
                }
            }

this is not the best approach but it will do the work. the ouput is String Rate = 35%.

regards

jbisono 51 Posting Pro in Training

I have an intranet site for a company that i work for, build with asp.net ajax 3.5, c#.. but also i do maintain some joomla sites.

jbisono 51 Posting Pro in Training

To get the selected item from a dropdownlist you do this.

String selectedItem = DropDownList1.SelectedItem.Value;

now if you want to save that value right after the user change selection you have to set autopostback property in the dropdownlist to true and under the OnselectedIndexChanged event create your procedure to save that value in the database.

regards

jbisono 51 Posting Pro in Training

I guess you only need two tables to accomplish this a "PERSON" table which hold all general information. and a "friend" table contains two fields both pimary keys, "ID_PERSON" and "ID_PERSON_FRIEND" in this case to get the person's friend should be very straightforward

SELECT *
FROM         PERSON INNER JOIN
                      FRIEND ON FRIEND.ID_PERSON = PERSON.USER_ID INNER JOIN
                      PERSON AS PERSON_1 ON FRIEND.ID_PERSON_FRIEND = PERSON_1.USER_ID
WHERE     (PERSON.USER_ID = 1)

the above statement will give all friends that belong to the user_id = 1 in the same way you can get the friends of the user_id = 1's friends. let me know if you have any trouble doing that.

regards

jbisono 51 Posting Pro in Training

basically you have to create a forum system from scratch? and you want to know what type of controls you have to use and database design?

jbisono 51 Posting Pro in Training

you have to create a foreach loop like this

foreach(ListItem li in SelecteduserCheckBoxList.Items)
{
    if(li.Selected)
    {
        String itemSelect = li.Text;
    }
}

regards

jbisono 51 Posting Pro in Training

how you say, massive web sites like this one or others, requires massive period of time, and this time share by a group of people from different are of expertise that share knowledge to come up with a great and massive sites. what i can tell you right now is, that you are in the right track, if you know html(Read about xhtml also), css and you getting into asp.net. also learn javascript, ajax and xml, and any server side language like asp.net, php, ruby, jsp and so on.

those tools will make you strong to think big and come up with massive web sites.

jbisono 51 Posting Pro in Training

This is from mind, but i think you can do this.

for (int i = 0; i < e.RowCount; i++)
{
      DataGridViewRow row = dgvOrders.Rows[e.RowIndex + i];
      if (row.Cells["printedDataGridViewTextBoxColumn"].Value != DBNull.Value)
      {
           row.Cells["Printed"].Value = imlIcons.Images["Printed"];
      }
      else
      {
           row.Cells["Printed"].Value = imlIcons.Images["blank"];
      }
}

Try something like that.

jbisono 51 Posting Pro in Training

Can you show what have you done so far?

jbisono 51 Posting Pro in Training

once you have your dataset you can do this.

DataSet.Tables[IndexTable or NameTable].Rows[RowIndex][ColumnIndex].ToString()
jbisono 51 Posting Pro in Training

hey apegram i like your last approach, linq is the best :).

jbisono 51 Posting Pro in Training

cblTest = CheckBoxList control

List<string> AllModules = new List<string>() 
        { 
            "Module1", "Module2", "Module3", "Module4", "Module5", "Module6"
        };
        cblTest.DataSource = AllModules;
        cblTest.DataBind();
        string ModuleIds = "Module2,Module5";
        string[] arrayModule = ModuleIds.Split(',');
        foreach (string st in arrayModule)
        {
            cblTest.Items.FindByText(st).Selected = true;
        }

the above example works great, if you know that every single module in arrayModule exist in the checkboxlist item collection.

jbisono 51 Posting Pro in Training

the basic code to retrieve data to a dataset is like this.

SqlConnection conn = new SqlConnection("ConnectionString");
DataSet ds = new DataSet();
String sqlStatement = "Select FIelds From Table";
SqlDataAdapter adapt = new SqlDataAdapter(sqlStatement, conn);
adapt.Fill(ds);

now you have you result set into the dataset, then you can play with it.

jbisono 51 Posting Pro in Training

Oh i thought the running code in the windows schedule task was separately from the real program. Got it.

jbisono 51 Posting Pro in Training

I like your idea apegram!!!. the only thing is that I will exclude the date check since you can schedule windows to run daily in a specific time, i do not see the need to make date check.

jbisono 51 Posting Pro in Training
select *
from 1 
left outer join 2 on 1.a = 2.d
left outer join 3 on 2.f = 3.i
jbisono 51 Posting Pro in Training

Ok in visual you will need a code like this.

Dim SampleID As Integer
Dim ArticleNo As Integer
Dim SamplePoint As String
'Initiate your variables with some values
SampleId = 1
ArticleNo = 2
SamplePoint = "Some strings"
Dim conn as New System.Data.SqlClient.SqlConnection("Initial Catalog=DbName;Data Source=ServerName;UID=UserName;PWD=Password;")
Dim sSQL as String
sSQL = "INSERT INTO FGResultsTable VALUES("+SampleID+","+ArtilcleNo+",'"+SamplePoint+"')"			
Dim cmd as New SqlCommand(sSQL, conn)
conn.Open()
cmd.ExecuteNonQuery()
conn.Close()
jbisono 51 Posting Pro in Training

If you want to create a trigger in the update event do this.

create trigger money_from_vault
on table1
after update
as
DECLARE @Money Int
DECLARE @AccountID varchar(10)
SET @Money = (Select Money from Inserted)
SET @AccoundID = (Select AccountId from Inserted)
IF @Money != 0
BEGIN
UPDATE table2 SET Money=Money+@Money WHERE AccountID=@AccountID
END

I think that should do it.

jbisono 51 Posting Pro in Training

Ok do you need help trying to build the sql statement or you want to know whole process to insert data thru visual basic? I think I am misunderstanding what is it that you want to approach.

jbisono 51 Posting Pro in Training

Well in order for me create a query i would need you post the design table in what exactly you are expecting as a result. then i can help you.

jbisono 51 Posting Pro in Training

yes, but what i mean is make sure you are linking everything, for example i see you are linking the rowno field between all tables but maybe there is one table that you have to match two fields the rowno and another one to make that row distinct.

jbisono 51 Posting Pro in Training

What do you have so far? what exactly is that you stuck with?

jbisono 51 Posting Pro in Training

well if you want both tables to be the same if its not a problem i would say turn off the autonumber in the column's table you trying to insert to. then turn it back on. in think i did something like that once.

jbisono 51 Posting Pro in Training

I have a similar problem a few days ago, the problem was that i forgot to link a primary key with a foreign key, i suggest you that double check your links and that your not forgetting anything.

jbisono 51 Posting Pro in Training

Make a left outer join between Document and Clearance ,Document and Sedula.

jbisono 51 Posting Pro in Training

Run malware-bytes.

jbisono 51 Posting Pro in Training

there are two things i can think of first

SELECT     DATEPART(Month, DATE) AS month, DATENAME(month, DATE) AS Name, avg(NetAmount) as AverageCustomerBill from salesmaster 
GROUP BY DATEPART(Month, DATE), DATENAME(month, DATE)
ORDER BY DATEPART(Month, DATE)

the other one

SELECT     CASE DATEPART(Month, DATE) 
                      WHEN 1 THEN 'January' WHEN 2 THEN 'February' WHEN 3 THEN 'March' WHEN 4 THEN 'April' WHEN 5 THEN 'May' WHEN 6 THEN 'June' WHEN 7 THEN
                       'July' WHEN 8 THEN 'August' WHEN 9 THEN 'September' WHEN 10 THEN 'October' WHEN 11 THEN 'November' ELSE 'December' END AS month, 
                      avg(NetAmount) as AverageCustomerBill from salesmaster 
GROUP BY DATEPART(Month, DATE)
ORDER BY DATEPART(Month, DATE)

regards

jbisono 51 Posting Pro in Training

You can try making a stored procedure and see how faster you receive your answer back.

jbisono 51 Posting Pro in Training

Uhmmm, Thats wierd in my case it always pick it up automatically anyway, if you pay an external hosting you should contact their support, in the other hand if you are managing your own server then you have to find something to make a default content, for example in IIS its called Enable Default Content Page.

jbisono 51 Posting Pro in Training

Try replacing the left outer join with this
"LEFT OUTER JOIN Sedula ON Sedula.DocID = Document.DocNo" if that does not work I think you have to go over the design again, maybe if you explain a little bit what is the relation between these three tables i can help you finding any design problem.

jbisono 51 Posting Pro in Training

you can do something like this

GridViewRow selectedRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
//to get the value in the first column
string st = selectedRow.Cells[0].Text;
jbisono 51 Posting Pro in Training

maybe use a session variable to store the id.

jbisono 51 Posting Pro in Training

You can do something like this.

<a href="mailto:your_email_here@domain">Email</a>

jbisono 51 Posting Pro in Training

Then you cannot reference the sedula table thru the clearance table, just make the left outer join with document table. that should do it.

jbisono 51 Posting Pro in Training

well i maybe not following you correctly but maybe you just have to substract 8 - whatever answer was example if you select 1 then will be 8 -1 = 7 and so on.

regards.

jbisono 51 Posting Pro in Training

Ok. Glad to know.

jbisono 51 Posting Pro in Training
SELECT *
      FROM DOCUMENT INNER JOIN
      CLEARANCE ON CLEARANCE.DOC_ID = DOCUMENT.DocNo LEFT OUTER JOIN
      SEDULA ON SEDULA.DOC_ID = CLEARANCE.DOC_ID INNER JOIN PERSON ON PERSON.PersonID = DOCUMENT.PesonID INNER JOIN
OFFICER ON OFFICER.OfficerID = DOCUMENT.OfficerID

notice that in order to get information from person in officer table you have to make the links.

jbisono 51 Posting Pro in Training

Ok.

SELECT *
FROM DOCUMENT INNER JOIN
CLEARANCE ON CLEARANCE.DOC_ID = DOCUMENT.DocNo LEFT OUTER JOIN
SEDULA ON SEDULA.DOC_ID = CLEARANCE.DOC_ID

Try that.

jbisono 51 Posting Pro in Training

When you say document>certificate what exactly is certificate for you here, because i do not see any certificate table?

jbisono 51 Posting Pro in Training

I do not know if i got you right, anyway you said that a clearance may have a tax certificate sounds to me that you cannot make direct reference between the tax certificate and document but thru clearance table. if this is the case you will have something like this.

SELECT * 
FROM DOCUMENT INNER JOIN
CLEARANCE ON CLEARANCE.DOCUMENT_ID = DOCUMENT.ID LEFT OUTER JOIN TAX_CERTIFICATE ON TAX_CERTIFICATE.ID_CLEARANCE = CLEARANCE.ID

I may be wrong but you can show a little bit more of your table structure to give a more accurate answer.

regards

jbisono 51 Posting Pro in Training

Ok first in the button click event do this.

protected void btnClick_Click(object sender, EventArgs e)
        {
            ArrayList arr = new ArrayList();
            foreach(ListItem li in CheckBoxList1.Items)
            {
                if (li.Selected)
                {
                    arr.Add(li.Text);
                }
            }
            if (arr.Count > 0)
            {
                Session["checklist"] = arr;
                Response.Redirect("WebForm2.aspx");
            }
        }

now in the page load event from the new page.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (Session["checklist"] != null)
                {
                    ArrayList ar = (ArrayList)Session["checklist"];
                    for (int i = 0; i < ar.Count; i++)
                    {
                        Response.Write(System.Environment.NewLine + ar[i].ToString());
                    }
                }
            }
        }
jbisono 51 Posting Pro in Training

Solution so far, Install VS 2005 and Crystal XI Release 2 it work fine!!!. VS2008 waiting for patch.

jbisono 51 Posting Pro in Training

Hi!!!

I am developing an intranet web project using asp.net c# 2008 and i want to integrate crystal report XI, I wonder if anybody here have this two programs working correctly because i have two days trying to fix it, i have read a lot of posts nothing help. anyway please give the basic steps to get this working.

jbisono 51 Posting Pro in Training

Hello everyone.

The problem: I am developing a form that i have to validate some fields against the database. For this particular scenario lets say the Part ID field, I do not want to create a dropdownlist with all part id because is too big. maybe i can let people write down the part id in a textbox control and then validate, but sometimes they do not know the part id. Anyway my solution is create a custom control which i can display into a modalpopextender, this custom control contains a gridview control with the ids and description parts with sort, page and filter option.

now what i want to be able to do is when client select a specific part from the gridview, fill the PartId textbox control automatically and the modalpopextender will disappear.

Can you address me to right direction. so far I have the custom control, in the form i have this code.

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
 <asp:Button ID="Button1" runat="server" Text="Button" />
 <asp:Panel ID="pnlVendor" runat="server" CssClass="selector" style="display:none" >
//the code right below is my custom control
        <ew:Vendor ID="vndSelect" runat="server" />
    </asp:Panel>
    <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="pnlVendor" TargetControlID="Button1" >
    </cc1:ModalPopupExtender>

again when the client click button1 then pnlVendor will popup which contain my gridview with the parts when they hit select in the pop up the partid will show in TextBox1.

thanks for any help.

jbisono 51 Posting Pro in Training

above this line GridView1.DataSource = ds you are missing this one adp.Fill(ds)

jbisono 51 Posting Pro in Training

OK this is what you have to do. lets say i have this datagrid with this linkbutton it does not matter just replace the linkbutton for regular button

Properties to take a look, CommandName and OnRowCommand

<asp:GridView ID="gvTools" runat="server" OnRowCommand="GetDetails" AutoGenerateColumns="false">
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="lnkView" runat="server" Text="View" CommandName="View"></asp:LinkButton>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>

then and the background you have a function like this.

protected void GetDetails(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "View")
            {
                GridViewRow selectedRow = (GridViewRow)((LinkButton)e.CommandSource).NamingContainer;
//Just change the number for the cell you want.
                String variable = selectedRow.Cells[4].Text;
}
}

I hope that helps!!!.

jbisono 51 Posting Pro in Training

What do you have so far? post some code so we can help you out to fix it.

jbisono 51 Posting Pro in Training

Here is two ways that you can accomplish this query, refer to this thread: http://www.daniweb.com/forums/thread190891.html

Regards.