protected void btn_update_Click1(object sender, ImageClickEventArgs e) { objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); if (hdn_actualid.Value.ToString() != "") { int id = Convert.ToInt32(hdn_actualid.Value); var query = (from table in objQualitySheetdclassDataContext.Actual_PrdQties where table.AID == id select table).FirstOrDefault(); if (query != null) { query.PartNo = ddl_partno.Value.ToString(); query.Process = ddl_process.Value.ToString(); query.Shift = ddl_shift.Value.ToString(); query.FixedTime = Convert.ToDecimal(txt_fixedtime.Value.ToString()); //query.ProducedQty= Convert.ToDecimal(txt_prdquty.Value.ToString()); } objQualitySheetdclassDataContext.SubmitChanges(); // div_save.Visible = true; // div_update.Visible = false; BindPart(); BindProcess(); GetEntryTime(); txt_fixedtime.Value = ""; ddl_shift.Value = "0"; // txt_prdquty.Value = ""; // ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Updated Successfully');", true); } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); objt = new ToolTypeMaster() { //TText = txt_ttype.Value.ToString(), //TValue = txt_tvalue.Value.ToString() TText = txt_tvalue.Value.ToString(), TValue = txt_ttype.Value.ToString() }; txt_ttype.Value = ""; txt_tvalue.Value = ""; objcontext.ToolTypeMasters.InsertOnSubmit(objt); objcontext.SubmitChanges(); loadgrid(); } catch (Exception ex) { } finally { } }
protected void btn_update_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); var query = (from tbale in objcontext.LineMastermbus where tbale.LID == Convert.ToInt32(hdn_lineid.Value.ToString()) select tbale).First(); if (query != null) { query.LText = txt_lname.Value.ToString(); query.LValue = txt_lvalue.Value.ToString(); objcontext.SubmitChanges(); txt_lname.Value = ""; txt_lvalue.Value = ""; loadgrid(); } else { } } catch (Exception ex) { } finally { } }
protected void btn_update_Click(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); if (hdn_timeid.Value.ToString() != "") { int id = Convert.ToInt32(hdn_timeid.Value); var query = (from table in objcontext.TimeMasters where table.ID == id select table).FirstOrDefault(); if (query != null) { query.PartNo = DropPartNo.SelectedItem.Text.ToString(); query.Operation = DropOperation.SelectedItem.Text.ToString(); query.BottleNecktime = Convert.ToDecimal(TxtBottleNeckTime.Text.ToString()); query.tt = Convert.ToDecimal(TxtTt.Text.ToString()); } objcontext.SubmitChanges(); //div_save.Visible = true; //div_update.Visible = false; BindProcess(); BindPartNO(); BindTimeMaster(); checkbrowser(); TxtTt.Text = ""; TxtBottleNeckTime.Text = ""; ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Updated Successfully');", true); } }
protected void btn_update_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); var query = (from table in objcontext.ToolTypeMasters where table.TID == Convert.ToInt32(hdn_typeid.Value.ToString()) select table).First(); if (query != null) { //query.TText = txt_ttype.Value.ToString(); //query.TValue = txt_tvalue.Value.ToString(); query.TText = txt_tvalue.Value.ToString(); query.TValue = txt_ttype.Value.ToString(); objcontext.SubmitChanges(); txt_ttype.Value = ""; txt_tvalue.Value = ""; loadgrid(); } else { } } catch (Exception ex) { } finally { } }
protected void btn_update_Click(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); if (hdn_planid.Value.ToString() != "") { int id = Convert.ToInt32(hdn_planid.Value); var query = (from table in objcontext.PlaneedEntryDetails where table.PNO == id select table).FirstOrDefault(); if (query != null) { query.PartNo = ddl_partno.Value.ToString(); query.Process = ddl_process.Value.ToString(); query.Maintenace = txt_pmaintenance.Value.ToString(); query.Cleaning = txt_cleaning.Value.ToString(); query.Break = txt_break.Value.ToString(); query.Noplan = txt_demand.Value.ToString(); query.Trials = txt_trial.Value.ToString(); query.Meetings = txt_meetings.Value.ToString(); query.Trainings = txt_traings.Value.ToString(); query.Planedmaintenance = txt_planedmaintenance.Value.ToString(); } objcontext.SubmitChanges(); Loadplan(); clearcontrols(); ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Updated Successfully');", true); } }
//protected void OnSelectedIndexChanged_ddl_shift(object sender, EventArgs e) //{ // string shift11 = ddl_shift.Text.ToString(); // if(shift11=="A") // { // txt_shift.Value="6:00 AM to 2:00 PM"; // } // if (shift11 == "B") // { // txt_shift.Value = "2:00 PM to 10:00 PM"; // } // if (shift11 == "C") // { // txt_shift.Value = "10:00 PM to 6:00 AM"; // } // if (shift11 == "A1") // { // txt_shift.Value = "6:00 AM to 6:00 PM"; // } // if (shift11 == "B1") // { // txt_shift.Value = "6:00 PM to 6:00 AM"; // } //} protected void btn_submit_Click(object sender, ImageClickEventArgs e) { objplanned = new PlaneedEntryDetail(); objcontext = new QualitySheetdclassDataContext(); try { ds = objserver.GetDateset("select * from PlaneedEntryDetails where PartNo='" + ddl_partno.Value.ToString() + "' and Process='" + ddl_process.Value.ToString() + "'"); if (ds.Tables[0].Rows.Count > 0) { //var query = (from table in objcontext.PlaneedEntryDetails where table.PartNo == ddl_partno.Value.ToString() select table).FirstOrDefault(); //if (query != null) //{ // query.PartNo = ddl_partno.Value.ToString(); // query.Process = ddl_process.Value.ToString(); // query.Setup = txt_fixed_data.Value.ToString(); // query.LunchTime = txt_lunchtime.Value.ToString(); // query.TeaTime = txt_teatime.Value.ToString(); // //query.ShiftTime = txt_shift.Value.ToString(); // query.PlanTime = txt_plan.Value.ToString(); // query.Maintenance = txt_maintenance.Value.ToString(); // query.Manufacturing = txt_manuf.Value.ToString(); // query.Meeting = txt_meeting.Value.ToString(); // // query.Shift = ddl_shift.Text.ToString(); // objcontext.SubmitChanges(); // clearcontrols(); // Loadplan(); //} ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Already Exist !');", true); } else { objplanned.PartNo = ddl_partno.Value.ToString(); objplanned.Process = ddl_process.Value.ToString(); objplanned.Maintenace = txt_pmaintenance.Value.ToString(); objplanned.Cleaning = txt_cleaning.Value.ToString(); objplanned.Break = txt_break.Value.ToString(); objplanned.Noplan = txt_demand.Value.ToString(); objplanned.Trials = txt_trial.Value.ToString(); objplanned.Meetings = txt_meetings.Value.ToString(); objplanned.Trainings = txt_traings.Value.ToString(); objplanned.Planedmaintenance = txt_planedmaintenance.Value.ToString(); objcontext.PlaneedEntryDetails.InsertOnSubmit(objplanned); objcontext.SubmitChanges(); ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Submitted Successfuly !');", true); clearcontrols(); Loadplan(); } } catch (Exception ex) { } finally { } }
protected void btnsave_Click(object sender, ImageClickEventArgs e) { try { //string runchart = string.Empty; //if (RunChart. == "Yes") //{ // //if (txt_ucl.Value != "0" && txt_lcl.Value != "0" && txt_ucl.Value != "" && txt_lcl.Value != "") // //{ // runchart = "Yes"; // //} // //else // //{ // // ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Enter the UCL and LCL !');", true); // //} //} //else if (RunChart.SelectedValue == "No") //{ // runchart = "No"; // //txt_ucl.Value = "0"; // //txt_lcl.Value = "0"; //} objm = new Dynmaster(); objcontext = new QualitySheetdclassDataContext(); objm.Partno = hdn_part.Value.ToString().Trim(); objm.Unit = dy_unit.Value.ToString().Trim(); objm.Cell = hdncell.Value.ToString().Trim(); objm.Instrument = dy_intrument.Value.ToString().Trim(); objm.Int_count = dy_instruvalues.Value.ToString().Trim(); objm.Int_range = hdn_ranges.Value.ToString().Trim(); //dy_ranges.Value.ToString().Trim(); objm.Operation = hdn_oper.Value.ToString().Trim(); //dy_operation.Value.ToString().Trim(); objm.ShortName = txt_shortname.Value.ToString().Trim(); objm.CellValues = hdn_noofcell.Value.ToString().Trim(); //txt_noofcells.Value.ToString().Trim(); objm.HeaderName = Txt_headername.Value.ToString().Trim(); objm.Runchart = slt_runchart.Value.ToString().Trim(); objm.UCL = Convert.ToDecimal(0); objm.LCL = Convert.ToDecimal(0); dy_intrument.Value = ""; dy_instruvalues.Value = ""; dy_ranges.Value = "0"; objcontext.Dynmasters.InsertOnSubmit(objm); //mid object name is same as table name objcontext.SubmitChanges(); getgrid(); hdn_ranges.Value = "0"; } catch (Exception ex) { } finally { } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); objm = new MailAutorized() { MailID = txt_mailaddress.Value.ToString(), unit = ddl_availability.Text }; objcontext.MailAutorizeds.InsertOnSubmit(objm); objcontext.SubmitChanges(); loadgrid(); txt_mailaddress.Value = ""; ddl_availability.Text = "--- Select Unit ---"; }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); objm = new Mail() { Password = txt_mpassword.Value.ToString(), Username = txt_musername.Value.ToString(), Port = txt_mport.Value.ToString() }; objcontext.Mails.InsertOnSubmit(objm); objcontext.SubmitChanges(); loadgrid(); txt_musername.Value = ""; txt_mport.Value = ""; txt_mpassword.Value = ""; }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string partno = DropPart_cyc.SelectedItem.Text.ToString(); string process = Dropprocess_cyc.SelectedItem.Text.ToString(); objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); objcycle = new CycleTimeEntry(); try { var query = (from table in objQualitySheetdclassDataContext.CycleTimeEntries where table.CPartno == DropPart_cyc.SelectedItem.Text.ToString() && table.CProcess == Dropprocess_cyc.SelectedItem.Text.ToString() select table).ToList(); if (query.Count > 0) { ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Already Exist !');", true); } else { objcycle.CPartno = DropPart_cyc.SelectedItem.Text.ToString(); objcycle.CProcess = Dropprocess_cyc.SelectedItem.Text.ToString(); if (txt_seconds.Value != "") { double secondsc = Convert.ToInt32(txt_seconds.Value.ToString()); secondsc = secondsc / 60; int minutes = Convert.ToInt32(Text_cycle.Value.ToString()); double total = Convert.ToDouble(minutes) + secondsc; objcycle.CTime = Convert.ToDecimal(total.ToString()); objcycle.Cseconds = txt_seconds.Value.ToString(); } else { objcycle.Cseconds = "0"; objcycle.CTime = Convert.ToDecimal(Text_cycle.Value.ToString()); } objQualitySheetdclassDataContext.CycleTimeEntries.InsertOnSubmit(objcycle); objQualitySheetdclassDataContext.SubmitChanges(); } } catch (Exception ex) { } finally { clearcontrols(); getcycledata(); } }
public void LoadRegUser() { lock (thisLock) { try{ objreg = new tbl_Registration(); dt = new DataTable(); objContext = new QualitySheetdclassDataContext(); //var query = (from c in (objQualitySheetdclassDataContext.CycleTimeEntries) select c).ToList(); da = new SqlDataAdapter("select * from tbl_Registration where Status='Active'", strConnString); ds = new DataSet(); da.Fill(dt); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { paging.DataSource = dt.DefaultView; if (ds.Tables[0].Rows.Count > 10) { paging.AllowPaging = true; paging.PageSize = 10; paging.CurrentPageIndex = CurrentPage; ViewState["totalpage"] = paging.PageCount; link_previous.Enabled = !paging.IsFirstPage; link_next.Enabled = !paging.IsLastPage; } else { div_paging.Visible = false; } grid_registration.DataSource = paging; grid_registration.DataBind(); div_reg.Visible = true; div_actualerror.Visible = false; createpaging(); } else { div_reg.Visible = false; div_actualerror.Visible = true; } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex); } } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); objspare = new SpareMaster() { ToolNumber = ddl_toolnumber.SelectedValue.ToString(), Maximum = txt_maximum.Value.ToString(), Minimum = txt_minimum.Value.ToString(), TotalCount = txt_sparecount.Value.ToString() }; objcontext.SpareMasters.InsertOnSubmit(objspare); objcontext.SubmitChanges(); loadgrid(); BindToolNumber(); txt_maximum.Value = ""; txt_minimum.Value = ""; txt_sparecount.Value = ""; }
public void Loadofarticle() { objofarticle = new ofarticle_grid(); dt = new DataTable(); objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); //var query = (from c in (objQualitySheetdclassDataContext.CycleTimeEntries) select c).ToList(); da = new SqlDataAdapter("select * from ofarticle_grid", constr); DataSet ds = new DataSet(); da.Fill(dt); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { paging.DataSource = dt.DefaultView; if (ds.Tables[0].Rows.Count > 8) { paging.AllowPaging = true; paging.PageSize = 8; paging.CurrentPageIndex = CurrentPage1; ViewState["totalpage"] = paging.PageCount; link_previous1.Enabled = !paging.IsFirstPage; link_next1.Enabled = !paging.IsLastPage; } else { div_paging1.Visible = false; } Grid_ofarticle.DataSource = paging; Grid_ofarticle.DataBind(); div_ofarticle.Visible = true; div_actualerror.Visible = false; createpaging1(); } else { div_ofarticle.Visible = false; div_actualerror.Visible = true; } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); var query = (from table in objcontext.AbuToolMasters where table.ToolNumber == ddl_unit.SelectedValue.ToString() + "-" + ddl_tooltype.SelectedValue.ToString() + "" + txt_toolno.Value.ToString() + "-" + ddl_line.SelectedValue.ToString() select table).FirstOrDefault(); if (query != null) { clearbox(); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Tool Number Already Exist');", true); } else { objabu = new AbuToolMaster() { ToolNumber = ddl_unit.SelectedValue.ToString() + "-" + ddl_tooltype.SelectedValue.ToString() + "" + txt_toolno.Value.ToString() + "-" + ddl_line.SelectedValue.ToString(), Gfrom = txt_gfrom.Value.ToString(), Gto = txt_gto.Value.ToString(), Yfrom = txt_yfrom.Value.ToString(), Yto = txt_yto.Value.ToString(), Rfrom = txt_rfrom.Value.ToString(), Rto = txt_rto.Value.ToString(), Unit = ddl_unit.SelectedValue.ToString(), Name = ddl_tooltype.SelectedValue.ToString(), Line = ddl_line.SelectedValue.ToString(), RetensionTime = txt_tredension.Value.ToString() }; objcontext.AbuToolMasters.InsertOnSubmit(objabu); objcontext.SubmitChanges(); clearbox(); loadtoolgrid(); } } catch (Exception ex) { } finally { } }
protected void btn_update_Click1(object sender, ImageClickEventArgs e) { objcontext = new QualitySheetdclassDataContext(); var query = (from table in objcontext.SpareMasters where table.SID == Convert.ToInt32(hdn_spareid.Value.ToString()) select table).First(); if (query != null) { query.ToolNumber = ddl_toolnumber.SelectedValue.ToString(); query.Maximum = txt_maximum.Value.ToString(); query.Minimum = txt_minimum.Value.ToString(); query.TotalCount = txt_sparecount.Value.ToString(); objcontext.SubmitChanges(); loadgrid(); BindToolNumber(); txt_maximum.Value = ""; txt_minimum.Value = ""; txt_sparecount.Value = ""; } else { } }
public void Loadplan() { objplanned = new PlaneedEntryDetail(); dt = new DataTable(); objcontext = new QualitySheetdclassDataContext(); //var query = (from c in (objQualitySheetdclassDataContext.CycleTimeEntries) select c).ToList(); da = new SqlDataAdapter("select * from PlaneedEntryDetails", strConnString); ds = new DataSet(); da.Fill(dt); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { paging.DataSource = dt.DefaultView; if (ds.Tables[0].Rows.Count > 5) { paging.AllowPaging = true; paging.PageSize = 5; paging.CurrentPageIndex = CurrentPage; ViewState["totalpage"] = paging.PageCount; link_previous.Enabled = !paging.IsFirstPage; link_next.Enabled = !paging.IsLastPage; } else { div_paging.Visible = false; } Grid_plan.DataSource = paging; Grid_plan.DataBind(); div_planentry.Visible = true; div_actualerror.Visible = false; createpaging(); } else { div_planentry.Visible = false; div_actualerror.Visible = true; } }
protected void btn_submit_Click1(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); objm = new FixtureModel() { Mtext = txt_modelname.Value.ToString(), Mvalue = txt_modelname.Value.ToString() }; objcontext.FixtureModels.InsertOnSubmit(objm); objcontext.SubmitChanges(); txt_modelname.Value = ""; loadgrid(); } catch (Exception ex) { } finally { } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); objunit = new UnitMastermbu() { MText = txt_unitname.Value.ToString(), MValue = txt_unitname.Value.ToString() }; txt_unitname.Value = ""; objcontext.UnitMastermbus.InsertOnSubmit(objunit); objcontext.SubmitChanges(); loadgrid(); } catch (Exception ex) { } finally { } }
public void getcycledata() { objcycle = new CycleTimeEntry(); dt = new DataTable(); objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); //var query = (from c in (objQualitySheetdclassDataContext.CycleTimeEntries) select c).ToList(); da = new SqlDataAdapter("select * from CycleTimeEntry", strConnString); ds = new DataSet(); da.Fill(dt); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { paging.DataSource = dt.DefaultView; if (ds.Tables[0].Rows.Count > 8) { paging.AllowPaging = true; paging.PageSize = 8; paging.CurrentPageIndex = CurrentPage; ViewState["totalpage"] = paging.PageCount; link_previous.Enabled = !paging.IsFirstPage; link_next.Enabled = !paging.IsLastPage; } else { div_paging.Visible = false; } gridcycletime.DataSource = paging; gridcycletime.DataBind(); div_cycle.Visible = true; div_actualerror.Visible = false; createpaging(); } else { div_cycle.Visible = false; div_actualerror.Visible = true; } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { string path = ""; string filename = ""; if (f_videofile.HasFile) { path = Server.MapPath("~/ABU/"); createfolder(path, "Videos"); //filename = f_videofile.PostedFile.FileName.ToString(); filename = System.IO.Path.GetFileName(f_videofile.PostedFile.FileName.ToString()); // string f_name = path + "Tools" + '\\' + Path.GetFileName(up_photo.PostedFile.FileName); f_videofile.PostedFile.SaveAs(path + "Videos" + '\\' + filename); objcontext = new QualitySheetdclassDataContext(); objv = new ToolVideofile() { FileName = filename.ToString() }; objcontext.ToolVideofiles.InsertOnSubmit(objv); objcontext.SubmitChanges(); loadgrid(); } }
protected void btn_update_Click1(object sender, ImageClickEventArgs e) { objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); if (hdn_cycleid.Value.ToString() != "") { int id = Convert.ToInt32(hdn_cycleid.Value); var query = (from table in objQualitySheetdclassDataContext.CycleTimeEntries where table.CID == id select table).FirstOrDefault(); if (query != null) { query.CPartno = DropPart_cyc.SelectedItem.Text.ToString(); query.CProcess = Dropprocess_cyc.SelectedItem.Text.ToString(); // query.CTime = Convert.ToDecimal(Text_cycle.Value.ToString()); if (txt_seconds.Value != "") { double secondsc = Convert.ToInt32(txt_seconds.Value.ToString()); secondsc = secondsc / 60; int minutes = Convert.ToInt32(Text_cycle.Value.ToString()); double total = Convert.ToDouble(minutes) + secondsc; query.CTime = Convert.ToDecimal(total.ToString()); query.Cseconds = txt_seconds.Value.ToString(); } else { query.Cseconds = "0"; query.CTime = Convert.ToDecimal(Text_cycle.Value.ToString()); } } objQualitySheetdclassDataContext.SubmitChanges(); // div_save.Visible = true; //div_update.Visible = false; BindPart(); BindProcess(); getcycledata(); clearcontrols(); } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { objact = new Actual_PrdQty(); objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); try { var query = (from table in objQualitySheetdclassDataContext.Actual_PrdQties where table.PartNo == ddl_partno.Value.ToString() && table.Process == ddl_process.Value.ToString() && table.Shift == ddl_shift.Value.ToString() select table).ToList(); if (query.Count > 0) { ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Already Exist !');", true); } else { objact.PartNo = ddl_partno.Value.ToString(); objact.Process = ddl_process.Value.ToString(); objact.Shift = ddl_shift.Value.ToString(); objact.FixedTime = Convert.ToDecimal(txt_fixedtime.Value.ToString()); // objact.ProducedQty = Convert.ToDecimal(txt_prdquty.Value.ToString()); objact.EntryTime = Convert.ToDateTime(DateTime.Now.ToShortDateString()); objQualitySheetdclassDataContext.Actual_PrdQties.InsertOnSubmit(objact); objQualitySheetdclassDataContext.SubmitChanges(); // ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Datas Submitted Successfuly !');", true); } } catch (Exception ex) { } finally { BindPart(); BindProcess(); GetEntryTime(); txt_fixedtime.Value = ""; ddl_shift.Value = "0"; // txt_prdquty.Value = ""; } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { try { objcontext = new QualitySheetdclassDataContext(); objl = new LineMaster() { LText = txt_lname.Value.ToString(), LValue = txt_lvalue.Value.ToString() }; txt_lname.Value = ""; txt_lvalue.Value = ""; objcontext.LineMasters.InsertOnSubmit(objl); objcontext.SubmitChanges(); loadgrid(); } catch (Exception ex) { } finally { } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { string strDate = txt_date.Value.ToString(); //Format – dd/MM/yyyy //split string date by separator, here I'm using '/' string[] arrDate = strDate.Split('/'); //now use array to get specific date object string month = arrDate[0].ToString(); string month1 = arrDate[0].ToString(); if (month == "01") { month = "Jan"; } else if (month == "02") { month = "Feb"; } else if (month == "03") { month = "Mar"; } else if (month == "04") { month = "Apr"; } else if (month == "05") { month = "May"; } else if (month == "06") { month = "Jun"; } else if (month == "07") { month = "Jul"; } else if (month == "08") { month = "Aug"; } else if (month == "09") { month = "Sep"; } else if (month == "10") { month = "Oct"; } else if (month == "11") { month = "Nov"; } else if (month == "12") { month = "Dec"; } else { } int num = 07; int num1 = 14; int num2 = 21; int num3 = 28; int day = Convert.ToInt32(arrDate[1].ToString()); string day1 = arrDate[1].ToString(); if (Convert.ToInt32(day) <= Convert.ToInt32(num)) { day1 = "week1"; } else if ((Convert.ToInt32(day) >= Convert.ToInt32(num)) && (Convert.ToInt32(day) <= Convert.ToInt32(num1))) { day1 = "week2"; } else if ((Convert.ToInt32(day) >= Convert.ToInt32(num)) && (Convert.ToInt32(day) >= Convert.ToInt32(num1)) && (Convert.ToInt32(day) <= Convert.ToInt32(num2))) { day1 = "week3"; } else if ((Convert.ToInt32(day) >= Convert.ToInt32(num)) && (Convert.ToInt32(day) >= Convert.ToInt32(num1)) && (Convert.ToInt32(day) >= Convert.ToInt32(num2)) && (Convert.ToInt32(day) <= Convert.ToInt32(num3))) { day1 = "week4"; } string year = arrDate[2].ToString(); objlaboreff = new laborefficiency(); objlaboreff.LDate = txt_date.Value.ToString(); objlaboreff.Lmonth_num = month1.ToString(); objlaboreff.Lmonth = month.ToString(); objlaboreff.Lday = day.ToString(); objlaboreff.Lweek = day1.ToString(); objlaboreff.Lyear = year.ToString(); objlaboreff.Lshift = ddl_shift.SelectedItem.Text.ToString(); objlaboreff.earn_time = Text_earn.Value.ToString(); objlaboreff.actual_time = Text_actual.Value.ToString(); objlaboreff.unit = ddl_unit_LBeff.Text.ToString(); objlaboreff.MachineName = Slct_machine_eff_LE.Value.ToString(); if (ttl_tim.Value != "") { objlaboreff.total_time = Convert.ToInt32(ttl_tim.Value.ToString()); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "actualtym();", true); return; //ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert(' !');", true); } objQualitySheetdclassDataContext.laborefficiencies.InsertOnSubmit(objlaboreff); objQualitySheetdclassDataContext.SubmitChanges(); objQualitySheetdclassDataContext = null; ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Submitted Successfuly !');", true); clear(); Loadplan(); }
protected void btn_save_Click(object sender, ImageClickEventArgs e) { conn.Open(); try { string filepath = ""; string directoryPath = ""; string productID = DropPartNo.SelectedValue.ToString(); if (fup_file.PostedFile.FileName == "") { filepath = ""; } else { directoryPath = Server.MapPath("~/TimeMaster/" + productID + "/" + DropOperation.SelectedItem + "/"); if (!Directory.Exists(directoryPath)) { Directory.CreateDirectory(directoryPath); } string strFile = DateTime.Now.ToString("dd_MMM_yyhhmm") + "_" + System.IO.Path.GetFileName(fup_file.PostedFile.FileName); fup_file.PostedFile.SaveAs((directoryPath + strFile)); filepath = directoryPath + strFile; } //using (SqlCommand cmd = new SqlCommand()) //{ // cmd.Connection = conn; // cmd.CommandType = CommandType.StoredProcedure; // cmd.CommandText = "InsertTimeMaster"; // cmd.Parameters.AddWithValue("@partno", DropPartNo.Text.Trim()); // cmd.Parameters.AddWithValue("@operation", DropOperation.Text.Trim()); // cmd.Parameters.AddWithValue("@bottlenecktime", TxtBottleNeckTime.Text.Trim()); // cmd.Parameters.AddWithValue("@tt", TxtTt.Text.Trim()); // cmd.ExecuteNonQuery(); // BindTimeMaster(); // Clear(); // //gridTimemaster.DataBind(); // // gridTimemaster.DataSource = ds.Tables[0]; // // gridTimemaster.DataBind(); // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Saved Successfully');", true); // clearcontrols(); // // popup.Hide(); objtime = new TimeMaster(); objcontext = new QualitySheetdclassDataContext(); ds = objserver.GetDateset("select * from TimeMaster where PartNo='" + DropPartNo.Text.ToString() + "' and Operation='" + DropOperation.Text.ToString() + "'"); if (ds.Tables[0].Rows.Count > 0) { var query = (from table in objcontext.TimeMasters where table.PartNo == DropPartNo.Text.ToString() select table).FirstOrDefault(); if (query != null) { query.PartNo = DropPartNo.Text.ToString(); query.Operation = DropOperation.Text.ToString(); query.BottleNecktime = Convert.ToDecimal(TxtBottleNeckTime.Text.ToString()); query.tt = Convert.ToDecimal(TxtTt.Text.ToString()); objcontext.SubmitChanges(); clearcontrols(); BindTimeMaster(); } } else { objtime.PartNo = DropPartNo.Text.ToString(); objtime.Operation = DropOperation.Text.ToString(); objtime.BottleNecktime = Convert.ToDecimal(TxtBottleNeckTime.Text.ToString()); objtime.tt = Convert.ToDecimal(TxtTt.Text.ToString()); objcontext.TimeMasters.InsertOnSubmit(objtime); objcontext.SubmitChanges(); ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Submitted Successfuly !');", true); clearcontrols(); BindTimeMaster(); } } catch (Exception ex) { } finally { } }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { conn.Open(); objefficiency = new EfficiencyReport(); try { objefficiency.Partno = DropPartNo.SelectedValue.ToString(); objefficiency.Operation = DropOperation.SelectedValue.ToString(); objefficiency.EffDate = Convert.ToDateTime(TxtDateTime.Text.ToString()); objefficiency.Shift = DropShift.SelectedItem.Text.ToString(); //objefficiency.FromTo = TxtFromTo.Text.ToString(); objefficiency.FromTo = ddl_fromtime.Value.ToString() + " " + ddl_fromampm.Value.ToString() + " To " + ddl_totime.Value.ToString() + " " + ddl_toampm.Value.ToString(); objefficiency.OperatorName = TxtOperatorName.Text.ToString(); objefficiency.MinorStart = txt_speedstart.Value.ToString(); objefficiency.MinorEnd = txt_speedend.Value.ToString(); string mtotal = TxtMinorBreakdown.Text.ToString(); if (mtotal == "" || mtotal == null) { objefficiency.MinorTotal = Convert.ToDecimal(0.00); } else { mtotal = mtotal.Replace(":", "."); objefficiency.MinorTotal = Convert.ToDecimal(mtotal); } objefficiency.BottleNectStart = txt_botstart.Value.ToString(); objefficiency.BottleNectEnd = txt_botend.Value.ToString(); string btotal = TxtbottleNeckTime.Text.ToString(); if (btotal == "" || btotal == null) { objefficiency.BottleNectTotal = Convert.ToDecimal(0.00); } else { btotal = btotal.Replace(":", "."); objefficiency.BottleNectTotal = Convert.ToDecimal(btotal.ToString()); } if (TXTPreventive.Text.ToString() == "") { objefficiency.Mainteance = Convert.ToDecimal(0.00); } else { objefficiency.Mainteance = Convert.ToDecimal(TXTPreventive.Text.ToString()); } if (Txtbreak.Text.ToString() == "") { objefficiency.LenchTea = Convert.ToDecimal(0.00); } else { objefficiency.LenchTea = Convert.ToDecimal(Txtbreak.Text.ToString()); } if (TxtPlan.Text.ToString() == "") { objefficiency.NoPlan = Convert.ToDecimal(0.00); } else { objefficiency.NoPlan = Convert.ToDecimal(TxtPlan.Text.ToString()); } if (TxtPlannedEngg.Text.ToString() == "") { objefficiency.Manufacturing = Convert.ToDecimal(0.00); } else { objefficiency.Manufacturing = Convert.ToDecimal(TxtPlannedEngg.Text.ToString()); } if (TxtMeetings.Text.ToString() == "") { objefficiency.Meeting = Convert.ToDecimal(0.00); } else { objefficiency.Meeting = Convert.ToDecimal(TxtMeetings.Text.ToString()); } if (txt_shift.Text.ToString() == "") { objefficiency.ShiftTime = ""; } else { objefficiency.ShiftTime = txt_shift.Text.ToString(); } if (txt_setup.Text.ToString() == "") { objefficiency.Setup = Convert.ToDecimal(0.00); } else { objefficiency.Setup = Convert.ToDecimal(txt_setup.Text.ToString()); } if (TxtProductionQty.Text.ToString() == "") { objefficiency.ProdQty = Convert.ToDecimal(0.00); } else { objefficiency.ProdQty = Convert.ToDecimal(TxtProductionQty.Text.ToString()); } if (TxtRejection.Text.ToString() == "") { objefficiency.Rejection = Convert.ToDecimal(0.00); } else { objefficiency.Rejection = Convert.ToDecimal(TxtRejection.Text.ToString()); } if (TxtCMMInspection.Text.ToString() == "") { objefficiency.CMM = Convert.ToDecimal(0.00); } else { objefficiency.CMM = Convert.ToDecimal(TxtCMMInspection.Text.ToString()); } objefficiency.EqupStart = txt_eqstarttime.Value.ToString(); objefficiency.EqupEnd = txt_eqendtime.Value.ToString(); string teq = TxtEquipment.Text.ToString(); if (teq == "" || teq == null) { objefficiency.EqupTotal = Convert.ToDecimal(0.00); } else { teq = teq.Replace(":", "."); objefficiency.EqupTotal = Convert.ToDecimal(teq); } objefficiency.UnplannedStart = txt_unstart.Value.ToString(); objefficiency.UnplannedEnd = txt_unend.Value.ToString(); string tunplanned = TxtUnplanned.Text.ToString(); if (tunplanned == "" || tunplanned == null) { objefficiency.UnplannedTotal = Convert.ToDecimal(0.00); } else { tunplanned = tunplanned.Replace(":", "."); objefficiency.UnplannedTotal = Convert.ToDecimal(tunplanned); } objefficiency.SetupStart = txt_setstart.Value.ToString(); objefficiency.SetupEnd = txt_setend.Value.ToString(); string tsetup = TxtChangeOver.Text.ToString(); if (tsetup == "" || tsetup == null) { objefficiency.SetupTotal = Convert.ToDecimal(0.00); } else { tsetup = tsetup.Replace(":", "."); objefficiency.SetupTotal = Convert.ToDecimal(tsetup); } objefficiency.StoragStart = txt_matstart.Value.ToString(); objefficiency.StoragEnd = txt_matend.Value.ToString(); string tstorage = TxtDelay.Text.ToString(); if (tstorage == "" || tstorage == null) { objefficiency.StoragTotal = Convert.ToDecimal(0.00); } else { tstorage = tstorage.Replace(":", "."); objefficiency.StoragTotal = Convert.ToDecimal(tstorage); } objefficiency.MaterialStart = txt_matstart.Value.ToString(); objefficiency.MaterialEnd = txt_matend.Value.ToString(); string tmaterial = TxtDelay.Text.ToString(); if (tmaterial == "" || tmaterial == null) { objefficiency.MaterialTotal = Convert.ToDecimal(0.00); } else { tmaterial = tmaterial.Replace(":", "."); objefficiency.MaterialTotal = Convert.ToDecimal(tmaterial); } objefficiency.StoragStart = txt_opstart.Value.ToString(); objefficiency.StoragEnd = txt_opend.Value.ToString(); string tstorage1 = TxtOpStortages.Text.ToString(); if (tstorage1 == "" || tstorage1 == null) { objefficiency.StoragTotal = Convert.ToDecimal(0.00); } else { tstorage1 = tstorage1.Replace(":", "."); objefficiency.StoragTotal = Convert.ToDecimal(tstorage1); } objefficiency.NTplannedStart = txt_ntstart.Value.ToString(); objefficiency.NTplannedEnd = txt_ntend.Value.ToString(); string ntotal = TxtNotPlanned.Text.ToString(); if (ntotal == "" || ntotal == null) { objefficiency.NTplannedTotal = Convert.ToDecimal(0.00); } else { ntotal = ntotal.Replace(":", "."); objefficiency.NTplannedTotal = Convert.ToDecimal(ntotal); } objefficiency.QualityStart = txt_qstart.Value.ToString(); objefficiency.QualityEnd = txt_qend.Value.ToString(); string qtot = TxtQtyIssues.Text.ToString(); if (qtot == "" || qtot == null) { objefficiency.QualityTotal = Convert.ToDecimal(0.00); } else { qtot = qtot.Replace(":", "."); objefficiency.QualityTotal = Convert.ToDecimal(qtot); } if (TxtUtilTime.Text.ToString() == "") { objefficiency.UtileTime = Convert.ToDecimal(0.00); } else { objefficiency.UtileTime = Convert.ToDecimal(TxtUtilTime.Text.ToString()); } if (TextTt.Text.ToString() == "" || TextTt.Text == null) { objefficiency.TT = Convert.ToDecimal(0.00); } else { objefficiency.TT = Convert.ToDecimal(TextTt.Text.ToString()); } if (TxtPlandClosing.Text == null || TxtPlandClosing.Text.ToString() == "") { objefficiency.Plantclosing = Convert.ToDecimal(0.00); } else { objefficiency.Plantclosing = Convert.ToDecimal(TxtPlandClosing.Text.ToString()); } if (TxtOpenedTime.Text == null || TxtOpenedTime.Text.ToString() == "") { objefficiency.ToOpend = Convert.ToDecimal(0.00); } else { objefficiency.ToOpend = Convert.ToDecimal(TxtOpenedTime.Text.ToString()); } if (TxtPlannedStops.Text == null || TxtPlannedStops.Text.ToString() == "") { objefficiency.PlannedStop = Convert.ToDecimal(0.00); } else { objefficiency.PlannedStop = Convert.ToDecimal(TxtPlannedStops.Text.ToString()); } if (TxtReqtime.Text == null || TxtReqtime.Text.ToString() == "") { objefficiency.TrRequired = Convert.ToDecimal(0.00); } else { objefficiency.TrRequired = Convert.ToDecimal(TxtReqtime.Text.ToString()); } if (TxtDownTimeLoss.Text == null || TxtDownTimeLoss.Text.ToString() == "") { objefficiency.DownTimeLoss = Convert.ToDecimal(0.00); } else { objefficiency.DownTimeLoss = Convert.ToDecimal(TxtDownTimeLoss.Text.ToString()); } if (TxtFunctionTime.Text == null || TxtFunctionTime.Text.ToString() == "") { objefficiency.TfFunction = Convert.ToDecimal(0.00); } else { objefficiency.TfFunction = Convert.ToDecimal(TxtFunctionTime.Text.ToString()); } if (TxtSpeedLoss.Text == null || TxtSpeedLoss.Text.ToString() == "") { objefficiency.TTtime = Convert.ToDecimal(0.00); } else { objefficiency.TTtime = Convert.ToDecimal(TxtSpeedLoss.Text.ToString()); } if (TxtNetOpTime.Text == null || TxtNetOpTime.Text.ToString() == "") { objefficiency.EntOperating = Convert.ToDecimal(0.00); } else { objefficiency.EntOperating = Convert.ToDecimal(TxtNetOpTime.Text.ToString()); } if (TxtQualityloss.Text == null || TxtQualityloss.Text.ToString() == "") { objefficiency.Qloss = Convert.ToDecimal(0.00); } else { objefficiency.Qloss = Convert.ToDecimal(TxtQualityloss.Text.ToString()); } if (TxtUtileTime.Text == null || TxtUtileTime.Text.ToString() == "") { objefficiency.TuUtile = Convert.ToDecimal(0.00); } else { objefficiency.TuUtile = Convert.ToDecimal(TxtUtileTime.Text.ToString()); } if (TxtTRS.Text == null || TxtTRS.Text.ToString() == "") { objefficiency.TRS = Convert.ToDecimal(0.00); } else { objefficiency.TRS = Convert.ToDecimal(TxtTRS.Text.ToString()); } if (TxtTRG.Text == null || TxtTRG.Text.ToString() == "") { objefficiency.TRG = Convert.ToDecimal(0.00); } else { objefficiency.TRG = Convert.ToDecimal(TxtTRG.Text.ToString()); } if (TxtTotalStop.Text == null || TxtTotalStop.Text.ToString() == "") { objefficiency.TotalStop = Convert.ToDecimal(0.00); } else { objefficiency.TotalStop = Convert.ToDecimal(TxtTotalStop.Text.ToString()); } if (TxtTotalStophours.Text == null || TxtTotalStophours.Text.ToString() == "") { objefficiency.UtilTimeStop = Convert.ToDecimal(0.00); } else { objefficiency.UtilTimeStop = Convert.ToDecimal(TxtTotalStophours.Text.ToString()); } objefficiency.MachineName = txt_machinename.Value.ToString(); objefficiency.PID = Session["PID_ID"].ToString(); objQualitySheetdclassDataContext.EfficiencyReports.InsertOnSubmit(objefficiency); objQualitySheetdclassDataContext.SubmitChanges(); objQualitySheetdclassDataContext = null; ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Saved Successfuly !');", true); ClearAll(); } catch (Exception ex) { } finally { } }
protected void btn_update_Click(object sender, ImageClickEventArgs e) { string userrole = ""; objContext = new QualitySheetdclassDataContext(); string usernam = txt_username.Value.ToString(); try{ if (hdn_regid.Value.ToString() != "") { int id = Convert.ToInt32(hdn_regid.Value); if (ddl_role.Value.ToString() == "1") { userrole = "Super Admin"; } if (ddl_role.Value.ToString() == "2") { userrole = "Admin"; } if (ddl_role.Value.ToString() == "3") { userrole = "User"; } var query1 = (from table in objContext.tbl_Registrations where table.Reg_Role == userrole && table.Reg_Username == usernam select table).ToList(); if (query1.Count > 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Already Exist');", true); txt_password.Value = ""; txt_username.Value = ""; txtretype.Value = ""; txt_retype.Value = ""; ddl_role.Value = "0"; } else { var query = (from table in objContext.tbl_Registrations where table.Reg_ID == id select table).FirstOrDefault(); if (query != null) { query.Reg_Username = txt_username.Value.ToString(); query.Reg_Userpassword = txtretype.Value.ToString(); query.Reg_Repassword = txtretype.Value.ToString(); query.Reg_Role = userrole.ToString(); } objContext.SubmitChanges(); LoadRegUser(); // div_save.Visible = true; // div_update.Visible = false; txt_password.Value = ""; txt_username.Value = ""; txtretype.Value = ""; txt_retype.Value = ""; ddl_role.Value = "0"; ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "alert('Data Updated Successfully');", true); } } } catch (Exception ex) { ExceptionLogging.SendExcepToDB(ex); } }
protected void btn_submit_Click(object sender, ImageClickEventArgs e) { string oper = ""; string partno = ""; int extableflg = 0; int flgfix = 0; string mulpartno = string.Empty; string alrpartno = string.Empty; objcontext = new QualitySheetdclassDataContext(); objcontext = new QualitySheetdclassDataContext(); if (GridView2.Rows.Count > 0) { //foreach (GridViewRow row in GridView2.Rows) //{ for (int i = 0; i < GridView2.Rows.Count; i++) { //CheckBox cb = (CheckBox)row.("CheckBox2"); CheckBox cb = (CheckBox)GridView2.Rows[i].FindControl("CheckBox2"); //CheckBox ch = (CheckBox)Grdchild.Rows[Grdchild.SelectedIndex].FindControl("CheckBox1"); if (cb != null && cb.Checked) { var query = (from table in objcontext.FixtureNames where table.Fixturename1 == ddl_funit.SelectedValue.ToString() + "-" + ddl_ftooltype.SelectedValue.ToString() + "" + txt_fixtureno.Value.ToString() + "-" + ddl_fline.SelectedValue.ToString() && table.Partnumber.Contains(GridView2.Rows[i].Cells[1].Text) select table).FirstOrDefault(); if (query != null) { flgfix = 1; alrpartno += "," + GridView2.Rows[i].Cells[1].Text; } else { mulpartno += "," + GridView2.Rows[i].Cells[1].Text; } var query2 = (from table in objcontext.FixtureValues where table.FixName == ddl_funit.SelectedValue.ToString() + "-" + ddl_ftooltype.SelectedValue.ToString() + "" + txt_fixtureno.Value.ToString() + "-" + ddl_fline.SelectedValue.ToString() select table).FirstOrDefault(); if (query2 != null) { oper = query2.Operation.Trim(); string CheckTabName = "QualitySheet_" + ddl_fixcell.SelectedValue.ToString() + "_" + GridView2.Rows[i].Cells[1].Text + "_" + oper.ToString() + ""; string str11 = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '" + CheckTabName + "'"; SqlCommand myCommand = new SqlCommand(str11, strConnString); SqlDataReader myReader = null; int count = 0; // strConnString.Close(); try { if (strConnString.State == ConnectionState.Open) { strConnString.Close(); } strConnString.Open(); myReader = myCommand.ExecuteReader(); while (myReader.Read()) { count++; } myReader.Close(); strConnString.Close(); } catch (Exception ex) { } if (count == 0) { partno = GridView2.Rows[i].Cells[1].Text; extableflg = 1; break; } } else { } } } } mulpartno = mulpartno.TrimStart(','); alrpartno = alrpartno.TrimStart(','); if (flgfix == 1) { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Fixture Number Already Exist for " + alrpartno + " ');", true); } else if (extableflg == 1) { string operationname = ""; if (oper == "1") { operationname = "Operation 1"; } else if (oper == "2") { operationname = "Operation 2"; } else { operationname = oper.ToString().Trim(); } ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Quality Sheet not Created for " + partno.ToString() + "_" + operationname.ToString() + " Please Create the Sheet and then update Fixture');", true); } else if (mulpartno == "") { ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Please Select Atleast One Part No');", true); } else { objn = new FixtureName() { Fixturename1 = ddl_funit.SelectedValue.ToString() + "-" + ddl_ftooltype.SelectedValue.ToString() + "" + txt_fixtureno.Value.ToString() + "-" + ddl_fline.SelectedValue.ToString(), Line = ddl_fline.SelectedValue.ToString(), Model = ddl_model.SelectedValue.ToString(), CreationDate = DateTime.Now.ToShortDateString().ToString(), Partnumber = mulpartno.ToString(), Type = ddl_ftooltype.SelectedValue.ToString(), Unit = ddl_funit.SelectedValue.ToString(), Fixtrue = txt_fixtureno.Value.ToString(), Cell = ddl_fixcell.SelectedValue.ToString() }; objcontext.FixtureNames.InsertOnSubmit(objn); objcontext.SubmitChanges(); ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Saved Successfully');", true); BindPartNumber(); BindUnit(); BindModel(); BindToolType(); BindToolLine(); Bindcell(); loadgrid(); BindData(); txt_fixtureno.Value = ""; } }
protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { //try //{ // objBL_Mac = new BL_Machine(); // objDL_Mac = new DL_Machine(); // //string connString = ""; // // // //string FullPath = "C:\\Users\\System06\\Desktop\\Machinecode.xlsx"; // if (FileUpload1.HasFile) // { // string FullPath = Server.MapPath(FileUpload1.FileName); // string MyPath = System.IO.Path.GetDirectoryName(FullPath); // string myFilename = System.IO.Path.GetFileName(FullPath); // string connString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + FullPath + // ";Extended Properties=\"Excel 12.0;HDR=Yes;IMEX=2\""; // string query = "SELECT [Machine Code] FROM [Sheet1$]"; // OleDbConnection conn = new OleDbConnection(connString); // //if (conn.State == ConnectionState.Closed) // OleDbCommand cmd = new OleDbCommand(query, conn); // conn.Open(); // OleDbDataAdapter da = new OleDbDataAdapter(cmd); // DataSet ds = new DataSet(); // da.Fill(ds); // objBL_Mac.Mode = "ExcelUpload"; // objBL_Mac.ByExcel = ds.GetXml(); // grdMac.DataSource = ds.Tables[0]; // grdMac.DataBind(); // int SQlResult = objDL_Mac.BulkInsert(objBL_Mac); // da.Dispose(); // conn.Close(); // conn.Dispose(); // } // else // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Please Select Ofarticle file !');", true); // } //} //catch (Exception ex) //{ //} //finally //{ //} string fileName = FileUpload1.ResolveClientUrl(FileUpload1.PostedFile.FileName); int count = 0; QualitySheetdclassDataContext conLinq = new QualitySheetdclassDataContext("Data Source=HOME;Initial Catalog=DBWIS;Integrated Security=true"); try { DataTable dtExcel = new DataTable(); string SourceConstr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" + fileName + "';Extended Properties= 'Excel 8.0;HDR=Yes;IMEX=1'"; OleDbConnection con = new OleDbConnection(SourceConstr); string query = "Select Partno,Description from [Sheet1$]"; OleDbDataAdapter data = new OleDbDataAdapter(query, con); data.Fill(dtExcel); for (int i = 1; i < dtExcel.Rows.Count; i++) { try { count += conLinq.ExecuteCommand("insert into tbl_PartNo(PartNo,Description)values(" + dtExcel.Rows[i]["PartNo"] + "," + dtExcel.Rows[i]["Description"] + ") "); } catch (Exception ex) { continue; } } if (count == dtExcel.Rows.Count) { } else { } } catch (Exception ex) { throw ex; } finally { conLinq.Dispose(); } }