public void GetEntryTime() { objact = new Actual_PrdQty(); dt = new DataTable(); objQualitySheetdclassDataContext = new QualitySheetdclassDataContext(); //var query = (from c in (objQualitySheetdclassDataContext.CycleTimeEntries) select c).ToList(); da = new SqlDataAdapter("select * from Actual_PrdQty", 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; } gridprdqty.DataSource = paging; gridprdqty.DataBind(); div_actual.Visible = true; div_actualerror.Visible = false; createpaging(); } else { div_actual.Visible = false; div_actualerror.Visible = true; } }
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 = ""; } }