Example #1
0
 protected void btnOk_Click(object sender, EventArgs e)
 {
     if (LUcStation == null)
     {
         ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert(' You  must choose least one station! ')</script>");
     }
     else
     {
         bool flag = true;
         int  id   = 0;
         if (!entity.Colors.Any(x => x.ColorName == txtColor.Text))
         {
             entity.ColorsInsert(txtColor.Text);
         }
         id = entity.Colors.Where(x => x.ColorName == txtColor.Text).First().ColorId;
         entity.ProcessesInsert(txtProcess.Text, id);
         foreach (ucStation item in LUcStation)
         {
             entity.ProcessDetailsInsert(Convert.ToInt32(item.TypeId), Convert.ToInt32(item.Time), item.Details);
         }
         if (Session["edit"] != null)
         {
             bool edit = (bool)Session["edit"];
             if (edit)
             {
                 if (Session["gvr"] != null)
                 {
                     GridViewRow gvr = Session["gvr"] as GridViewRow;
                     gvProcess.DeleteRow(gvr.RowIndex);
                     Session["edit"] = null;
                 }
             }
         }
         ChangeVisible();
         Session["lUcStation"] = LUcStation;
         gvProcess.DataBind();
     }
 }