Exemplo n.º 1
0
    protected void gvIncorrectData_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (gvIncorrectData.EditIndex == e.Row.RowIndex)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                Saplin.Controls.DropDownCheckBoxes ddlMultiClient = (Saplin.Controls.DropDownCheckBoxes)e.Row.FindControl("ddlMultiple");
                //Saplin.Controls.DropDownCheckBoxes ddlMultiClient =
                SqlParameter[] parameters = new SqlParameter[]
                {
                    new SqlParameter("@emp", ddlEmp.SelectedItem.Text),
                    new SqlParameter("@team", ddlEmp.SelectedValue)
                };
                ds = new DataSet();
                if (rbUser.Checked == true)
                {
                    sQuery = "select * from RTM_Client_List, RTM_User_List where CL_TeamId= UL_Team_Id and UL_User_Name=@emp and CL_Status=1 and CL_ClientName <> 'Other' order by CL_ClientName";
                }
                else if (rbTeam.Checked == true)
                {
                    sQuery = "select * from RTM_Client_List where CL_TeamId= @team and CL_Status=1 and CL_ClientName <> 'Other' order by CL_ClientName";
                }

                ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, "multiclient");
                if (ds.Tables["multiclient"].Rows.Count > 0)
                {
                    ddlMultiClient.DataSource     = ds.Tables["multiclient"];
                    ddlMultiClient.DataTextField  = "CL_ClientName";
                    ddlMultiClient.DataValueField = "CL_ID";
                    ddlMultiClient.DataBind();
                }
            }
        }
    }
Exemplo n.º 2
0
    private DataSet getRecords()
    {
        //Namohar code changes on 12-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@from", DateTime.Parse(txtFromTime.Text).ToString("HH:mm:ss")),
            new SqlParameter("@to", DateTime.Parse(txtToTime.Text).ToString("HH:mm:ss")),
            new SqlParameter("@fromtxt", txtFrom.Text),
            new SqlParameter("@emp", ddlEmp.SelectedItem.Text),
        };

        if (ds.Tables.Contains("records"))
        {
            ds.Tables.Remove(ds.Tables["records"]);
        }
        if (ddlEmp.SelectedIndex == 0)
        {
            SQlQuery = "select R_ID, R_User_Name, CL_ClientName,  TL_Task, STL_SubTask from RTM_Records left join rtm_client_list on R_Client = CL_ID left join rtm_task_list on R_Task = TL_ID  left join rtm_subtask_list on R_SubTask = STL_ID where R_TeamId = 1 and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) =@fromtxt " +
                       "and convert(char(8), R_Start_Date_Time, 108) BETWEEN @from AND @to  Group by  CL_ClientName,  TL_Task,  STL_SubTask, R_ID, R_User_Name";
        }
        else
        {
            SQlQuery = "select R_ID, R_User_Name, CL_ClientName,  TL_Task, STL_SubTask from RTM_Records left join rtm_client_list on R_Client = CL_ID left join rtm_task_list on R_Task = TL_ID  left join rtm_subtask_list on R_SubTask = STL_ID where R_TeamId = 1 and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) =@fromtxt  and R_User_Name=@emp " +
                       "and convert(char(8), R_Start_Date_Time, 108) BETWEEN  @from AND @to  Group by  CL_ClientName,  TL_Task,  STL_SubTask, R_ID, R_User_Name";
        }

        //da.Fill(ds, "records");
        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "records");
        return(ds);
    }
    private DataSet GetRTMRecords()
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@date", txtDate.Text),
            new SqlParameter("@emp", ddlEmp.SelectedItem.Text),
            new SqlParameter("@id", lblid.Text),
        };

        if (ds.Tables.Contains("Records"))
        {
            ds.Tables.Remove(ds.Tables["Records"]);
        }

        if (ddlEmp.SelectedIndex == 0)
        {
            SQlQuery = "select R_User_Name, R_Client, CL_ClientName, R_Task, TL_Task, R_SubTask, STL_SubTask, sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600 as hour, (sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60 as minute,(sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60)))%60 as seconds " +
                       " from RTM_Records left join rtm_client_list on R_Client = CL_ID left join rtm_task_list on R_Task = TL_ID " +
                       " left join rtm_subtask_list on R_SubTask = STL_ID " +
                       " where R_TeamId =@id and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) = @date " +
                       " Group by R_User_Name, R_Client, CL_ClientName, R_Task, TL_Task, R_SubTask, STL_SubTask";
        }
        else
        {
            SQlQuery = "select R_User_Name, R_Client, CL_ClientName, R_Task, TL_Task, R_SubTask, STL_SubTask, sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600 as hour, (sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60 as minute,(sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60)))%60 as seconds " +
                       " from RTM_Records left join rtm_client_list on R_Client = CL_ID left join rtm_task_list on R_Task = TL_ID " +
                       " left join rtm_subtask_list on R_SubTask = STL_ID " +
                       " where R_TeamId =@id and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) =@date and R_User_Name=@emp " +
                       " Group by R_User_Name, R_Client, CL_ClientName, R_Task, TL_Task, R_SubTask, STL_SubTask";
        }

        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "Records");
        return(ds);
    }
Exemplo n.º 4
0
    private DataSet TodaysEffectiveRateResult()
    {
        //Namohar code changes on 12-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@dateS", DateTime.Now.ToShortDateString()),
        };

        if (Session["Location"].ToString() == "IND")
        {
            SQlQuery = "select  UserName, count(Distinct SKU_ID) as TotalCount, " +
                       "sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600 as hour, " +
                       "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60 as minute," +
                       "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60)))%60 as seconds " +
                       "from RTM_IPVDetails " +
                       "where CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, EndTime))) =@dateS and (SubTask_Id='1' or SubTask_Id='2' or SubTask_Id='3' or SubTask_Id='5') " +
                       "group by UserName order by count(Distinct SKU_ID) Desc";
        }
        else
        {
            SQlQuery = "select  UserName, count(Distinct SKU_ID) as TotalCount, " +
                       "sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600 as hour, " +
                       "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60 as minute," +
                       "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60)))%60 as seconds " +
                       "from RTM_IPVDetails " +
                       "where CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, EndTime))) =@dateS and SubTask_Id='1975' " +
                       "group by UserName order by count(Distinct SKU_ID) Desc";
        }

        //da.Fill(ds, "TodayRate");
        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "TodayRate");
        return(ds);
    }
Exemplo n.º 5
0
 public DataSet GetTeamName(string _teamId, string dtName)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@teamId", _teamId)
     };
     sQuery = "select T_TeamName from RTM_Team_List where T_ID= @teamId";
     ds     = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, dtName);
     //ds = objDB.DBExecDataSet(sQuery, dtName);
     return(ds);
 }
Exemplo n.º 6
0
        public DataSet LoadClient(string _teamId, string dtName)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@teamId", _teamId)
            };

            sQuery = "select * from RTM_Client_List where CL_TeamId= @teamId and CL_Status=1 and CL_ClientName !='Personal/Sick Time' and CL_ClientName!='Public Holiday' and CL_ClientName !='Inclement Weather' and CL_ClientName!='Vacation' and CL_ClientName !='Bereavement' and CL_ClientName!='Jury Duty' and CL_ClientName!='Maternity Leave' and CL_ClientName!='Paternity Leave' and CL_ClientName!='Medical Leave' and CL_ClientName!='Comp off' order by CL_ClientName";

            ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, dtName);
            return(ds);
        }
Exemplo n.º 7
0
    private DataSet GetTeamName(int id)
    {
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@id", id)
        };
        if (ds.Tables.Contains("Team"))
        {
            ds.Tables.Remove(ds.Tables["Team"]);
        }
        sQuery = "select T_TeamName from RTM_Team_List where T_ID= @id";

        ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, "Team");
        return(ds);
    }
    private DataSet GetData()
    {
        if (ds.Tables.Contains("data"))
        {
            ds.Tables.Remove(ds.Tables["data"]);
        }
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@from", txtFrom.Text),
            new SqlParameter("@to", txtTo.Text),
        };



        SQlQuery = "select RequestId = PARSENAME(REPLACE(R_Comments, ';', '.'),3), " +
                   "CASE PARSENAME(REPLACE(R_Comments, ';', '.'), 2) " +
                   "WHEN 'INP' THEN 'In Progress'  WHEN 'COM' THEN 'Completed'  WHEN 'CMP' THEN 'Completed' ELSE PARSENAME(REPLACE(R_Comments, ';', '.'), 2) " +
                   "END as [Status], " +
                   "CL_ClientName, TL_Task, STL_SubTask,  R_Duration from  " +
                   "RTM_Records, RTM_Client_List, rtm_task_list, rtm_subtask_list  " +
                   "where R_Client = CL_ID and R_Task = TL_ID and R_SubTask = STL_ID and R_TeamId ='13' " +
                   "and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) BETWEEN @from and @to and R_Duration != 'HH:MM:SS' and R_Duration != '' " +
                   "and STL_SubTask <> 'FA Support' and STL_SubTask <> 'Past Due Balance' and STL_SubTask <> 'Report & Queries' and STL_SubTask <> 'Service Order Validation' and STL_SubTask <>'Service Orders' and STL_SubTask <> 'Threshold Activity' and STL_SubTask <> 'Adhoc' and STL_SubTask <> 'Idle Time' and STL_SubTask <>'NEW Client' and STL_SubTask <> 'IPA & Service code' AND STL_SubTask <> 'TRG/DOC & Service Code' and STL_ServiceCode <> '000001006 - Learning | General/Internal'";
        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "data");
        return(ds);
    }
Exemplo n.º 9
0
    public DataSet GetUsers(int teamId)
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@teamId", teamId),
        };

        if (ds.Tables.Contains("users"))
        {
            ds.Tables.Remove(ds.Tables["users"]);
        }

        SQlQuery = "select * from RTM_User_List where UL_Team_Id=@teamId and UL_User_Status=1 order by UL_User_Name";
        ds       = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "users");
        return(ds);
    }
Exemplo n.º 10
0
    private DataSet fecthScheduledTimes(int TID)
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@TID", TID),
        };

        if (ds.Tables.Contains("times"))
        {
            ds.Tables.Remove(ds.Tables["times"]);
        }

        SQlQuery = "select distinct Convert(VARCHAR, UL_SCH_Login,108) as [Scheduled] from RTM_User_List WHERE UL_Team_Id =@TID and UL_User_status =1 order by Convert(VARCHAR, UL_SCH_Login,108)";
        ds       = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "times");
        return(ds);
    }
Exemplo n.º 11
0
    private DataSet TodaysEffectiveRateResult()
    {
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@date", DateTime.Now.ToShortDateString())
        };
        sQuery = "select  UserName, count(Distinct SKU_ID) as TotalCount, " +
                 "sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600 as hour, " +
                 "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60 as minute," +
                 "(sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(Duration,'-', '')))/60)%60)))%60 as seconds " +
                 "from RTM_IPVDetails " +
                 "where CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, EndTime))) = @date and (SubTask_Id='100' or SubTask_Id='103') " +
                 "group by UserName order by count(Distinct SKU_ID) Desc";

        da.Fill(ds, "TodayRate");
        ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, "TodayRate");
        return(ds);
    }
Exemplo n.º 12
0
    public DataSet FetchUsers()
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@team", ddlTeam.SelectedValue),
        };

        if (ds.Tables.Contains("users"))
        {
            ds.Tables.Remove(ds.Tables["users"]);
        }


        SQlQuery = "select * from RTM_User_List where UL_Team_Id =@team and UL_User_Status = 1";
        ds       = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "users");
        return(ds);
    }
Exemplo n.º 13
0
    private void LoadCategory()
    {
        if (ds.Tables.Contains("category"))
        {
            ds.Tables.Remove(ds.Tables["category"]);
        }
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@id", lblid.Text)
        };

        string sQuery = "select M_Category from RTM_MeetingsCategory Where M_TeamId =@id group by M_Category";

        ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, "category");


        ddlCategory.DataSource     = ds.Tables["category"];
        ddlCategory.DataTextField  = "M_Category";
        ddlCategory.DataValueField = "M_Category";
        ddlCategory.DataBind();
        ddlCategory.Items.Insert(0, "--Select Category--");
        ddlCategory.SelectedIndex = 0;
    }
Exemplo n.º 14
0
    private DataSet FetchData()
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@from", txtFrom.Text),
            new SqlParameter("@to", txtTo.Text),
            new SqlParameter("@id", lblid.Text),
        };


        SQlQuery = "select CL_ClientName, TL_Task, STL_SubTask , ISNULL(sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600,00) as hour,ISNULL((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60,00) as minute,ISNULL((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))-(((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/3600)*3600)-60*((sum(datediff(second,'00:00:00',REPLACE(R_Duration,'-', '')))/60)%60)))%60,00) as seconds " +
                   "from RTM_Records, RTM_Client_List, rtm_task_list, rtm_subtask_list " +
                   "where R_Client = CL_ID and R_Task = TL_ID and R_SubTask = STL_ID and CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, R_Start_Date_Time))) between @from and @to and R_Duration != 'HH:MM:SS' " +
                   "and R_TeamId =@id GROUP BY CL_ClientName, TL_Task, STL_SubTask order by CL_ClientName, TL_Task, STL_SubTask";
        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "data");
        return(ds);
    }
Exemplo n.º 15
0
    private void BindGrid()
    {
        //Namohar code changes on 10-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@team", ddlTeam.SelectedValue),
        };

        if (ds.Tables.Contains("emp"))
        {
            ds.Tables.Remove(ds.Tables["emp"]);
        }
        SQlQuery = "SELECT UL_Employee_Id, UL_User_Name, CONVERT(VARCHAR(8),UL_SCH_Login,108) AS UL_SCH_Login, CONVERT(VARCHAR(8),UL_SCH_Logout,108) AS UL_SCH_Logout FROM RTM_User_List WHERE UL_Team_Id = @team and UL_User_Status =1 order by UL_User_Name";

        ds = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "emp");
        gvEmployee.DataSource = ds.Tables["emp"];
        gvEmployee.DataBind();
    }
Exemplo n.º 16
0
 public DataSet LoadUsers(string _access, string _location, string _manager, string _teamId, string dtName, string uid)
 {
     SqlParameter[] parameters = new SqlParameter[]
     {
         new SqlParameter("@location", _location),
         new SqlParameter("@manager", _manager),
         new SqlParameter("@teamId", _teamId),
         new SqlParameter("@uid", uid)
     };
     if (_access == "1")
     {
         sQuery = "SELECT UL_User_Name FROM RTM_User_List, RTM_Team_List where UL_Team_Id = T_ID and T_Location = @location ORDER BY UL_User_Name";
     }
     else if (_access == "2")
     {
         //sQuery = "; with  CTE as " +
         //            "( " +
         //             " select  UL_ID, UL_Team_Id, UL_Employee_Id, UL_RepMgrId, UL_User_Name , 1 as level from RTM_User_List where UL_User_Name = @manager " +
         //              "union all " +
         //              "select  child.UL_ID , child.UL_Team_Id, child.UL_Employee_Id, child.UL_RepMgrId, child.UL_User_Name, level + 1 from RTM_User_List child " +
         //                 "join    CTE parent on child.UL_RepMgrId = parent.UL_Employee_Id where UL_User_Status =1 " +
         //             ") " +
         //         "select UL_User_Name from CTE order by UL_User_Name ";
         sQuery = "select UL_User_Name from RTM_User_List, RTM_AccessPermissions where UL_Team_Id = AP_TID and AP_UID =@uid and AP_Status =1 and UL_User_Status =1 order By UL_User_Name";
         //sQuery = "SELECT UL_User_Name FROM RTM_User_List, RTM_Team_List where UL_Team_Id = T_ID and T_Location = @location and UL_Team_Id IN (Select T_ID from RTM_Team_List where T_Manager =@manager) ORDER BY UL_User_Name";
     }
     else if (_access == "3")
     {
         sQuery = "; with  CTE as " +
                  "( " +
                  " select  UL_ID, UL_Team_Id, UL_Employee_Id, UL_RepMgrId, UL_User_Name , 1 as level from RTM_User_List where UL_User_Name = @manager " +
                  "union all " +
                  "select  child.UL_ID , child.UL_Team_Id, child.UL_Employee_Id, child.UL_RepMgrId, child.UL_User_Name, level + 1 from RTM_User_List child " +
                  "join    CTE parent on child.UL_RepMgrId = parent.UL_Employee_Id where UL_User_Status =1 " +
                  ") " +
                  "select UL_User_Name from CTE order by UL_User_Name ";
         //sQuery = "SELECT UL_User_Name FROM RTM_User_List, RTM_Team_List where UL_Team_Id = T_ID and T_Location = @location and UL_Team_Id =@teamId ORDER BY UL_User_Name";
     }
     ds = objDB.DSExecuteParamerizedSelectCommand(sQuery, CommandType.Text, parameters, dtName);
     //ds = objDB.DBExecDataSet(sQuery, dtName);
     return(ds);
 }
Exemplo n.º 17
0
    private void DisplayReport()
    {
        //Namohar code changes on 12-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@from", txtFrom.Text),
            new SqlParameter("@to", txtTo.Text),
        };

        BuildTable();
        DataRow dr1;

        ds = new DataSet();

        SQlQuery = "select LA_User_Name,LA_Log_Action,LA_Start_Date_Time, T_TeamName, UL_SCH_Login, UL_SCH_Logout from RTM_Log_Actions with (nolock) left join RTM_User_List with (nolock) on LA_User_Name = UL_User_Name left join RTM_Team_List with (nolock) on LA_TeamId = T_ID where CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, LA_Start_Date_Time))) BETWEEN @from and @to and LA_Log_Action ='First Activity' and T_Location = 'IND' Order By T_TeamName, UL_User_Name";
        ds       = objDB.DSExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters, "tbo");
        if (ds.Tables["tbo"].Rows.Count > 0)
        {
            foreach (DataRow dr in ds.Tables["tbo"].Rows)
            {
                try
                {
                    if (dr["LA_User_Name"].ToString() == "Mohammed Sulaiman")
                    {
                        string us = dr["LA_User_Name"].ToString();
                    }
                    string login     = dr["LA_Start_Date_Time"].ToString();
                    string loginTime = Convert.ToDateTime(login).ToString("HH:mm:ss");
                    string schLogin  = Convert.ToDateTime(dr["UL_SCH_Login"]).ToString("HH:mm:ss");
                    string schLogoff = Convert.ToDateTime(dr["UL_SCH_Logout"]).ToString("HH:mm:ss");
                    dt = new DataTable();
                    SqlParameter[] param = new SqlParameter[]
                    {
                        new SqlParameter("@start", dr["LA_Start_Date_Time"].ToString()),
                        new SqlParameter("@user", dr["LA_User_Name"].ToString())
                    };
                    SQlQuery = "select Top 1 LA_Start_Date_Time from RTM_Log_Actions where LA_Start_Date_Time > @start and LA_User_Name= @user and LA_Log_Action ='Last Activity' Order By LA_Start_Date_Time";
                    dt       = objDB.ExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, param);
                    if (dt.Rows.Count > 0)
                    {
                        string   logout     = dt.Rows[0]["LA_Start_Date_Time"].ToString();
                        string   logoutTime = Convert.ToDateTime(logout).ToString("HH:mm:ss");
                        TimeSpan diff       = Convert.ToDateTime(logout) - Convert.ToDateTime(login);
                        if (diff.TotalHours < 9)
                        {
                            dr1                   = dtResult.NewRow();
                            dr1["Team"]           = dr["T_TeamName"];
                            dr1["User"]           = dr["LA_User_Name"];
                            dr1["First Activity"] = login;
                            if (TimeSpan.Parse(loginTime) > TimeSpan.Parse(schLogin))
                            {
                                dr1["Delayed Login"] = TimeSpan.Parse(loginTime).Subtract(TimeSpan.Parse(schLogin));
                                //Namohar code changes on 12-Aug-2016.
                                SqlParameter[] parameters1 = new SqlParameter[]
                                {
                                    new SqlParameter("@login", Convert.ToDateTime(login).ToShortDateString()),
                                    new SqlParameter("@user", dr["LA_User_Name"].ToString())
                                };

                                SQlQuery = "select D_Reason from RTM_DelayedLogInOff where CONVERT(DATETIME, FLOOR(CONVERT(FLOAT, D_Date))) =@login and D_UserName=@user";
                                dt       = objDB.ExecuteParamerizedSelectCommand(SQlQuery, CommandType.Text, parameters1);
                                if (dt.Rows.Count > 0)
                                {
                                    dr1["Login Delay Reason"] = dt.Rows[0]["D_Reason"].ToString();
                                }
                                //reader = objDB.ParameterizedSelectReader(SQlQuery, CommandType.Text, parameters1);
                                //while (reader.Read())
                                //{
                                //    dr1["Login Delay Reason"] = reader["D_Reason"].ToString();
                                //}
                                //reader.Close();
                                //con.Close();
                            }
                            //Math.Round(totalWorkHours, 2, MidpointRounding.AwayFromZero);
                            dr1["Last Activity"] = logout;
                            if (TimeSpan.Parse(schLogoff) > TimeSpan.Parse(logoutTime))
                            {
                                dr1["Early Logoff"] = TimeSpan.Parse(schLogoff).Subtract(TimeSpan.Parse(logoutTime));
                            }

                            dr1["Total Office Hours"] = diff;


                            dtResult.Rows.Add(dr1);
                        }
                    }
                }
                catch (Exception)
                {
                    //throw;
                }
            }

            if (dtResult.Rows.Count > 0)
            {
                gvEarlyLate.DataSource = dtResult;
                gvEarlyLate.DataBind();
            }
            else
            {
                gvEarlyLate.DataSource = null;
                gvEarlyLate.DataBind();
            }
        }
    }
Exemplo n.º 18
0
    private DataSet GetEmployees(int teamId)
    {
        //Namohar code changes on 12-Aug-2016.
        SqlParameter[] parameters = new SqlParameter[]
        {
            new SqlParameter("@teamId", teamId),
        };


        SQLQuery = "SELECT UL_User_Name FROM RTM_User_List WHERE UL_Team_Id =@teamId";
        ds       = objDB.DSExecuteParamerizedSelectCommand(SQLQuery, CommandType.Text, parameters, "users");
        return(ds);
    }