Example #1
0
 protected bool ViewEdit()
 {
     if (gvProcess.SelectedIndex == -1)
     {
         ClientScript.RegisterStartupScript(GetType(),
                                            "Message", "<SCRIPT LANGUAGE='javascript'>alert(' You must select editing process ')</script>");
         return(false);
     }
     else
     {
         btnEdit.Enabled   = false;
         btnNew.Enabled    = false;
         gvProcess.Visible = false;
         if (Session["gvr"] != null)
         {
             GridViewRow gvr = Session["gvr"] as GridViewRow;
             txtProcess.Text = gvr.Cells[2].Text;
             bool flag = true;
             if (Session["dtColors"] != null)
             {
                 dtColors = Session["dtColors"] as DataTable;
                 for (int i = 0; flag == true && i < entity.Colors.ToList().Count; i++)
                 {
                     if (((int)entity.Colors.ToList()[i].ColorId) == Convert.ToInt32((gvr.Cells[3].Text)))
                     {
                         flag = false;
                         ddlColor.SelectedIndex = i;
                     }
                 }
             }
             txtColor.Text = gvr.Cells[3].Text;
             var dtProcessDetails = entity.ProcessDetailsSelect(Convert.ToInt32(gvr.Cells[1].Text)).ToList();
             pnlStation.Controls.Clear();
             for (int i = 0; i < dtProcessDetails.Count; i++)
             {
                 uc           = this.LoadControl("ucStation.ascx") as ucStation;
                 uc.TypeId    = (int)(dtProcessDetails[i].StationId);
                 uc.Type      = dtProcessDetails[i].Station.ToString();
                 uc.Time      = dtProcessDetails[i].Minutes.ToString();
                 uc.Details   = dtProcessDetails[i].More_details.ToString();
                 uc.OnCancel += new Cancellation(UcStation_OnCancel);
                 pnlStation.Controls.Add(uc);
                 LUcStation.Add(uc);
             }
             btnOk.Visible = true;
         }
     }
     return(true);
 }