Results 1 to 3 of 3

Thread: # .Net. I need the answer ASAP

  1. #1
    Junior Member
    Join Date
    Jun 2008
    Answers
    2

    # .Net. I need the answer ASAP

    The following project should be completed as a c#.net website. It should consist of one form, dateconvert.aspx, and one code behind file, dateconvert.aspx.cs. Create a program that accepts a dd/mm/yyyy or dd-mm-yyyy input string representing a gregorian calendar date and converts it to its plain text equivalent. The program should be able to generate at least the error messages listed below. Your answer may not use any date or datetime library. (hint: years that are evenly divisible by 100 are leap years unless they are also evenly divisible by 400. February has 29 days in a leap year and 28 days otherwise.) examples: input output 12/06/1981 december 6, 1981 01/12/1966 january 12, 1966 02/29/1999 error: invalid number of days 13/12/2008 error: month must be between 1 and 12, inclusive 4/4/1999 error: input must be in dd/mm/yyyy or ddmm- yyyy format days per month month days january 31 february 28 or 29 march 31 april 30 may 31 june 30 july 31 august 31 september 30 october 31 november 30 december 31


  2. #2
    Junior Member
    Join Date
    Jun 2008
    Answers
    2

    MS-SQL---Please help to ans this

    -- ============================================= -- author: fordareh -- create date: 04/30/07 -- update history: -- *jas 04/30/07 - created as part of the driving force applicant selection program. -- -- description of what this sql currently already does: -- 1) create the sql tables, etask and etimelog -- 2) fill the sql tables with test data -- 3) provide stored procedure shell record -- 4) execute stored procedure using a valid value -- and a null value -- -- instructions for what this sql should do upon completion (to run, you'll have to replace xxxxxx with your -- database name <see first line below comment header>): -- -- - this sql should run in any installation of sql server 2005. [in the event that you do -- not have access to sql server 2005 for testing or do not have create/drop table/procedure privelages, -- please make your best attempt at writing the stored procedure and return as is.] -- -- - the sql below drops (if necessary) then recreates 2 sql tables: -- etask -- taskid int identity(1,1) primary key -- name varchar(50) not null -- description varchar(max) null -- duedate datetime not null -- -- etimelog -- timelogid int identity(1,1) primary key -- taskid int foreign key for etask -- hoursspend decimal(4,2) -- -- - these tables are intended to represent a very rudimentary time logging system for an hourly job -- -- - your job is to fill in the stored procedure (prcgetaggregatetimeloginfo) in part 3 such -- that the queries executed in part 4 will run successfully -- -- - prcgetaggregatetimeloginfo is designed to take a single, optional taskid as a parameter, -- and return a table containing one of 2 types of information: -- -- 1) for non-null taskids, prcgetaggregatetimeloginfo returns a summary of the time log data for a -- single task -- -- 2) for null taskids, prcgetaggregatetimeloginfo returns a summary of the time log data for every -- task record in etask -- -- - prcgetaggregatetimeloginfo should return the following column list: -- 1) etask.taskid -- 2) etask.name -- 3) etask.description -- 4) etask.duedate -- 5) sum(etimelog.hoursspend) -- 5) avg(etimelog.hoursspend) -- 5) min(etimelog.hoursspend) -- 5) max(etimelog.hoursspend) -- 5) count(etimelog.hoursspend) -- -- good luck! -- -- ============================================= -- replace xxxxxx with your database name use [xxxxxx] go -- ============================================= -- ============================================= -- 1) create the sql tables, etask and etimelog -- ============================================= -- ============================================= /* get rid of the foreign key from the time log to the task table */ if exists (select * from sys.foreign_keys where object_id = object_id(n'[dbo].[fk_etimelog_etask]') and parent_object_id = object_id(n'[dbo].[etimelog]')) alter table [dbo].[etimelog] drop constraint [fk_etimelog_etask] go /****** drop the time log ******/ if exists (select * from sys.objects where object_id = object_id(n'[dbo].[etimelog]') and type in (n'u')) drop table [dbo].[etimelog] go /****** drop the task table ******/ if exists (select * from sys.objects where object_id = object_id(n'[dbo].[etask]') and type in (n'u')) drop table [dbo].[etask] go /* recreate the task table */ set ansi_nulls on go set quoted_identifier on go set ansi_padding on go create table [dbo].[etask]( [taskid] [int] identity(1,1) not null, [name] [varchar](50) collate sql_latin1_general_cp1_ci_as not null, [description] [varchar](max) collate sql_latin1_general_cp1_ci_as null, [duedate] [datetime] not null, constraint [pk_etask] primary key clustered ( [taskid] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go set ansi_padding off /****** recreate the time log and foreign key ******/ set ansi_nulls on go set quoted_identifier on go create table [dbo].[etimelog]( [timelogid] [int] identity(1,1) not null, [taskid] [int] not null, [hoursspend] [decimal](4, 2) not null, constraint [pk_etimelog] primary key clustered ( [timelogid] asc )with (pad_index = off, statistics_norecompute = off, ignore_dup_key = off, allow_row_locks = on, allow_page_locks = on) on [primary] ) on [primary] go alter table [dbo].[etimelog] with check add constraint [fk_etimelog_etask] foreign key([taskid]) references [dbo].[etask] ([taskid]) go alter table [dbo].[etimelog] check constraint [fk_etimelog_etask] go -- ============================================= -- ============================================= -- 2) fill the sql tables with test data -- ============================================= -- ============================================= /* local to hold inserted task id */ declare @itaskid int insert into [etask] ([name] ,[description] ,[duedate]) values ('task 1' ,'description of task 1' ,dateadd(mm,2,getdate())) select @itaskid = scope_identity() insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,1.2) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,0.2) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,10.15) insert into [etask] ([name] ,[description] ,[duedate]) values ('task 2' ,'description of task 2' ,dateadd(mm,3,getdate())) select @itaskid = scope_identity() insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,1.9) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,4.5) insert into [etask] ([name] ,[description] ,[duedate]) values ('task 3' ,'description of task 3' ,dateadd(mm,3,getdate())) select @itaskid = scope_identity() insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,7.2) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,1.5) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,1.2) insert into [etimelog] ([taskid] ,[hoursspend]) values (@itaskid ,11.5) go -- ============================================= -- ============================================= -- 3) provide stored procedure shell record -- ============================================= -- ============================================= if exists(select * from sysobjects where [name] = n'prcgetaggregatetimeloginfo') drop procedure [prcgetaggregatetimeloginfo] go set ansi_nulls on go set quoted_identifier on go create procedure [prcgetaggregatetimeloginfo] ( @taskid int = null ) as begin /* answer goes here */ end go -- =============================================== -- =============================================== -- 4) execute stored procedure using a valid value -- and a null value -- =============================================== -- =============================================== execute [prcgetaggregatetimeloginfo] 3 execute [prcgetaggregatetimeloginfo] null


  3. #3
    Expert Member
    Join Date
    Dec 2007
    Answers
    138

    Re: # .Net. I need the answer ASAP

    Hey friend , purely i dont understand your problem ,, still i m giving solution please revert back me if i am incorrect.
    At the input text box where you taking the datetime please implement the validation (whatever you want ) and when user click on submit button first verify the conditions and if the true then nothing user can process and if false then accept the input


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact