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 btn_update_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         objcontext = new QualitySheetdclassDataContext();
         var query = (from table in objcontext.UnitMastermbus where table.MID == Convert.ToInt32(hdn_masterid.Value.ToString()) select table).First();
         if (query != null)
         {
             query.MText  = txt_unitname.Value.ToString();
             query.MValue = txt_unitname.Value.ToString();
             objcontext.SubmitChanges();
             loadgrid();
             txt_unitname.Value = "";
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
 protected void btn_update_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         objcontext = new QualitySheetdclassDataContext();
         var query = (from tbale in objcontext.LineMasters 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 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
        {
        }
    }
Example #6
0
    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 ---";
 }
Example #8
0
 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 = "";
 }
Example #9
0
    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();
        }
    }
    protected void btn_update_Click(object sender, ImageClickEventArgs e)
    {
        var query = (from table in objcontext.MailAutorizeds where table.ID == Convert.ToInt32(hdn_midauth.Value.ToString()) select table).First();

        if (query != null)
        {
            query.MailID = txt_mailaddress.Value.ToString();
            query.unit   = ddl_availability.Text;
            objcontext.SubmitChanges();
            loadgrid();
            txt_mailaddress.Value = "";
            ddl_availability.Text = "--- Select Unit ---";
        }
        else
        {
        }
    }
 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 = "";
 }
Example #12
0
    protected void btn_update_Click(object sender, ImageClickEventArgs e)
    {
        var query = (from table in objcontext.Mails where table.ID == Convert.ToInt32(hdn_mid.Value.ToString()) select table).First();

        if (query != null)
        {
            query.Username = txt_musername.Value.ToString();
            query.Port     = txt_mport.Value.ToString();
            query.Password = txt_mpassword.Value.ToString();
            objcontext.SubmitChanges();
            loadgrid();
            txt_musername.Value = "";
            txt_mport.Value     = "";
            txt_mpassword.Value = "";
        }
        else
        {
        }
    }
Example #13
0
 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
     {
     }
 }
Example #14
0
 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
     {
     }
 }
    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
        {
        }
    }
Example #17
0
    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_submit_Click(object sender, ImageClickEventArgs e)
 {
     try
     {
         objcontext = new QualitySheetdclassDataContext();
         objt       = new ToolTypeMastermbu()
         {
             TText  = txt_tvalue.Value.ToString(),
             TValue = txt_ttype.Value.ToString()
         };
         txt_ttype.Value  = "";
         txt_tvalue.Value = "";
         objcontext.ToolTypeMastermbus.InsertOnSubmit(objt);
         objcontext.SubmitChanges();
         loadgrid();
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
 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 = "";
     }
 }
Example #20
0
    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)
    {
        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
        {
        }
    }
Example #22
0
 protected void btn_update_Click1(object sender, ImageClickEventArgs e)
 {
     try
     {
         var query = (from table in objcontext.FixtureModels where table.ID == Convert.ToInt32(hdn_modelid.Value.ToString()) select table).First();
         if (query != null)
         {
             query.Mtext  = txt_modelname.Value.ToString();
             query.Mvalue = txt_modelname.Value.ToString();
             objcontext.SubmitChanges();
             txt_modelname.Value = "";
             loadgrid();
         }
         else
         {
         }
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
    protected void btn_update_Click(object sender, ImageClickEventArgs e)
    {
        string oper       = "";
        string partno     = "";
        int    flgfix     = 0;
        int    extableflg = 0;
        string mulpartno  = string.Empty;
        string alrpartno  = string.Empty;

        var query = (from table in objcontext.FixtureNames where table.FID == Convert.ToInt32(hdn_fid.Value.ToString()) select table).First();

        if (query != null)
        {
            //mulpartno = query.Partnumber.ToString();
            if (GridView2.Rows.Count > 0)
            {
                for (int i = 0; i < GridView2.Rows.Count; i++)
                {
                    CheckBox cb = (CheckBox)GridView2.Rows[i].FindControl("CheckBox2");
                    if (cb != null && cb.Checked)
                    {
                        //var query1 = (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 (query1 != 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
            {
                query.Fixturename1 = ddl_funit.SelectedValue.ToString() + "-" + ddl_ftooltype.SelectedValue.ToString() + "" + txt_fixtureno.Value.ToString() + "-" + ddl_fline.SelectedValue.ToString();
                query.Line         = ddl_fline.SelectedValue.ToString();
                query.Model        = ddl_model.SelectedValue.ToString();
                query.Partnumber   = mulpartno.ToString();
                query.Type         = ddl_ftooltype.SelectedValue.ToString();
                query.Unit         = ddl_funit.SelectedValue.ToString();
                query.Fixtrue      = txt_fixtureno.Value.ToString();
                query.Cell         = ddl_fixcell.SelectedValue.ToString();
                objcontext.SubmitChanges();
                BindPartNumber();
                BindUnit();
                BindModel();
                BindToolType();
                BindToolLine();
                Bindcell();
                loadgrid();
                BindData();
                uncheck_partno();
                txt_fixtureno.Value   = "";
                ddl_fixcell.Enabled   = true;
                ddl_funit.Enabled     = true;
                ddl_fline.Enabled     = true;
                ddl_ftooltype.Enabled = true;
                txt_fixtureno.Attributes.Remove("disabled");
                div_fistruesave.Visible   = true;
                div_fistrueupdate.Visible = false;
            }
        }
        else
        {
        }
    }
    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
        {
        }
    }
Example #26
0
    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);
        }
    }
Example #27
0
    protected void btn_update_Click(object sender, ImageClickEventArgs e)
    {
        string path      = "";
        string filename  = "";
        string filename1 = "";
        string Id        = hdn_id.Value.ToString();

        if (fld_drawings.HasFile)
        {
            string path1 = Server.MapPath("~/ABU/");
            createfolder(path1, "Drawing");
            filename1 = System.IO.Path.GetFileName(fld_drawings.PostedFile.FileName.ToString());
            string f_name = path1 + "Drawing" + '\\' + Path.GetFileName(fld_drawings.PostedFile.FileName);
            fld_drawings.PostedFile.SaveAs(path1 + "Drawing" + '\\' + filename1);
        }
        else
        {
            da = new SqlDataAdapter("select * from Abu_Master where ID='" + Convert.ToInt32(Id) + "'", strConnString);
            ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                filename1 = ds.Tables[0].Rows[0]["Drawings"].ToString();
            }
        }
        if (up_photo.HasFile)
        {
            path = Server.MapPath("~/ABU/");
            createfolder(path, "Tools");
            filename = System.IO.Path.GetFileName(up_photo.PostedFile.FileName.ToString());
            string f_name = path + "Tools" + '\\' + Path.GetFileName(up_photo.PostedFile.FileName);
            up_photo.PostedFile.SaveAs(path + "Tools" + '\\' + filename);
        }
        else
        {
            da = new SqlDataAdapter("select * from Abu_Master where ID='" + Convert.ToInt32(Id) + "'", strConnString);
            ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                filename = ds.Tables[0].Rows[0]["Photo"].ToString();
            }
        }
        try
        {
            int toolno = 0, ret = 0;
            da = new SqlDataAdapter("select * from Abu_Master where ID='" + Convert.ToInt32(Id) + "'", strConnString);
            ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (txt_toolnumber.SelectedValue.ToString() == "0")
                {
                    toolno = Convert.ToInt32(ds.Tables[0].Rows[0]["ToolNumber"].ToString());
                }
                else
                {
                    toolno = Convert.ToInt32(txt_toolnumber.SelectedValue.ToString());
                }
            }

            string avail   = ddl_availability.Text.ToString();
            string station = txt_mstation.Value.ToString();
            string desc    = txt_description.Value.ToString();
            if (txt_retension.Value.ToString() == "")
            {
                ret = Convert.ToInt32(ds.Tables[0].Rows[0]["Rentime"].ToString());
            }
            else
            {
                ret = Convert.ToInt32(txt_retension.Value.ToString());
            }

            string issue    = txt_issuedon.Value.ToString();
            string qty      = txt_quantity.Value.ToString();
            string maintain = hdn_sparecount1.Value.ToString();
            string next     = txt_dueon.Value.ToString();
            if (txt_extended.Value.ToString() == "")
            {
                txt_extended.Value = "0";
            }
            int total = Convert.ToInt32(ret) + Convert.ToInt32(txt_extended.Value.ToString());

            string grom  = "";
            string gto   = "";
            string yfrom = "";
            string yto   = "";
            string rfrom = "";
            string rto   = "";

            string res = "";

            da = new SqlDataAdapter("select * from AbuToolMaster where ID='" + Convert.ToInt32(toolno) + "'", strConnString);
            ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count > 0)
            {
                string grfrom = ds.Tables[0].Rows[0]["Gfrom"].ToString();
                string grto   = ds.Tables[0].Rows[0]["Gto"].ToString();
                string ylfrom = ds.Tables[0].Rows[0]["Yfrom"].ToString();
                string ylto   = ds.Tables[0].Rows[0]["Yto"].ToString();
                string rdfrom = ds.Tables[0].Rows[0]["Rfrom"].ToString();
                string rdto   = ds.Tables[0].Rows[0]["Rto"].ToString();

                double gf = (Convert.ToInt32(total)) * ((Convert.ToDouble(grto) / 100));
                double yf = (Convert.ToInt32(total)) * ((Convert.ToDouble(ylfrom) / 100));
                double yt = (Convert.ToInt32(total)) * ((Convert.ToDouble(ylto) / 100));
                double rf = (Convert.ToInt32(total)) * ((Convert.ToDouble(rdfrom) / 100));
                double rt = (Convert.ToInt32(total)) * ((Convert.ToDouble(rdto) / 100));

                int g  = (int)Math.Round(gf);
                int y  = (int)Math.Round(yf);
                int y1 = (int)Math.Round(yt);
                int r  = (int)Math.Round(rf);
                int r1 = (int)Math.Round(rt);

                DateTime days = Convert.ToDateTime(issue);
                grom = days.AddDays(Convert.ToInt32(0)).ToShortDateString().ToString();
                DateTime days1 = Convert.ToDateTime(issue);
                gto = days1.AddDays(Convert.ToInt32(g)).ToShortDateString().ToString();

                DateTime days2 = Convert.ToDateTime(gto);
                yfrom = days2.AddDays(Convert.ToInt32(1)).ToShortDateString().ToString();
                DateTime days3 = Convert.ToDateTime(issue);
                yto = days3.AddDays(Convert.ToInt32(y1)).ToShortDateString().ToString();

                DateTime days4 = Convert.ToDateTime(yto);
                rfrom = days4.AddDays(Convert.ToInt32(1)).ToShortDateString().ToString();
                DateTime days5 = Convert.ToDateTime(issue);
                rto = days5.AddDays(Convert.ToInt32(r1)).ToShortDateString().ToString();
            }
            else
            {
            }
            if (ddl_replaced.SelectedValue.ToString() != "0")
            {
                var query = (from table in objcontext.Abu_Masters where table.ID == Convert.ToInt32(Id) select table).First();
                if (query != null)
                {
                    query.Spare      = ddl_replaced.SelectedValue.ToString();
                    query.LifeExtend = txt_extended.Value.ToString();
                    query.ToolStatus = "Inactive";
                    query.ModifyDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
                    objcontext.SubmitChanges();
                    cleardata();
                    loadgrid();
                }
                else
                {
                }
                string date = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
                objabu = new Abu_Master()
                {
                    ToolNumber   = toolno.ToString(),
                    Availability = avail.ToString(),
                    Station      = station.ToString(),
                    Description  = desc.ToString(),
                    Photo        = filename.ToString(),
                    Rentime      = ret.ToString(),
                    Issuedon     = issue.ToString(),
                    StationQty   = qty.ToString(),
                    Nextdueon    = rto.ToString(),
                    GreenFrom    = Convert.ToDateTime(grom.ToString()),
                    GreenTo      = Convert.ToDateTime(gto.ToString()),
                    YellowFrom   = Convert.ToDateTime(yfrom.ToString()),
                    YellowTo     = Convert.ToDateTime(yto.ToString()),
                    RedFrom      = Convert.ToDateTime(rfrom.ToString()),
                    RedTo        = Convert.ToDateTime(rto.ToString()),
                    Spare        = ddl_replaced.SelectedValue.ToString(),
                    LifeExtend   = txt_extended.Value.ToString(),
                    Rectified    = txt_rectified.Value.ToString(),
                    Others       = txt_others.Value.ToString(),
                    Premature    = txt_premature.Value.ToString(),
                    Maintained   = maintain.ToString(),
                    ToolStatus   = "Active",
                    Drawings     = filename1,
                    MailFlag     = "",
                    ModifyDate   = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"))
                };
                objcontext.Abu_Masters.InsertOnSubmit(objabu);
                objcontext.SubmitChanges();
                cleardata();
                loadgrid();
                //objcontext = new QualitySheetdclassDataContext();
                //var query1 = (from table in objcontext.SpareMasters where table.ToolNumber == toolno.ToString() select table).First();
                //if (query1 != null)
                //{
                //    query1.TotalCount = hdn_sparecount1.Value.ToString();
                //    objcontext.SubmitChanges();
                //}
                //else
                //{
                //}
            }
            else
            {
                var query2 = (from table in objcontext.Abu_Masters where table.ToolNumber == toolno.ToString() && table.ToolStatus == "Active" select table).First();

                //if (query2 != null)
                //{
                //    query2.Spare = ddl_replaced.SelectedValue.ToString();
                //    query2.LifeExtend = txt_extended.Value.ToString();
                //    query2.ToolStatus = "Inactive";
                //    query2.ModifyDate = Convert.ToDateTime(System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"));
                //    objcontext.SubmitChanges();
                //    cleardata();
                //    loadgrid();
                //}
                //else
                //{
                //}
                string date = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");

                if (query2 != null)
                {
                    query2.ToolNumber   = toolno.ToString();
                    query2.Availability = avail.ToString();
                    query2.Station      = station.ToString();
                    query2.Description  = desc.ToString();
                    query2.Photo        = filename.ToString();
                    query2.Rentime      = ret.ToString();
                    query2.Issuedon     = issue.ToString();
                    query2.StationQty   = qty.ToString();
                    query2.Nextdueon    = rto.ToString();
                    query2.GreenFrom    = Convert.ToDateTime(grom.ToString());
                    query2.GreenTo      = Convert.ToDateTime(gto.ToString());
                    query2.YellowFrom   = Convert.ToDateTime(yfrom.ToString());
                    query2.YellowTo     = Convert.ToDateTime(yto.ToString());
                    query2.RedFrom      = Convert.ToDateTime(rfrom.ToString());
                    query2.RedTo        = Convert.ToDateTime(rto.ToString());

                    query2.Drawings = filename1;
                    objcontext.SubmitChanges();
                    cleardata();
                    loadgrid();
                }
            }
        }
        catch (Exception ex)
        {
        }
        finally
        {
            cleardata();
            loadgrid();
        }
    }
    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 ImageButton1_Click(object sender, ImageClickEventArgs e)
    {
        conn.Open();
        objefficiency = new EfficiencyReport();
        try
        {
            objefficiency.Partno    = ddl_partno.SelectedIndex.ToString();
            objefficiency.Operation = ddl_operation.SelectedIndex.ToString();
            objefficiency.EffDate   = Convert.ToDateTime(txt_date.Value.ToString());
            objefficiency.Shift     = ddl_shift.SelectedIndex.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 = txt_operatorname.Value.ToString();
            objefficiency.MinorStart   = txt_speedstart.Value.ToString();
            objefficiency.MinorEnd     = txt_speedend.Value.ToString();

            string mtotal = txt_totspeed.Text.ToString();
            if (mtotal == "" || mtotal == null)
            {
                objefficiency.MinorTotal = Convert.ToDecimal(0.00);
            }
            else
            {
                mtotal = mtotal.Replace(":", ".");
                objefficiency.MinorTotal = Convert.ToDecimal(mtotal);
            }

            if (txt_maintenance.Value.ToString() == "")
            {
                objefficiency.Mainteance = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.Mainteance = Convert.ToDecimal(txt_maintenance.Value.ToString());
            }
            if (txt_lunch.Value.ToString() == "")
            {
                objefficiency.LenchTea = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.LenchTea = Convert.ToDecimal(txt_lunch.Value.ToString());
            }
            if (txt_noplan.Value.ToString() == "")
            {
                objefficiency.NoPlan = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.NoPlan = Convert.ToDecimal(txt_noplan.Value.ToString());
            }
            if (txt_manuf.Value.ToString() == "")
            {
                objefficiency.Manufacturing = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.Manufacturing = Convert.ToDecimal(txt_manuf.Value.ToString());
            }
            if (txt_meeting.Value.ToString() == "")
            {
                objefficiency.Meeting = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.Meeting = Convert.ToDecimal(txt_meeting.Value.ToString());
            }
            if (txt_shifttime.Value.ToString() == "")
            {
                objefficiency.ShiftTime = "";
            }
            else
            {
                objefficiency.ShiftTime = txt_shifttime.Value.ToString();
            }
            if (txt_fixed.Value.ToString() == "")
            {
                objefficiency.Setup = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.Setup = Convert.ToDecimal(txt_fixed.Value.ToString());
            }
            if (txt_prodqty.Text.ToString() == "")
            {
                objefficiency.ProdQty = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.ProdQty = Convert.ToDecimal(txt_prodqty.Text.ToString());
            }
            if (txt_rejection.Value.ToString() == "")
            {
                objefficiency.Rejection = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.Rejection = Convert.ToDecimal(txt_rejection.Value.ToString());
            }
            if (txt_cmm.Text.ToString() == "")
            {
                objefficiency.CMM = Convert.ToDecimal(0.00);
            }
            else
            {
                objefficiency.CMM = Convert.ToDecimal(txt_cmm.Text.ToString());
            }
            objefficiency.EqupStart = txt_startdown.Value.ToString();
            objefficiency.EqupEnd   = txt_downend.Value.ToString();
            string teq = txt_totdowntime.Value.ToString();
            if (teq == "" || teq == null)
            {
                objefficiency.EqupTotal = Convert.ToDecimal(0.00);
            }
            else
            {
                teq = teq.Replace(":", ".");
                objefficiency.EqupTotal = Convert.ToDecimal(teq);
            }

            if (Text_Util.Value.ToString() == "")
            {
                objefficiency.UtileTime = Convert.ToDecimal(0.00);
            }

            else
            {
                objefficiency.UtileTime = Convert.ToDecimal(Text_Util.Value.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_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 = "";
        }
    }