ERM | ||
Monday, December 26, 2011
html source
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Uc_Menu.ascx.cs" Inherits="Uc_Menu" %>
jscript
// JScript File
function cmvChangeMenu(id){
var ChildMenuId = '';
if(id!="NoChild")
{
objDaughter=document.getElementById('idBlock'+id);
if (objDaughter.style.display=='none'){
objDaughter.style.display='block';
}
else{
if(objDaughter.style.display=='block'){
objDaughter.style.display='none';
}
}
}
}
jmenu
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class Uc_Menu : System.Web.UI.UserControl
{
# region Property
private int _vMenuHtml;
public int Pty_MenuHtml
{
get { return _vMenuHtml; }
set { _vMenuHtml = value; }
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
//if (Convert.ToInt32(Session["UserNumber"]) == 0) Response.Redirect("Login.aspx");
if (!IsPostBack)
BindMenu();
}
public void BindMenu()
{
try
{
lblMenu.Text = GenerateMenuHtml();
}
catch (Exception ex)
{ throw ex; }
}
//to generate Menu html Dynamically
private string GenerateMenuHtml()
{
string UrlId = "";
string MenuHtml = "";
try
{
Crm_Menu ObjMenu = new Crm_Menu();
DataTable Dt = new DataTable();
Dt = ObjMenu.getMenuTitles();
UrlId = ObjMenu.getMenuId(getUrl());
string ParentIdByURL = Convert.ToString(UrlId.Split('~')[0]);
string ChildIdByURL = Convert.ToString(UrlId.Split('~')[1]);
int oldParent = 0;
bool isChild = false;
for (int i = 0; i < Dt.Rows.Count; i++)
{
int newParentNo = Convert.ToInt32(Dt.Rows[i]["parent_menu_number"]);
if (oldParent != newParentNo)
{
if (oldParent > 0)
{
if (isChild) MenuHtml += "
"; }
isChild = false;
MenuHtml += "
";
if (Dt.Rows[i]["child_menu_number"] != null && Convert.ToString(Dt.Rows[i]["child_menu_number"]) != "")
{
MenuHtml += "
";
MenuHtml += Convert.ToString(Dt.Rows[i]["parent_menu_title"]) + "
"; isChild = true;
}
else
{
MenuHtml += "";
}
MenuHtml += "
"; if (isChild)
{
if (Convert.ToString(Dt.Rows[i]["parent_menu_number"]) == ParentIdByURL)
{
MenuHtml += "
";
}
else
{
MenuHtml += "
";
";
}
}
oldParent = Convert.ToInt32(Dt.Rows[i]["parent_menu_number"]);
}
string strInnerHtml = "";
if (isChild)
{
if (Convert.ToString(Dt.Rows[i]["child_menu_number"]) == ChildIdByURL)
{
strInnerHtml += "" + Convert.ToString(Dt.Rows[i]["child_menu_title"]) + "";
}
else
{
strInnerHtml += "" + Convert.ToString(Dt.Rows[i]["child_menu_title"]) + "";
}
MenuHtml += strInnerHtml + "";
}
}
if (isChild) MenuHtml += "
}
catch (Exception ex)
{ throw ex; }
return MenuHtml;
}
private string getUrl()
{
string StrFilePath = Request.RawUrl;
int StartPos = StrFilePath.LastIndexOf("/") + 1;
StrFilePath = StrFilePath.Substring(StartPos, StrFilePath.Length - StartPos).ToString();
return StrFilePath;
}
}
Tuesday, August 2, 2011
TNPSC Group II Answer key - 2011
Here the Answer key for TNPSC Group -2 which held on 30 th July 2011. Also find the
languages answer also in the following URL.
All the Very best !!!!
Click here for the Answer key !!!
languages answer also in the following URL.
All the Very best !!!!
Click here for the Answer key !!!
Wednesday, July 13, 2011
SQL Server Replication
This is the nice article about SQL Server replication in simple,
It helped me a lot,
Hope for you too.
SQL Server Replication
It helped me a lot,
Hope for you too.
SQL Server Replication
Wednesday, June 1, 2011
Dotnet Interview Questions
1. What is an interface?
2. What do you know about web service?
3. What is a nullable type?
4. Difference between value type and reference type?
5. Difference between hash table and array list?
6. What is a web service?
7. Diff between string and string builder?
8. Diff between user control and custom control. And how to use them?
Regarding the project:
1) Project explanation
2) What I have done in the project?
3) How asked about the database tables and how they are used in the .NET code
4) Currently what I am doing? For this I said there are some performance issues in the project so we are planning to redesign the project.
Then he asked how we are solving the issues?
SQL Server:
1. What is a trigger?
2. What are various types of joins?
3. What are DML and DDL commands?
4. Employee table:
EmpId EmpName Place City Country
If country is having null values write a query which replaces null values with India?
Ans : Select Empid, empname ,place,city ,isnull(Country,’india’) from Employee
5. Different types of joins
6. Write a query for Self Join?
===================================================================
1. What are the interested areas that u worked in ur current project
2. Explain ASP.Net page LifeCycle.
3. What are the New features .net 3.5 ?
4. What is an interface
5. What are the Oops Concepts that are used in ur project..
6. What is abstract classes in which scenario u choose abstract clases over an interface.. ?
7. What is the use Static classes.. ?
8. How do u implement Encapusaltion in dotnet.. ?
9. Difference between gridview and datagrid.. /
10. If you enable the EnableViewState and disable all the controls What it happens.
11. How can we install dll explicitly in .Net.
12. Solve this
Int a=5;
String str ;
Str = a; // We have to convert the int into string.
Will the program gets executed or else whats the error u rgetting how can u clear it.
1. Does Object is Value type or reference type.
2. What is stack and Queue.Examples of these.
13. Use of garbage collector ?
14. CTS .. ?
15. Can we use insert statement into the cursor or we had only direct insert statement.
16. What is meant by View state
17. Is it possible to view the data in view state..
18. Diiference between Storedprocedure and function .. ?
19. Can we write.. an update statement in function ?
===================================================================
Difference between User controls and Custom Controls
Differnece between Dataset.Acceptchanges() and DataAdapter.Update methods
Difference between Having and Where clause
Difference between Trace and Asset
Difference between constant and static variables
Difference between XML and xmlRPC
what is zagged Array in c#
COLLATE
multicast delegate
WSDL
UDDI
what is webmethod
which protocol will be used in web services
what is this operator
how you will see the Trace in the output window
what is master database
=================================================================
Difference between functions and Stored procedure
what is trigger
difference between stored procedure and trigger
why do we need trigger
what is stored procedure ? how it will reduce the network traffic
Is data will be stored by using Stored Procedure
what is virtual
class A having Add method and class B Add method defined
if class B inherits class A then how you will access Add method from class A
what is LINQ ? what it will do ? why do we need ?
how LINQ and database will be related
Is LINQ is best or stored procedure
explain present project
why do we needs Views
=====================================================================
2. What do you know about web service?
3. What is a nullable type?
4. Difference between value type and reference type?
5. Difference between hash table and array list?
6. What is a web service?
7. Diff between string and string builder?
8. Diff between user control and custom control. And how to use them?
Regarding the project:
1) Project explanation
2) What I have done in the project?
3) How asked about the database tables and how they are used in the .NET code
4) Currently what I am doing? For this I said there are some performance issues in the project so we are planning to redesign the project.
Then he asked how we are solving the issues?
SQL Server:
1. What is a trigger?
2. What are various types of joins?
3. What are DML and DDL commands?
4. Employee table:
EmpId EmpName Place City Country
If country is having null values write a query which replaces null values with India?
Ans : Select Empid, empname ,place,city ,isnull(Country,’india’) from Employee
5. Different types of joins
6. Write a query for Self Join?
===================================================================
1. What are the interested areas that u worked in ur current project
2. Explain ASP.Net page LifeCycle.
3. What are the New features .net 3.5 ?
4. What is an interface
5. What are the Oops Concepts that are used in ur project..
6. What is abstract classes in which scenario u choose abstract clases over an interface.. ?
7. What is the use Static classes.. ?
8. How do u implement Encapusaltion in dotnet.. ?
9. Difference between gridview and datagrid.. /
10. If you enable the EnableViewState and disable all the controls What it happens.
11. How can we install dll explicitly in .Net.
12. Solve this
Int a=5;
String str ;
Str = a; // We have to convert the int into string.
Will the program gets executed or else whats the error u rgetting how can u clear it.
1. Does Object is Value type or reference type.
2. What is stack and Queue.Examples of these.
13. Use of garbage collector ?
14. CTS .. ?
15. Can we use insert statement into the cursor or we had only direct insert statement.
16. What is meant by View state
17. Is it possible to view the data in view state..
18. Diiference between Storedprocedure and function .. ?
19. Can we write.. an update statement in function ?
===================================================================
Difference between User controls and Custom Controls
Differnece between Dataset.Acceptchanges() and DataAdapter.Update methods
Difference between Having and Where clause
Difference between Trace and Asset
Difference between constant and static variables
Difference between XML and xmlRPC
what is zagged Array in c#
COLLATE
multicast delegate
WSDL
UDDI
what is webmethod
which protocol will be used in web services
what is this operator
how you will see the Trace in the output window
what is master database
=================================================================
Difference between functions and Stored procedure
what is trigger
difference between stored procedure and trigger
why do we need trigger
what is stored procedure ? how it will reduce the network traffic
Is data will be stored by using Stored Procedure
what is virtual
class A having Add method and class B Add method defined
if class B inherits class A then how you will access Add method from class A
what is LINQ ? what it will do ? why do we need ?
how LINQ and database will be related
Is LINQ is best or stored procedure
explain present project
why do we needs Views
=====================================================================
Wednesday, May 4, 2011
Few SQL Interview Question Answers
Replication :
Replication is the process of copying and distributing data and database objects from one database to another and then synchronizing between databases for consistency.
Transactional Replication
Merge Replication
Snapshot Replication
Snowflake Schema :
A snowflake schema is a logical arrangement of tables in a multidimensional database
Correlated SubQuery :
A correlated subquery is a subquery where the inner query is evaluated once for every value returned by the outer query.
SELECT O.OrderID, O.OrderDate,
(SELECT MAX (Od.UnitPrice) FROM [Order Details] AS Od
WHERE Od.OrderID = O.orderid) AS MaxUnitPrice
FROM Orders AS O
Having and Where :
HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.
HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.
A HAVING clause is like a WHERE clause, but applies only to groups as a whole, whereas the WHERE clause applies to individual rows.
Difference Between Union vs. Union All
A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records
returned are unique from your union, use UNION ALL instead, it gives faster results.
SQL - Wildcard Operators :
The percent sign represents zero, one, or multiple characters. The underscore represents a single number or character. The symbols can be used in combinations.
How do you sort in SQL?
The ORDER BY keyword is used to sort the result-set by a specified column.
Explain the difference between optimistic and pessimistic locking.
In optimistic locking the row will not be locked until the actual update is performed. In order to prevent the lost update issue a version number column will be used.
In pessimistic locking the row will be locked at the time when the data is selected from the database. This will prevent other users who want to update the same record. This should not prevent the readers but this behaviour varies from database to database.
Replication is the process of copying and distributing data and database objects from one database to another and then synchronizing between databases for consistency.
Transactional Replication
Merge Replication
Snapshot Replication
Snowflake Schema :
A snowflake schema is a logical arrangement of tables in a multidimensional database
Correlated SubQuery :
A correlated subquery is a subquery where the inner query is evaluated once for every value returned by the outer query.
SELECT O.OrderID, O.OrderDate,
(SELECT MAX (Od.UnitPrice) FROM [Order Details] AS Od
WHERE Od.OrderID = O.orderid) AS MaxUnitPrice
FROM Orders AS O
Having and Where :
HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.
HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.
A HAVING clause is like a WHERE clause, but applies only to groups as a whole, whereas the WHERE clause applies to individual rows.
Difference Between Union vs. Union All
A UNION statement effectively does a SELECT DISTINCT on the results set. If you know that all the records
returned are unique from your union, use UNION ALL instead, it gives faster results.
SQL - Wildcard Operators :
The percent sign represents zero, one, or multiple characters. The underscore represents a single number or character. The symbols can be used in combinations.
How do you sort in SQL?
The ORDER BY keyword is used to sort the result-set by a specified column.
Explain the difference between optimistic and pessimistic locking.
In optimistic locking the row will not be locked until the actual update is performed. In order to prevent the lost update issue a version number column will be used.
In pessimistic locking the row will be locked at the time when the data is selected from the database. This will prevent other users who want to update the same record. This should not prevent the readers but this behaviour varies from database to database.
Tuesday, May 3, 2011
Selecting a software bridegroom..
Priya: hey! what is the matter you have called up all of a sudden?
Ramya: do u remember that my parents gave my horoscope, to search for a suitable match, to many people? So many horoscopes of the groom has come.. in that 4-5 seems to match.. I don't know which one to select, I am confused because of it.
Priya: what is the confusion about?
Ramya: horoscopes of many software engineers have come. That's why I don't know whom I must select among this. You are a software engineer na pls give me some suggestion .
Priya: not a problem at all. So tell me the position that each one holds.
Ramya: first is a manager .
Priya: manager?? Then he will showcast himself that he is busy always. But he will not do anything properly. He will get u 1 kg of rice and ask you to prepare for the whole area say a village. He will get you mutton and ask you to prepare chicken 65. Even if you protest telling you can't make it, he'll not accept. He will tell you to work hard day and night to prepare it. He will also tell he'll provide you with the night cab. Even if you ask how can I prepare chicken 65 out of it by sitting day and night he will not accept.
Ramya: ohh..so dangerous he is!! Then I must escape. Next is a test engineer.
Priya: he is more dangerous than the other person. Whatever you do he will correctly tell only the fault in it. Even if you try to surprise him with 10 variety of food, he will tell the item which does not have salt in it. If you ask him "will you not at least tell that it is good", he will reply back saying it is your duty to make it good so why must I tell that. He is sooo good ...
Ramya: then a NO to him also. Next is the performance test engineer.
Priya: he is another specimen. even if everything is good, he will ask why did it take this much time. If you take 10 minutes to make a coffee, he will question you asking why you have taken 10 min for a coffee which
can be done within 5 min. Even if you say that he is talking about the instant coffee while you have made the filter coffee, he will not accept. The same will be with all the work you do. You must not think about this person if you want to do make up in your life !!!
Ramya: then! you mean to say that we should not marry software guys??
Priya: who said like that?? In software there is one more group. They are called the developers group. How much ever you hit them they will bear.
Ramya: then tell about them.
Priya: you don't have to do anything. They will do everything themselves. If we sit back and just boost them it is enough. But the problem with them is- they will say "I know it" whatever you ask them. Even that is ok. They will bear how much ever you hit them but the condition is you must keep saying "you are too good" after hitting them every time.
Ramya: this is superb. Then we must search for this kind of a groom...
Ramya: do u remember that my parents gave my horoscope, to search for a suitable match, to many people? So many horoscopes of the groom has come.. in that 4-5 seems to match.. I don't know which one to select, I am confused because of it.
Priya: what is the confusion about?
Ramya: horoscopes of many software engineers have come. That's why I don't know whom I must select among this. You are a software engineer na pls give me some suggestion .
Priya: not a problem at all. So tell me the position that each one holds.
Ramya: first is a manager .
Priya: manager?? Then he will showcast himself that he is busy always. But he will not do anything properly. He will get u 1 kg of rice and ask you to prepare for the whole area say a village. He will get you mutton and ask you to prepare chicken 65. Even if you protest telling you can't make it, he'll not accept. He will tell you to work hard day and night to prepare it. He will also tell he'll provide you with the night cab. Even if you ask how can I prepare chicken 65 out of it by sitting day and night he will not accept.
Ramya: ohh..so dangerous he is!! Then I must escape. Next is a test engineer.
Priya: he is more dangerous than the other person. Whatever you do he will correctly tell only the fault in it. Even if you try to surprise him with 10 variety of food, he will tell the item which does not have salt in it. If you ask him "will you not at least tell that it is good", he will reply back saying it is your duty to make it good so why must I tell that. He is sooo good ...
Ramya: then a NO to him also. Next is the performance test engineer.
Priya: he is another specimen. even if everything is good, he will ask why did it take this much time. If you take 10 minutes to make a coffee, he will question you asking why you have taken 10 min for a coffee which
can be done within 5 min. Even if you say that he is talking about the instant coffee while you have made the filter coffee, he will not accept. The same will be with all the work you do. You must not think about this person if you want to do make up in your life !!!
Ramya: then! you mean to say that we should not marry software guys??
Priya: who said like that?? In software there is one more group. They are called the developers group. How much ever you hit them they will bear.
Ramya: then tell about them.
Priya: you don't have to do anything. They will do everything themselves. If we sit back and just boost them it is enough. But the problem with them is- they will say "I know it" whatever you ask them. Even that is ok. They will bear how much ever you hit them but the condition is you must keep saying "you are too good" after hitting them every time.
Ramya: this is superb. Then we must search for this kind of a groom...
Friday, April 22, 2011
ProgramC
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ProgramA
{
class Program
{
protected static int CalculateAge(int Day, int Month, int Year)
{
DateTime now = DateTime.Today;
int years = now.Year - Year;
if (now.Month < Month || (now.Month == Month && now.Day < Day))
--years;
return years;
}
protected static string Greeting(int Day, int Month)
{
DateTime now = DateTime.Today;
if (Day == now.Day && Month == now.Month)
{
return "HAPPY BIRTHDAY TO YOU!!!!";
}
else
{
return " ";
}
}
protected static DataTable LoadSunsignData(int year)
{
DataTable dtSunSign = new DataTable();
DataColumn dcol1 = new DataColumn("Sunsign", typeof(System.String));
dtSunSign.Columns.Add(dcol1);
DataColumn dcol2 = new DataColumn("FromDate", typeof(System.DateTime));
dtSunSign.Columns.Add(dcol2);
DataColumn dcol3 = new DataColumn("ToDate", typeof(System.DateTime));
dtSunSign.Columns.Add(dcol3);
DataRow drow = dtSunSign.NewRow();
drow["Sunsign"] = "Aries";
drow["FromDate"] = new DateTime(year, 3, 21);
drow["ToDate"] = new DateTime(year, 4, 20);
dtSunSign.Rows.Add(drow);
DataRow drow1 = dtSunSign.NewRow();
drow1["Sunsign"] = "Taurus";
drow1["FromDate"] = new DateTime(year, 4, 21);
drow1["ToDate"] = new DateTime(year, 5, 21);
dtSunSign.Rows.Add(drow1);
DataRow drow2 = dtSunSign.NewRow();
drow2["Sunsign"] = "Gemini";
drow2["FromDate"] = new DateTime(year, 5, 22);
drow2["ToDate"] = new DateTime(year, 6, 21);
dtSunSign.Rows.Add(drow2);
DataRow drow3 = dtSunSign.NewRow();
drow3["Sunsign"] = "Cancer";
drow3["FromDate"] = new DateTime(year, 6, 22);
drow3["ToDate"] = new DateTime(year, 7, 22);
dtSunSign.Rows.Add(drow3);
DataRow drow4 = dtSunSign.NewRow();
drow4["Sunsign"] = "Leo";
drow4["FromDate"] = new DateTime(year, 7, 23);
drow4["ToDate"] = new DateTime(year, 8, 21);
dtSunSign.Rows.Add(drow4);
DataRow drow5 = dtSunSign.NewRow();
drow5["Sunsign"] = "Virgo";
drow5["FromDate"] = new DateTime(year, 8, 22);
drow5["ToDate"] = new DateTime(year, 9, 23);
dtSunSign.Rows.Add(drow5);
DataRow drow6 = dtSunSign.NewRow();
drow6["Sunsign"] = "Libra";
drow6["FromDate"] = new DateTime(year, 9, 24);
drow6["ToDate"] = new DateTime(year, 10, 23);
dtSunSign.Rows.Add(drow6);
DataRow drow7 = dtSunSign.NewRow();
drow7["Sunsign"] = "Scorpio";
drow7["FromDate"] = new DateTime(year, 10, 24);
drow7["ToDate"] = new DateTime(year, 11, 22);
dtSunSign.Rows.Add(drow7);
DataRow drow8 = dtSunSign.NewRow();
drow8["Sunsign"] = "Sagittarius";
drow8["FromDate"] = new DateTime(year, 11, 23);
drow8["ToDate"] = new DateTime(year, 12, 22);
dtSunSign.Rows.Add(drow8);
DataRow drow9 = dtSunSign.NewRow();
drow9["Sunsign"] = "Capricorn";
drow9["FromDate"] = new DateTime(year, 12, 23);
drow9["ToDate"] = new DateTime(year + 1, 01, 20);
dtSunSign.Rows.Add(drow9);
DataRow drow10 = dtSunSign.NewRow();
drow10["Sunsign"] = "Aquarius";
drow10["FromDate"] = new DateTime(year + 1, 01, 21);
drow10["ToDate"] = new DateTime(year + 1, 02, 19);
dtSunSign.Rows.Add(drow10);
DataRow drow11 = dtSunSign.NewRow();
drow11["Sunsign"] = "Pisces";
drow11["FromDate"] = new DateTime(year + 1, 02, 20);
drow11["ToDate"] = new DateTime(year + 1, 03, 20);
dtSunSign.Rows.Add(drow11);
return dtSunSign;
}
protected static string getSunsign(DataTable dtSunsign, DateTime dtBirthDate)
{
string strSunsign = "";
DateTime dtFromDate, dtToDate;
for (int i = 0; i < dtSunsign.Rows.Count; i++)
{
dtFromDate = Convert.ToDateTime(dtSunsign.Rows[i]["FromDate"]);
dtToDate = Convert.ToDateTime(dtSunsign.Rows[i]["ToDate"]);
if (dtFromDate <= dtBirthDate && dtToDate >= dtBirthDate)
{
strSunsign = dtSunsign.Rows[i]["Sunsign"].ToString();
break;
}
}
return strSunsign;
}
static void Main(string[] args)
{
string dd, mm, yy;
int Age;
Console.WriteLine("Enter your BirthDay [ Day / Month / Year ] ");
Console.Write("Enter Day : ");
dd = Console.ReadLine();
Console.Write("Enter Month : ");
mm = Console.ReadLine();
Console.Write("Enter Year : ");
yy = Console.ReadLine();
Age = CalculateAge(Convert.ToInt32(dd), Convert.ToInt32(mm), Convert.ToInt32(yy));
if (Age > 0 && Age < 100)
{
Console.Write("Your Age is : " + Age);
Console.WriteLine();
Console.WriteLine(Greeting(Convert.ToInt32(dd), Convert.ToInt32(mm)).ToString());
DataTable dtSunsign = LoadSunsignData(Convert.ToInt32(yy));
DateTime dtBirthDate = new DateTime(Convert.ToInt32(yy), Convert.ToInt32(mm), Convert.ToInt32(dd));
Console.WriteLine("Your Sunsign is " + getSunsign(dtSunsign, dtBirthDate).ToString());
Console.Read();
}
else if (Age < 0 || Age > 100)
{
Console.Write("Age is Impossible");
Console.WriteLine();
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace ProgramA
{
class Program
{
protected static int CalculateAge(int Day, int Month, int Year)
{
DateTime now = DateTime.Today;
int years = now.Year - Year;
if (now.Month < Month || (now.Month == Month && now.Day < Day))
--years;
return years;
}
protected static string Greeting(int Day, int Month)
{
DateTime now = DateTime.Today;
if (Day == now.Day && Month == now.Month)
{
return "HAPPY BIRTHDAY TO YOU!!!!";
}
else
{
return " ";
}
}
protected static DataTable LoadSunsignData(int year)
{
DataTable dtSunSign = new DataTable();
DataColumn dcol1 = new DataColumn("Sunsign", typeof(System.String));
dtSunSign.Columns.Add(dcol1);
DataColumn dcol2 = new DataColumn("FromDate", typeof(System.DateTime));
dtSunSign.Columns.Add(dcol2);
DataColumn dcol3 = new DataColumn("ToDate", typeof(System.DateTime));
dtSunSign.Columns.Add(dcol3);
DataRow drow = dtSunSign.NewRow();
drow["Sunsign"] = "Aries";
drow["FromDate"] = new DateTime(year, 3, 21);
drow["ToDate"] = new DateTime(year, 4, 20);
dtSunSign.Rows.Add(drow);
DataRow drow1 = dtSunSign.NewRow();
drow1["Sunsign"] = "Taurus";
drow1["FromDate"] = new DateTime(year, 4, 21);
drow1["ToDate"] = new DateTime(year, 5, 21);
dtSunSign.Rows.Add(drow1);
DataRow drow2 = dtSunSign.NewRow();
drow2["Sunsign"] = "Gemini";
drow2["FromDate"] = new DateTime(year, 5, 22);
drow2["ToDate"] = new DateTime(year, 6, 21);
dtSunSign.Rows.Add(drow2);
DataRow drow3 = dtSunSign.NewRow();
drow3["Sunsign"] = "Cancer";
drow3["FromDate"] = new DateTime(year, 6, 22);
drow3["ToDate"] = new DateTime(year, 7, 22);
dtSunSign.Rows.Add(drow3);
DataRow drow4 = dtSunSign.NewRow();
drow4["Sunsign"] = "Leo";
drow4["FromDate"] = new DateTime(year, 7, 23);
drow4["ToDate"] = new DateTime(year, 8, 21);
dtSunSign.Rows.Add(drow4);
DataRow drow5 = dtSunSign.NewRow();
drow5["Sunsign"] = "Virgo";
drow5["FromDate"] = new DateTime(year, 8, 22);
drow5["ToDate"] = new DateTime(year, 9, 23);
dtSunSign.Rows.Add(drow5);
DataRow drow6 = dtSunSign.NewRow();
drow6["Sunsign"] = "Libra";
drow6["FromDate"] = new DateTime(year, 9, 24);
drow6["ToDate"] = new DateTime(year, 10, 23);
dtSunSign.Rows.Add(drow6);
DataRow drow7 = dtSunSign.NewRow();
drow7["Sunsign"] = "Scorpio";
drow7["FromDate"] = new DateTime(year, 10, 24);
drow7["ToDate"] = new DateTime(year, 11, 22);
dtSunSign.Rows.Add(drow7);
DataRow drow8 = dtSunSign.NewRow();
drow8["Sunsign"] = "Sagittarius";
drow8["FromDate"] = new DateTime(year, 11, 23);
drow8["ToDate"] = new DateTime(year, 12, 22);
dtSunSign.Rows.Add(drow8);
DataRow drow9 = dtSunSign.NewRow();
drow9["Sunsign"] = "Capricorn";
drow9["FromDate"] = new DateTime(year, 12, 23);
drow9["ToDate"] = new DateTime(year + 1, 01, 20);
dtSunSign.Rows.Add(drow9);
DataRow drow10 = dtSunSign.NewRow();
drow10["Sunsign"] = "Aquarius";
drow10["FromDate"] = new DateTime(year + 1, 01, 21);
drow10["ToDate"] = new DateTime(year + 1, 02, 19);
dtSunSign.Rows.Add(drow10);
DataRow drow11 = dtSunSign.NewRow();
drow11["Sunsign"] = "Pisces";
drow11["FromDate"] = new DateTime(year + 1, 02, 20);
drow11["ToDate"] = new DateTime(year + 1, 03, 20);
dtSunSign.Rows.Add(drow11);
return dtSunSign;
}
protected static string getSunsign(DataTable dtSunsign, DateTime dtBirthDate)
{
string strSunsign = "";
DateTime dtFromDate, dtToDate;
for (int i = 0; i < dtSunsign.Rows.Count; i++)
{
dtFromDate = Convert.ToDateTime(dtSunsign.Rows[i]["FromDate"]);
dtToDate = Convert.ToDateTime(dtSunsign.Rows[i]["ToDate"]);
if (dtFromDate <= dtBirthDate && dtToDate >= dtBirthDate)
{
strSunsign = dtSunsign.Rows[i]["Sunsign"].ToString();
break;
}
}
return strSunsign;
}
static void Main(string[] args)
{
string dd, mm, yy;
int Age;
Console.WriteLine("Enter your BirthDay [ Day / Month / Year ] ");
Console.Write("Enter Day : ");
dd = Console.ReadLine();
Console.Write("Enter Month : ");
mm = Console.ReadLine();
Console.Write("Enter Year : ");
yy = Console.ReadLine();
Age = CalculateAge(Convert.ToInt32(dd), Convert.ToInt32(mm), Convert.ToInt32(yy));
if (Age > 0 && Age < 100)
{
Console.Write("Your Age is : " + Age);
Console.WriteLine();
Console.WriteLine(Greeting(Convert.ToInt32(dd), Convert.ToInt32(mm)).ToString());
DataTable dtSunsign = LoadSunsignData(Convert.ToInt32(yy));
DateTime dtBirthDate = new DateTime(Convert.ToInt32(yy), Convert.ToInt32(mm), Convert.ToInt32(dd));
Console.WriteLine("Your Sunsign is " + getSunsign(dtSunsign, dtBirthDate).ToString());
Console.Read();
}
else if (Age < 0 || Age > 100)
{
Console.Write("Age is Impossible");
Console.WriteLine();
}
}
}
}
Subscribe to:
Posts (Atom)