09/08/2010

Calculate Total value in Dynamically generated textbox

Text box dynamically in a Gridview in Asp.net:-

        <asp:GridView ID="GridView5" runat="server" CellPadding="4"
        EnableModelValidation="True" Width="1115px" AutoGenerateColumns="False"            
        BackColor="White" BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px">
        <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
        <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
        <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" />
        <RowStyle BackColor="White" ForeColor="#003399" />
        <SelectedRowStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
        <Columns>
        <asp:TemplateField HeaderText="ID">
        <ItemTemplate>
        <asp:Label ID="CId3" runat="server" Text=''> </asp:Label>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Student Name">
        <ItemTemplate>
        <asp:Label ID="CName3" runat="server" Text='' Width="120"></asp:Label>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Return">
        <ItemTemplate>
        <asp:TextBox ID="TextBox36" runat="server" Width="60px"></asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="1Mile/800 Meter">
        <ItemTemplate>
        <asp:TextBox ID="TextBox37" runat="server" Width="60px">
        </asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Marks">
        <ItemTemplate>
        <asp:TextBox ID="TextBox38" runat="server" Width="60px" >
        </asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Long Jump">
        <ItemTemplate>
        <asp:TextBox ID="TextBox39" runat="server" Width="60px"></asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Marks">
        <ItemTemplate>
        <asp:TextBox ID="TextBox40" runat="server" Width="60px"></asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="High Jump">
        <ItemTemplate>
        <asp:TextBox ID="TextBox41" runat="server" Width="60px"></asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Mark">
        <ItemTemplate>
        <asp:TextBox ID="TextBox42" runat="server" Width="60px">
        </asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Interview">
        <ItemTemplate>
 <asp:TextBox ID="TextBox43" runat="server" Width="60px"     
 onblur="validateField3(this)">
        </asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        <asp:TemplateField HeaderText="Total">
        <ItemTemplate>
        <asp:TextBox ID="TextBox44" runat="server" Width="60px" Enabled="false">
        </asp:TextBox>
        </ItemTemplate>
        </asp:TemplateField>
        </Columns>
        </asp:GridView>

 

Codes foJavaScript:-

<script language ="javascript" type="text/javascript">
      function validateField3(fieldname)
      {
          if ((fieldname.value) && (!fieldname.value.match(" ")))
          {
            var str = fieldname.id1;
            document.getElementById(fieldname.id.replace("43", "44")).value =   

            parseInt(document.getElementById(fieldname.id.replace("43", "36")).value) +     
            parseInt(document.getElementById(fieldname.id.replace("43", "38")).value) + 
            parseInt(document.getElementById(fieldname.id.replace("43", "40")).value) + 
            parseInt(document.getElementById(fieldname.id.replace("43", "42")).value) + 
            parseInt(document.getElementById(fieldname.id.replace("43", "43")).value);
          }
        }   
    </script>


Data bind:-


protected void Button3_Click(object sender, EventArgs e)

{


       DataAccess da = new DataAccess();
       da.OpenConnection();
       string id;
       foreach (GridViewRow row in GridView5.Rows)
        {
         string c = ddmonth.SelectedValue.ToString() + "/"   
                    + ddday.SelectedValue.ToString() + "/"
                    + ddyear.SelectedValue.ToString();
               id = ((Label)row.FindControl("Cid3")).Text;
          TextBox text36 = (TextBox)row.FindControl("TextBox36");
          TextBox text37 = (TextBox)row.FindControl("TextBox37");
          TextBox text38 = (TextBox)row.FindControl("TextBox38");
          TextBox text39 = (TextBox)row.FindControl("TextBox39");
          TextBox text40 = (TextBox)row.FindControl("TextBox40");
          TextBox text41 = (TextBox)row.FindControl("TextBox41");
          TextBox text42 = (TextBox)row.FindControl("TextBox42");
          TextBox text43 = (TextBox)row.FindControl("TextBox43");
          TextBox text44 = (TextBox)row.FindControl("TextBox44");
           
       if (text36 .Text !="" && text37 .Text !="" && text38 .Text  !="" && text39 .Text !="" && text40 .Text !="" && text41 .Text !="" && text42 .Text !="" && text43 .Text !="")
      {
       try
        {
         double sa = (double.Parse(text36.Text) +     double.Parse(text38.Text) + double.Parse(text40.Text) + double.Parse(text42.Text) + double.Parse(text43.Text));
         da.ExecuteNonQuery("Insert into PhysicalPractice(id,pdate,Rtnmarks,Atasemeter,mark1,Longjump,mark4,Highjump,mark5,interview,total) values('" + id + "','" + c + "','" +text36 .Text + "','" +text37 .Text + "','" +text38 .Text + "','" +text39 .Text  + "','" +text40 .Text + "','" +text41 .Text + "','" +text42 .Text + "','" +text43 .Text + "','" + sa.ToString() + "')");
         lbl_msg4.Text = "Record Save successfully";
         }
         catch (Exception ex)
         {
           Response.Write(ex.Message);
         }
         }
         else
         {
          lbl_msg4.Text = "Please enter all inforamation";
         }

        }

    }

}
 



10/06/2010

REPLACE (Transact-SQL)

Syntax
:-
REPLACE ( string_expression1 , string_expression2 , string_expression3 )
Arguments:-Is the string expression to be searched. string_expression1 can be of a character or binary data type.
string_expression2:-Is the substring to be found. string_expression2 can be of a character or binary data type.
Return Types
:-Returns nvarchar if one of the input arguments is of the nvarchar data type; otherwise, 
REPLACE returns varchar.Returns NULL if any one of the arguments is NULL. 
public void getinforamation()
    {
        DataAccess da = new DataAccess();
        DataSet ds = new DataSet();
        try
        {
            da.OpenConnection();
            ds = da.GetDataTable("select Empinfo.Name,REPLACE(Attaindance.Status, '1', 'present') AS Present, CONVERT (varchar, Attaindance.Adate, 103) AS Date FROM Empinfo INNER JOIN Attaindance ON Empinfo.Id = Attaindance.Id");
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }
        finally
        {
            da.CloseConnection();
        }
    }
 

10/04/2010

Activity diagram for Multilevel Marketing Management (MLM) system
























Activity diagrams are typically used for business process modeling, for modeling the logic captured by a single use case or usage scenario.


Initial node. The filled in circle is the starting point of the diagram.  An initial node isn’t required although it does make it significantly easier to read the diagram.
Activity final node. The filled circle with a border is the ending point.  An activity diagram can have zero or more activity final nodes
Activity.   The rounded rectangles represent activities that occur. An activity may be physical, such as Inspect Forms, or electronic, such as Display Create Student Screen.
Flow/edge.  The arrows on the diagram.  Although there is a subtle difference between flows and edges I have never seen a practical purpose for the difference although I have no doubt one exists.  I’ll use the term flow.
Fork.  A black bar with one flow going into it and several leaving it.  This denotes the beginning of parallel activity.
Join.  A black bar with several flows entering it and one leaving it.  All flows going into the join must reach it before processing may continue.  This denotes the end of parallel processing.
Condition.  Text such as [Incorrect Form] on a flow, defining a guard which must evaluate to true in order to traverse the node
Decision. A diamond with one flow entering and several leaving.  The flows leaving include conditions although some modelers will not indicate the conditions if it is obvious.
Merge.  A diamond with several flows entering and one leaving.  The implication is that one or more incoming flows must reach this point until processing continues, based on any guards on the outgoing flow.


  • Partition. is organized into three partitions, also called swimlanes, indicating who/what is performing the activities (either the ApplicantRegistrar, or System).
  • Sub-activity indicator.  Indicates that the activity is described by a more finely detailed activity diagram.  
  • Flow final.  The circle with the X through it.  This indicates that the process stops at this point

05/04/2010

Use case diagram for multilevel marketing management system(MLM)



















Use Case Diagram :-
Use case diagram is designed for visualizing and documenting the behavior of a system. The main notations of use case diagram include System (subject), Use Case, Actor, Association (communication link), Dependency and Generalization. Use case diagram is usually used in modeling the context of a system and requirements of system.


Elements of a Use Case Diagram:-

  1)Actors :- An actor portrays any entity (or entities) that performs certain roles in a given system.
                  An actor in a use case diagram interacts with a use case

2)Use case:-A use case in a use case diagram is a visual representation of a distinct business functionality in a  
                  system.
3)System boundary: -A system boundary defines the scope of what a system will be. A system cannot have  
                                infinite functionality.
               Use cases share different kinds of relationships. A relationship between two use cases is basically a dependency between the two use cases.