private void Employee_New_Update_effeciency() { try { Hashtable htemp = new Hashtable(); System.Data.DataTable dtemp = new System.Data.DataTable(); grd_DashEmployee_efficency.Rows.Clear(); grd_DashEmployee_efficency.Rows.Add(); Hashtable htuser_Order_Details = new Hashtable(); System.Data.DataTable dtOrder_Details = new System.Data.DataTable(); Hashtable htget_Emp_Eff = new Hashtable(); System.Data.DataTable dtget_Emp_Eff = new System.Data.DataTable(); htget_Emp_Eff.Add("@Trans", "DAILY_USER_NEW_UPDATED_EFF"); htget_Emp_Eff.Add("@User_Id", Emp_User_Id); DateTime Prd_Date = Convert.ToDateTime(Production_Date.ToString()); string Prd_Date1 = Prd_Date.ToString("MM/dd/yyyy"); htget_Emp_Eff.Add("@Production_Date", Prd_Date1); dtget_Emp_Eff = dataaccess.ExecuteSP("Sp_Score_Board_Updated", htget_Emp_Eff); Hashtable htget_Emp_Prod_Idel_Time = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time.Add("@Trans", "GET_BREAK_HOURS"); htget_Emp_Prod_Idel_Time.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time); if (dtget_Emp_Prod_Idel_Time.Rows.Count > 0) { Break_Time = int.Parse(dtget_Emp_Prod_Idel_Time.Rows[0]["Total_Break_Time"].ToString()); } else { Break_Time = 0; } Hashtable htget_Emp_Prod_Idel_Time1 = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time1 = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time1.Add("@Trans", "GET_IDEAL_HOURS"); htget_Emp_Prod_Idel_Time1.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time1.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time1 = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time1); if (dtget_Emp_Prod_Idel_Time1.Rows.Count > 0) { Ideal_Time = int.Parse(dtget_Emp_Prod_Idel_Time1.Rows[0]["Total_Ideal_Time"].ToString()); } else { Ideal_Time = 0; } Hashtable htget_Emp_Prod_Idel_Time2 = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time2 = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time2.Add("@Trans", "GET_PRODUCTION_HOURS"); htget_Emp_Prod_Idel_Time2.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time2.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time2 = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time2); if (dtget_Emp_Prod_Idel_Time2.Rows.Count > 0) { Production_Time = int.Parse(dtget_Emp_Prod_Idel_Time2.Rows[0]["Total_Production_Time"].ToString()); } else { Production_Time = 0; } if (dtget_Emp_Eff.Rows.Count > 0) { grd_DashEmployee_efficency.Rows[0].Cells[0].Value = int.Parse(dtget_Emp_Eff.Rows[0]["Total_Orders"].ToString()); if (string.IsNullOrEmpty(efficiency)) { grd_DashEmployee_efficency.Rows[0].Cells[6].Value = int.Parse(dtget_Emp_Eff.Rows[0]["Effecinecy"].ToString()); } else { grd_DashEmployee_efficency.Rows[0].Cells[6].Value = efficiency; } grd_DashEmployee_efficency.Rows[0].Cells[7].Value = int.Parse(dtget_Emp_Eff.Rows[0]["User_Id"].ToString()); Allocated_In_Sec = int.Parse(dtget_Emp_Eff.Rows[0]["Allocated_In_Sec"].ToString()); } else { grd_DashEmployee_efficency.Rows[0].Cells[0].Value = "0"; grd_DashEmployee_efficency.Rows[0].Cells[6].Value = "0"; grd_DashEmployee_efficency.Rows[0].Cells[7].Value = Emp_User_Id; Allocated_In_Sec = 0; } Total_Time = Production_Time + Break_Time + Ideal_Time; Total_t = TimeSpan.FromSeconds(Total_Time); string Total_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Total_t.Hours, Total_t.Minutes, Total_t.Seconds); grd_DashEmployee_efficency.Rows[0].Cells[1].Value = Total_formatedTime.ToString(); prod_t = TimeSpan.FromSeconds(Production_Time); string Prd_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", prod_t.Hours, prod_t.Minutes, prod_t.Seconds); grd_DashEmployee_efficency.Rows[0].Cells[2].Value = Prd_formatedTime.ToString(); Ideal_t = TimeSpan.FromSeconds(Ideal_Time); string idl_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Ideal_t.Hours, Ideal_t.Minutes, Ideal_t.Seconds); grd_DashEmployee_efficency.Rows[0].Cells[4].Value = idl_formatedTime.ToString(); Break_t = TimeSpan.FromSeconds(Break_Time); string brk_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Break_t.Hours, Break_t.Minutes, Break_t.Seconds); grd_DashEmployee_efficency.Rows[0].Cells[5].Value = brk_formatedTime.ToString(); Allocte_t = TimeSpan.FromSeconds(Allocated_In_Sec); string Allocate_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Allocte_t.Hours, Allocte_t.Minutes, Allocte_t.Seconds); grd_DashEmployee_efficency.Rows[0].Cells[3].Value = Allocate_formatedTime.ToString(); } catch (Exception ex) { } }
private void Bind_Employee_effeciency() { DataTable dtEfficiency = new DataTable(); dtEfficiency.Columns.AddRange(new DataColumn[8] { new DataColumn("T.Orders", typeof(string)), new DataColumn("Total Hr", typeof(string)), new DataColumn("P.Hour", typeof(string)), new DataColumn("Allocated Hour", typeof(string)), new DataColumn("B.Hour", typeof(string)), new DataColumn("Efficiency", typeof(string)), new DataColumn("User_Id", typeof(string)), new DataColumn("I.Hour", typeof(string)) }); DataRow row = dtEfficiency.NewRow(); try { Header = "Order Details"; Hashtable htemp = new Hashtable(); System.Data.DataTable dtemp = new System.Data.DataTable(); //Grd_Dash_Emp_efficency.Rows.Clear(); //Grd_Dash_Emp_efficency.Rows.Add(); Hashtable htuser_Order_Details = new Hashtable(); System.Data.DataTable dtOrder_Details = new System.Data.DataTable(); Hashtable htget_Emp_Eff = new Hashtable(); System.Data.DataTable dtget_Emp_Eff = new System.Data.DataTable(); htget_Emp_Eff.Clear(); dtget_Emp_Eff.Clear(); htget_Emp_Eff.Add("@Trans", "DAILY_USER_NEW_UPDATED_EFF"); htget_Emp_Eff.Add("@User_Id", Emp_User_Id); DateTime Prd_Date = Convert.ToDateTime(Production_Date.ToString()); string Prd_Date1 = Prd_Date.ToString("MM/dd/yyyy"); htget_Emp_Eff.Add("@Production_Date", Prd_Date1); dtget_Emp_Eff = dataaccess.ExecuteSP("Sp_Score_Board_Updated", htget_Emp_Eff); Efficiency = dtget_Emp_Eff.Rows[0]["Effecinecy"].ToString(); Hashtable htget_Emp_Prod_Idel_Time = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time.Add("@Trans", "GET_BREAK_HOURS"); htget_Emp_Prod_Idel_Time.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time); if (dtget_Emp_Prod_Idel_Time.Rows.Count > 0) { Break_Time = int.Parse(dtget_Emp_Prod_Idel_Time.Rows[0]["Total_Break_Time"].ToString()); } else { Break_Time = 0; } Hashtable htget_Emp_Prod_Idel_Time1 = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time1 = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time1.Add("@Trans", "GET_IDEAL_HOURS"); htget_Emp_Prod_Idel_Time1.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time1.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time1 = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time1); if (dtget_Emp_Prod_Idel_Time1.Rows.Count > 0) { Ideal_Time = int.Parse(dtget_Emp_Prod_Idel_Time1.Rows[0]["Total_Ideal_Time"].ToString()); } else { Ideal_Time = 0; } Hashtable htget_Emp_Prod_Idel_Time2 = new Hashtable(); System.Data.DataTable dtget_Emp_Prod_Idel_Time2 = new System.Data.DataTable(); htget_Emp_Prod_Idel_Time2.Add("@Trans", "GET_PRODUCTION_HOURS"); htget_Emp_Prod_Idel_Time2.Add("@User_Id", Emp_User_Id); htget_Emp_Prod_Idel_Time2.Add("@Production_Date", Prd_Date1); dtget_Emp_Prod_Idel_Time2 = dataaccess.ExecuteSP("Sp_Score_Board", htget_Emp_Prod_Idel_Time2); if (dtget_Emp_Prod_Idel_Time2.Rows.Count > 0) { Production_Time = int.Parse(dtget_Emp_Prod_Idel_Time2.Rows[0]["Total_Production_Time"].ToString()); } else { Production_Time = 0; } if (dtget_Emp_Eff.Rows.Count > 0) { Allocated_In_Sec = int.Parse(dtget_Emp_Eff.Rows[0]["Allocated_In_Sec"].ToString()); } else { Allocated_In_Sec = 0; } Total_Time = Production_Time + Break_Time + Ideal_Time; Total_t = TimeSpan.FromSeconds(Total_Time); string Total_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Total_t.Hours, Total_t.Minutes, Total_t.Seconds); prod_t = TimeSpan.FromSeconds(Production_Time); string Prd_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", prod_t.Hours, prod_t.Minutes, prod_t.Seconds); Allocte_t = TimeSpan.FromSeconds(Allocated_In_Sec); string Allocate_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Allocte_t.Hours, Allocte_t.Minutes, Allocte_t.Seconds); Ideal_t = TimeSpan.FromSeconds(Ideal_Time); string idl_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Ideal_t.Hours, Ideal_t.Minutes, Ideal_t.Seconds); Break_t = TimeSpan.FromSeconds(Break_Time); string brk_formatedTime = string.Format("{0:D2}H:{1:D2}M:{2:D2}S", Break_t.Hours, Break_t.Minutes, Break_t.Seconds); row["Total Hr"] = Total_formatedTime; row["P.Hour"] = Prd_formatedTime; row["Allocated Hour"] = Allocate_formatedTime; row["I.Hour"] = idl_formatedTime; row["B.Hour"] = brk_formatedTime; row["User_Id"] = Emp_User_Id.ToString(); row["Efficiency"] = Efficiency; row["T.Orders"] = gridView2.RowCount.ToString(); dtEfficiency.Rows.Add(row); if (dtEfficiency.Rows.Count > 0) { Grd_Dash_Emp_efficency.DataSource = dtEfficiency; } } catch (Exception ex) { } }