SlideShare a Scribd company logo
1 of 13
public bool CheckLeaveStatus(int empid, DateTime date)
{
bool temp = false;
int totalleave = 0;
string qry = "select joining from profile where
profileid=@id";
MySqlParameter idP = new MySqlParameter("@id", empid);
DataRow dr =
MySqlHelper.ExecuteDataRow(Common.GetConnectionString(), qry, idP);
if (dr != null)
{
DateTime joiningdate =
Convert.ToDateTime(dr["joining"]);
int legaldate = joiningdate.Day;
if (legaldate <= 15)
{
totalleave += 2;
}
else
{
totalleave += 0;
}
//TimeSpan t1 = date - joiningdate;
int monthspassed = Common.MonthDifference(date,
joiningdate);
if (monthspassed > 3)//then he is allowd to take leave
{
int startmonth = joiningdate.Month + 1;
int endmonth = date.Month;
int monthdiffernce = endmonth - startmonth;
/*here i am having problem how can i written logic for
two years passed from joiningdate and after that every month again
two leaves issued .in this previous leave is not taken care off and
leave taken count from new logic because two years passed */
if (monthdiffernce > 24)
{
monthdiffernce = 24;
}
int leaves = (monthdiffernce) * 2;
int allowedleaves = leaves + totalleave;
int availablelaves = allowedleaves -
LeaveTaken(empid);
if (availablelaves > 0)
{
temp = true;
}
}
//DateTime previousdate = date.AddYears(-2);
}
return temp;
}
public int LeaveTaken(int empid)
{
try
{
int taken = 0;
string qry = "select count(*) from leavestatus where
empid=@id";
MySqlParameter idP = new MySqlParameter("@id", empid);
taken =
Convert.ToInt32(MySqlHelper.ExecuteScalar(Common.GetConnectionString
(), qry, idP));
return taken;
}
catch
{
return 0;
}
}
public void AddLeaves(int empid, DateTime date, string status)
{
if (status == "L")
{
string qry = "insert into
leavestatus(empid,takenon)values(@empid,@takenon)";
MySqlParameter idP = new MySqlParameter("@empid",
empid);
MySqlParameter takenonP = new MySqlParameter("@takenon",
date);
MySqlParameter[] p = { idP, takenonP };
MySqlHelper.ExecuteNonQuery(Common.GetConnectionString(), qry, p);
}
}
-- phpMyAdminSQLDump
-- version 3.2.4
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 12, 2013 at01:24 AM
-- Server version: 5.1.41
-- PHP Version: 5.3.1
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/*!40101 SET
@OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET
@OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET
@OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SETNAMESutf8 */;
--
-- Database: `latrix`
--
-- --------------------------------------------------------
--
-- Table structure for table `designation`
--
CREATE TABLE IF NOT EXISTS `designation` (
`desig_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`desig_id`),
UNIQUE KEY `desig_id_UNIQUE`(`desig_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3;
--
-- Dumpingdatafor table `designation`
--
INSERT INTO `designation` (`desig_id`, `name`) VALUES
(1, 'Manager'),
(2, 'Office Assistance');
-- --------------------------------------------------------
--
-- Table structure for table `employees`
--
CREATE TABLE IF NOT EXISTS `employees`(
`emp_id`int(11) unsigned NOT NULL AUTO_INCREMENT,
`title_id` int(11) unsigned NOT NULL,
`name` varchar(60) NOT NULL DEFAULT 'unknown',
`fileno` varchar(20) NOT NULL DEFAULT 'TBD',
`max_leave` int(11) NOT NULL,
`mobile_phone` varchar(15) NOT NULL,
`leave_left` int(10) unsigned NOTNULL DEFAULT '0',
`designation_desig_id` int(11) NOT NULL,
PRIMARY KEY (`emp_id`),
KEY `idx_title` (`title_id`),
KEY `idx_payroll`(`fileno`),
KEY `idx_name` (`name`),
KEY `fk_employees_designation1` (`designation_desig_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3;
--
-- Dumpingdatafor table `employees`
--
INSERT INTO `employees`(`emp_id`, `title_id`, `name`, `fileno`, `max_leave`,
`mobile_phone`, `leave_left`, `designation_desig_id`) VALUES
(1, 1, 'Admin', '0001', 0, 'no phone', 0, 0),
(2, 1, 'Krishno', '1', 0, '', 0, 0);
-- --------------------------------------------------------
--
-- Table structure for table `emp_leave`
--
CREATE TABLE IF NOT EXISTS `emp_leave`(
`emp_leave_id`int(10) unsigned NOTNULL AUTO_INCREMENT,
`emp_id`int(11) unsigned NOT NULL,
`start_date` date NOT NULL DEFAULT '0000-00-00',
`end_date` date NOT NULL DEFAULT '0000-00-00',
`workdays`decimal(4,1) unsigned NOTNULL DEFAULT '0.0',
`type_id` int(11) unsigned NOTNULL,
`is_half_day` tinyint(1) NOT NULL DEFAULT '0',
`is_am` tinyint(1) NOT NULL DEFAULT '0',
`note` text NOT NULL,
`submit_date` date NOT NULL,
`approved`tinyint(1) DEFAULT '0',
`approval_date`date NOT NULL,
`approval_emp_id` int(10) unsigned NOTNULL,
PRIMARY KEY (`emp_leave_id`),
KEY `idx_type` (`type_id`),
KEY `idx_start` (`start_date`),
KEY `fk_emp_leave_emp` (`emp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3;
--
-- Dumpingdatafor table `emp_leave`
--
INSERT INTO `emp_leave`(`emp_leave_id`, `emp_id`, `start_date`,
`end_date`, `workdays`, `type_id`, `is_half_day`, `is_am`, `note`, `submit_date`,
`approved`, `approval_date`, `approval_emp_id`) VALUES
(1, 2, '2013-01-16', '2013-01-18', '0.0', 1, 0, 0, 'bihu', '2013-01-12', 1, '2013-
01-12', 1),
(2, 2, '2013-01-22', '2013-01-25', '0.0', 1, 0, 0, 'bihu', '2013-01-12', 1, '2013-
01-12', 1);
-- --------------------------------------------------------
--
-- Table structure for table `leave_types`
--
CREATE TABLE IF NOT EXISTS `leave_types` (
`leave_type_id`int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
`description` varchar(200) NOTNULL,
`isPaid` tinyint(1) unsigned NOT NULL DEFAULT '0',
`isAWOL` tinyint(1) unsigned NOT NULLDEFAULT '0',
`isAnnual`tinyint(1) unsigned NOTNULL DEFAULT '0',
`needsNote` tinyint(1) unsigned NOTNULL DEFAULT '0',
PRIMARY KEY (`leave_type_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=2;
--
-- Dumpingdatafor table `leave_types`
--
INSERT INTO `leave_types`(`leave_type_id`, `name`, `description`, `isPaid`,
`isAWOL`, `isAnnual`, `needsNote`) VALUES
(1, 'CL', '', 1, 0, 0, 0);
-- --------------------------------------------------------
--
-- Table structure for table `titles`
--
CREATE TABLE IF NOT EXISTS `titles` (
`title_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(20) NOT NULL,
PRIMARY KEY (`title_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=5;
--
-- Dumpingdatafor table `titles`
--
INSERT INTO `titles` (`title_id`, `name`) VALUES
(1, 'Mr.'),
(2, 'Mrs.'),
(3, 'Ms.'),
(4, 'Dr.');
-- --------------------------------------------------------
--
-- Table structure for table `yesno`
--
CREATE TABLE IF NOT EXISTS `yesno` (
`idyesno`int(11) NOT NULL,
`option` varchar(5) NOT NULL,
PRIMARY KEY (`idyesno`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumpingdatafor table `yesno`
--
INSERT INTO `yesno`(`idyesno`, `option`) VALUES
(1, 'Yes'),
(2, 'No');
--
-- Constraints for dumped tables
--
--
-- Constraints for table `employees`
--
ALTER TABLE `employees`
ADD CONSTRAINT `fk_employees_designation1` FOREIGN KEY
(`designation_desig_id`) REFERENCES `designation`(`desig_id`) ON
DELETE NO ACTION ON UPDATE NO ACTION,
ADD CONSTRAINT `employees_ibfk_4`FOREIGN KEY (`title_id`)
REFERENCES `titles` (`title_id`) ON DELETE NO ACTION ON UPDATE NO
ACTION;
--
-- Constraints for table `emp_leave`
--
ALTER TABLE `emp_leave`
ADD CONSTRAINT `emp_leave_ibfk_1`FOREIGN KEY (`type_id`)
REFERENCES `leave_types`(`leave_type_id`) ON DELETE NO ACTION ON
UPDATE NO ACTION,
ADD CONSTRAINT `emp_leave_ibfk_2`FOREIGN KEY (`emp_id`)
REFERENCES `employees`(`emp_id`) ON DELETE NO ACTION ON UPDATE
NO ACTION;
/*!40101 SETCHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT
*/;
/*!40101 SET
CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS*/;
/*!40101 SET
COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
mysql
TABLENO.-2
Check Leave Status

More Related Content

What's hot

R57shell
R57shellR57shell
R57shellady36
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ EtsyNishan Subedi
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgramAmy Baxter
 
Yappo Groonga - with japanese search software history @ osdc.tw 2011
Yappo Groonga - with japanese search software history @ osdc.tw 2011Yappo Groonga - with japanese search software history @ osdc.tw 2011
Yappo Groonga - with japanese search software history @ osdc.tw 2011Kazuhiro Osawa
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1Ke Wei Louis
 
Instant Dynamic Forms with #states
Instant Dynamic Forms with #statesInstant Dynamic Forms with #states
Instant Dynamic Forms with #statesKonstantin Käfer
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation SpecificationsUnmon Mukherjee
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersEnkitec
 
MongoDB Analytics
MongoDB AnalyticsMongoDB Analytics
MongoDB Analyticsdatablend
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF Luc Bors
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegamehozayfa999
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassJean-Luc David
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsSam Hennessy
 

What's hot (20)

20. CodeIgniter edit images
20. CodeIgniter edit images20. CodeIgniter edit images
20. CodeIgniter edit images
 
2986815 Normas Icontec
2986815 Normas Icontec2986815 Normas Icontec
2986815 Normas Icontec
 
Daily notes
Daily notesDaily notes
Daily notes
 
201104 iphone navigation-based apps
201104 iphone navigation-based apps201104 iphone navigation-based apps
201104 iphone navigation-based apps
 
R57shell
R57shellR57shell
R57shell
 
Virtual Madness @ Etsy
Virtual Madness @ EtsyVirtual Madness @ Etsy
Virtual Madness @ Etsy
 
DiceSimulatorProgram
DiceSimulatorProgramDiceSimulatorProgram
DiceSimulatorProgram
 
Yappo Groonga - with japanese search software history @ osdc.tw 2011
Yappo Groonga - with japanese search software history @ osdc.tw 2011Yappo Groonga - with japanese search software history @ osdc.tw 2011
Yappo Groonga - with japanese search software history @ osdc.tw 2011
 
Super Advanced Python –act1
Super Advanced Python –act1Super Advanced Python –act1
Super Advanced Python –act1
 
Instant Dynamic Forms with #states
Instant Dynamic Forms with #statesInstant Dynamic Forms with #states
Instant Dynamic Forms with #states
 
Implementation Specifications
Implementation SpecificationsImplementation Specifications
Implementation Specifications
 
Understanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-DevelopersUnderstanding Optimizer-Statistics-for-Developers
Understanding Optimizer-Statistics-for-Developers
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
SQLAlchemy Seminar
SQLAlchemy SeminarSQLAlchemy Seminar
SQLAlchemy Seminar
 
MongoDB Analytics
MongoDB AnalyticsMongoDB Analytics
MongoDB Analytics
 
Ricky Bobby's World
Ricky Bobby's WorldRicky Bobby's World
Ricky Bobby's World
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Gta v savegame
Gta v savegameGta v savegame
Gta v savegame
 
Writing Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google GlassWriting Mirror API and Native Apps for Google Glass
Writing Mirror API and Native Apps for Google Glass
 
Adding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy ApplicationsAdding Dependency Injection to Legacy Applications
Adding Dependency Injection to Legacy Applications
 

Similar to Check Leave Status

- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.phpssuserfa5723
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 UsageWilliam Lee
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationUsing Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationAlex Hardman
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - BasicsPurvik Rana
 
SAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codessSAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codessrizrazariz
 
SAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codesSAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codesrizrazariz
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfJavedAnsari236392
 
Sentencias básicas en oracle
Sentencias básicas en oracleSentencias básicas en oracle
Sentencias básicas en oracleNelson Salinas
 
C++ adt c++ implementations
C++   adt c++ implementationsC++   adt c++ implementations
C++ adt c++ implementationsRex Mwamba
 
Oracle trigger
Oracle triggerOracle trigger
Oracle triggernasrul28
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfmichardsonkhaicarr37
 
Raw system logs processing with hive
Raw system logs processing with hiveRaw system logs processing with hive
Raw system logs processing with hiveArpit Patil
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스PgDay.Seoul
 
More than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cMore than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cGuatemala User Group
 

Similar to Check Leave Status (20)

- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php - Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
- Php myadmin sql dump-- version 4.0.10.7-- httpwww.php
 
Notes for SQLite3 Usage
Notes for SQLite3 UsageNotes for SQLite3 Usage
Notes for SQLite3 Usage
 
Sql ejercicio 1
Sql ejercicio 1Sql ejercicio 1
Sql ejercicio 1
 
sas aeroplan sample
sas aeroplan samplesas aeroplan sample
sas aeroplan sample
 
Using Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data VisualisationUsing Arbor/ RGraph JS libaries for Data Visualisation
Using Arbor/ RGraph JS libaries for Data Visualisation
 
Doctors association db file
Doctors association db fileDoctors association db file
Doctors association db file
 
Sql queries - Basics
Sql queries - BasicsSql queries - Basics
Sql queries - Basics
 
SAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codessSAS codes and tricks Comprehensive all codess
SAS codes and tricks Comprehensive all codess
 
SAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codesSAS codes and tricks Comprehensive all codes
SAS codes and tricks Comprehensive all codes
 
FMDB - SLC-Cocoaheads
FMDB - SLC-CocoaheadsFMDB - SLC-Cocoaheads
FMDB - SLC-Cocoaheads
 
COA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdfCOA_remaining_lab_works_077BCT033.pdf
COA_remaining_lab_works_077BCT033.pdf
 
Sentencias básicas en oracle
Sentencias básicas en oracleSentencias básicas en oracle
Sentencias básicas en oracle
 
C++ adt c++ implementations
C++   adt c++ implementationsC++   adt c++ implementations
C++ adt c++ implementations
 
Oracle trigger
Oracle triggerOracle trigger
Oracle trigger
 
in this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdfin this assignment you are asked to write a simple driver program an.pdf
in this assignment you are asked to write a simple driver program an.pdf
 
Raw system logs processing with hive
Raw system logs processing with hiveRaw system logs processing with hive
Raw system logs processing with hive
 
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
[Pgday.Seoul 2019] Citus를 이용한 분산 데이터베이스
 
greenDAO
greenDAOgreenDAO
greenDAO
 
More than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12cMore than 12 More things about Oracle Database 12c
More than 12 More things about Oracle Database 12c
 
Orasta500.c
Orasta500.cOrasta500.c
Orasta500.c
 

Recently uploaded

UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 

Recently uploaded (20)

UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

Check Leave Status

  • 1. public bool CheckLeaveStatus(int empid, DateTime date) { bool temp = false; int totalleave = 0; string qry = "select joining from profile where profileid=@id"; MySqlParameter idP = new MySqlParameter("@id", empid); DataRow dr = MySqlHelper.ExecuteDataRow(Common.GetConnectionString(), qry, idP); if (dr != null) { DateTime joiningdate = Convert.ToDateTime(dr["joining"]); int legaldate = joiningdate.Day; if (legaldate <= 15) { totalleave += 2; } else { totalleave += 0; } //TimeSpan t1 = date - joiningdate; int monthspassed = Common.MonthDifference(date, joiningdate); if (monthspassed > 3)//then he is allowd to take leave { int startmonth = joiningdate.Month + 1; int endmonth = date.Month; int monthdiffernce = endmonth - startmonth; /*here i am having problem how can i written logic for two years passed from joiningdate and after that every month again two leaves issued .in this previous leave is not taken care off and leave taken count from new logic because two years passed */ if (monthdiffernce > 24) { monthdiffernce = 24; } int leaves = (monthdiffernce) * 2; int allowedleaves = leaves + totalleave; int availablelaves = allowedleaves - LeaveTaken(empid); if (availablelaves > 0) { temp = true; } } //DateTime previousdate = date.AddYears(-2); }
  • 2. return temp; } public int LeaveTaken(int empid) { try { int taken = 0; string qry = "select count(*) from leavestatus where empid=@id"; MySqlParameter idP = new MySqlParameter("@id", empid); taken = Convert.ToInt32(MySqlHelper.ExecuteScalar(Common.GetConnectionString (), qry, idP)); return taken; } catch { return 0; } } public void AddLeaves(int empid, DateTime date, string status) { if (status == "L") { string qry = "insert into leavestatus(empid,takenon)values(@empid,@takenon)"; MySqlParameter idP = new MySqlParameter("@empid", empid); MySqlParameter takenonP = new MySqlParameter("@takenon", date); MySqlParameter[] p = { idP, takenonP }; MySqlHelper.ExecuteNonQuery(Common.GetConnectionString(), qry, p); } }
  • 3. -- phpMyAdminSQLDump -- version 3.2.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Jan 12, 2013 at01:24 AM -- Server version: 5.1.41 -- PHP Version: 5.3.1 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  • 4. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SETNAMESutf8 */; -- -- Database: `latrix` -- -- -------------------------------------------------------- -- -- Table structure for table `designation` -- CREATE TABLE IF NOT EXISTS `designation` ( `desig_id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(45) NOT NULL, PRIMARY KEY (`desig_id`), UNIQUE KEY `desig_id_UNIQUE`(`desig_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3; -- -- Dumpingdatafor table `designation` -- INSERT INTO `designation` (`desig_id`, `name`) VALUES (1, 'Manager'), (2, 'Office Assistance'); -- -------------------------------------------------------- -- -- Table structure for table `employees` -- CREATE TABLE IF NOT EXISTS `employees`( `emp_id`int(11) unsigned NOT NULL AUTO_INCREMENT, `title_id` int(11) unsigned NOT NULL, `name` varchar(60) NOT NULL DEFAULT 'unknown', `fileno` varchar(20) NOT NULL DEFAULT 'TBD', `max_leave` int(11) NOT NULL, `mobile_phone` varchar(15) NOT NULL,
  • 5. `leave_left` int(10) unsigned NOTNULL DEFAULT '0', `designation_desig_id` int(11) NOT NULL, PRIMARY KEY (`emp_id`), KEY `idx_title` (`title_id`), KEY `idx_payroll`(`fileno`), KEY `idx_name` (`name`), KEY `fk_employees_designation1` (`designation_desig_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3; -- -- Dumpingdatafor table `employees` -- INSERT INTO `employees`(`emp_id`, `title_id`, `name`, `fileno`, `max_leave`, `mobile_phone`, `leave_left`, `designation_desig_id`) VALUES (1, 1, 'Admin', '0001', 0, 'no phone', 0, 0), (2, 1, 'Krishno', '1', 0, '', 0, 0); -- -------------------------------------------------------- -- -- Table structure for table `emp_leave` -- CREATE TABLE IF NOT EXISTS `emp_leave`( `emp_leave_id`int(10) unsigned NOTNULL AUTO_INCREMENT, `emp_id`int(11) unsigned NOT NULL, `start_date` date NOT NULL DEFAULT '0000-00-00', `end_date` date NOT NULL DEFAULT '0000-00-00', `workdays`decimal(4,1) unsigned NOTNULL DEFAULT '0.0', `type_id` int(11) unsigned NOTNULL, `is_half_day` tinyint(1) NOT NULL DEFAULT '0', `is_am` tinyint(1) NOT NULL DEFAULT '0', `note` text NOT NULL, `submit_date` date NOT NULL, `approved`tinyint(1) DEFAULT '0', `approval_date`date NOT NULL, `approval_emp_id` int(10) unsigned NOTNULL, PRIMARY KEY (`emp_leave_id`), KEY `idx_type` (`type_id`), KEY `idx_start` (`start_date`), KEY `fk_emp_leave_emp` (`emp_id`)
  • 6. ) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=3; -- -- Dumpingdatafor table `emp_leave` -- INSERT INTO `emp_leave`(`emp_leave_id`, `emp_id`, `start_date`, `end_date`, `workdays`, `type_id`, `is_half_day`, `is_am`, `note`, `submit_date`, `approved`, `approval_date`, `approval_emp_id`) VALUES (1, 2, '2013-01-16', '2013-01-18', '0.0', 1, 0, 0, 'bihu', '2013-01-12', 1, '2013- 01-12', 1), (2, 2, '2013-01-22', '2013-01-25', '0.0', 1, 0, 0, 'bihu', '2013-01-12', 1, '2013- 01-12', 1); -- -------------------------------------------------------- -- -- Table structure for table `leave_types` -- CREATE TABLE IF NOT EXISTS `leave_types` ( `leave_type_id`int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, `description` varchar(200) NOTNULL, `isPaid` tinyint(1) unsigned NOT NULL DEFAULT '0', `isAWOL` tinyint(1) unsigned NOT NULLDEFAULT '0', `isAnnual`tinyint(1) unsigned NOTNULL DEFAULT '0', `needsNote` tinyint(1) unsigned NOTNULL DEFAULT '0', PRIMARY KEY (`leave_type_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=2; -- -- Dumpingdatafor table `leave_types` -- INSERT INTO `leave_types`(`leave_type_id`, `name`, `description`, `isPaid`, `isAWOL`, `isAnnual`, `needsNote`) VALUES (1, 'CL', '', 1, 0, 0, 0); -- -------------------------------------------------------- --
  • 7. -- Table structure for table `titles` -- CREATE TABLE IF NOT EXISTS `titles` ( `title_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(20) NOT NULL, PRIMARY KEY (`title_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1AUTO_INCREMENT=5; -- -- Dumpingdatafor table `titles` -- INSERT INTO `titles` (`title_id`, `name`) VALUES (1, 'Mr.'), (2, 'Mrs.'), (3, 'Ms.'), (4, 'Dr.'); -- -------------------------------------------------------- -- -- Table structure for table `yesno` -- CREATE TABLE IF NOT EXISTS `yesno` ( `idyesno`int(11) NOT NULL, `option` varchar(5) NOT NULL, PRIMARY KEY (`idyesno`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1; -- -- Dumpingdatafor table `yesno` -- INSERT INTO `yesno`(`idyesno`, `option`) VALUES (1, 'Yes'), (2, 'No'); -- -- Constraints for dumped tables --
  • 8. -- -- Constraints for table `employees` -- ALTER TABLE `employees` ADD CONSTRAINT `fk_employees_designation1` FOREIGN KEY (`designation_desig_id`) REFERENCES `designation`(`desig_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `employees_ibfk_4`FOREIGN KEY (`title_id`) REFERENCES `titles` (`title_id`) ON DELETE NO ACTION ON UPDATE NO ACTION; -- -- Constraints for table `emp_leave` -- ALTER TABLE `emp_leave` ADD CONSTRAINT `emp_leave_ibfk_1`FOREIGN KEY (`type_id`) REFERENCES `leave_types`(`leave_type_id`) ON DELETE NO ACTION ON UPDATE NO ACTION, ADD CONSTRAINT `emp_leave_ibfk_2`FOREIGN KEY (`emp_id`) REFERENCES `employees`(`emp_id`) ON DELETE NO ACTION ON UPDATE NO ACTION; /*!40101 SETCHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS*/; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; mysql
  • 9.
  • 10.
  • 11.