public override int GetHashCode() { unchecked { int result = (FixtureName != null ? FixtureName.GetHashCode() : 0); result = (result * 397) ^ Total; result = (result * 397) ^ Index; return(result); } }
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 = ""; } }