コード例 #1
0
 private void TxtRouteName_Leave(object sender, EventArgs e)
 {
     try
     {
         if (TxtRouteName.Text == "" || TxtRouteName.Text == null)
         {
             MessageBox.Show(this, "Route Name Can not blank", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         else
         {
             DataTable dt = DbClass.getdata(CommandType.Text, "select * from route.route_data where route_name='" + TxtRouteName.Text.Trim() + "'");
             if (dt.Rows.Count > 0)
             {
                 MessageBox.Show(this, "Route Name Already Exist", "Information", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                 return;
             }
             else
             {
                 trlRoute11.FocusedNode.SetValue(1, TxtRouteName.Text);
                 RouteConn.executequery(CommandType.Text, "update route_data set  Route_Name = '" + Convert.ToString(TxtRouteName.Text).Trim() + "' where id='" + Convert.ToString(TxtRouteID.Text).Trim() + "' ");
             }
         }
         if (modification == false)
         {
             TxtRouteName.Enabled = false;
         }
         else
         {
             TxtRouteName.Enabled = true;
         }
     }
     catch { }
 }
コード例 #2
0
        public void InsertRouteName()
        {
            try
            {
                if (CmbLevel.SelectedIndex == 0)
                {
                    MessageBox.Show(this, "Please select the Level", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                RouteConn.executequery(CommandType.Text, "insert route_data (Route_Name ,Route_Level,Date,DatabaseName) values ( '" + Convert.ToString(TxtRouteName.Text) + "','" + Convert.ToString(CmbLevel.Text) + "' ,'" + PublicClass.GetDatetime() + "' ,'" + PublicClass.User_DataBase + "' ) ");

                DataTable dt = new DataTable();
                dt = RouteConn.getdata(CommandType.Text, "select  max(Id)  from route_data");
                string SId = PublicClass.DefVal(Convert.ToString(dt.Rows[0][0]), "0");
                Node_Parent       = null;
                TxtRouteID.Text   = Convert.ToString(Convert.ToInt32(SId));
                TxtRouteName.Text = "Route" + TxtRouteID.Text;
                TxtRouteName.Properties.ReadOnly = false;
                Node_Parent = trlRoute11.AppendNode(new object[] { Convert.ToString(TxtRouteID.Text).Trim(), Convert.ToString(TxtRouteName.Text).Trim(), "Route" }, Node_Parent);

                trlRoute11.SetFocusedNode(Node_Parent);
                TxtRouteName.Focus();
                _objMain.lblStatus.Caption = "Status: Creating Route";
            }
            catch { }
        }
コード例 #3
0
 private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (e.ClickedItem.Text.Trim() == "Insert Route")
     {
         InsertRouteName();
     }
     else if (e.ClickedItem.Text.Trim() == "Delete")
     {
         if (TxtRouteName.Text == "")
         {
             MessageBox.Show("Please select Route first");
         }
         else
         {
             try
             {
                 RouteConn.executequery(CommandType.Text, "call deleteroute ('" + (string)trlRoute11.FocusedNode.GetDisplayText(0) + "')");
                 MessageBox.Show("Route Deleted Successfully");
                 FillTreeNode(Convert.ToString(CmbLevel.Text).Trim());
                 TxtRouteName.Text          = "";
                 TxtRouteID.Text            = "";
                 _objMain.lblStatus.Caption = "Status: Route Deleted Successfully";
             }
             catch { }
         }
     }
 }
コード例 #4
0
        private void trlRoute11_DragLeave(object sender, EventArgs e)
        {
            try
            {
                trlRoute11.SetFocusedNode(Node_Parent);
                Node_Parent = trlRoute11.FocusedNode;

                string st = (string)trlRoute11.FocusedNode.GetDisplayText(0);
                IDVAlue = (string)trlFactoriesPrsnt11.FocusedNode.GetDisplayText(0);
                DataTable dt = new DataTable();
                dt = RouteConn.getdata(CommandType.Text, "select distinct distinct type_id  from route_data1  where id= '" + Convert.ToString(TxtRouteID.Text).Trim() + "' and type_id = '" + Convert.ToString(IDVAlue).Trim() + "'");
                if (dt.Rows.Count - 1 >= 0)
                {
                    MessageBox.Show(this, "On this Route Data is already Exist ", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    if (PublicClass.currentInstrument == "Impaq-Benstone" || PublicClass.currentInstrument == "FieldPaq2")
                    {
                        FillTreeNodeValue(Convert.ToString(CmbLevel.Text).Trim());
                        RouteConn.executequery(CommandType.Text, "Insert into route_data1 (id,type_id ) values ( '" + Convert.ToString(TxtRouteID.Text).Trim() + "' , '" + IDVAlue + "'  )");
                    }
                    else
                    {
                        DataTable dt1 = RouteConn.getdata(CommandType.Text, "select * from route_data1 where ID='" + Convert.ToString(TxtRouteID.Text).Trim() + "'");
                        if (dt1.Rows.Count <= 0)
                        {
                            FillTreeNodeValue(Convert.ToString(CmbLevel.Text).Trim());
                            RouteConn.executequery(CommandType.Text, "Insert into route_data1 (id,type_id ) values ( '" + Convert.ToString(TxtRouteID.Text).Trim() + "' , '" + IDVAlue + "'  )");
                        }
                        else
                        {
                            MessageBox.Show(this, "Load Only One level", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                }
            }
            catch { }
        }
コード例 #5
0
        public void Fill_TrlRoute_MachineWise()
        {
            try
            {
                DataTable dt = new DataTable();
                dt = RouteConn.getdata(CommandType.Text, "select distinct a.Id,a.Route_Name,a.Route_Level,b.Type_ID  from route_data a left join route_data1 b on a.id=b.ID where Route_Level='" + CmbLevel.Text.Trim().ToString() + "' and databasename='" + PublicClass.User_DataBase + "' ");
                DataTable dtt = new DataTable();
                dtt = RouteConn.getdata(CommandType.Text, "select distinct a.Id ,a.Route_Name from route_data a left join route_data1 b on a.id=b.ID where Route_Level='" + CmbLevel.Text.Trim().ToString() + "' and databasename='" + PublicClass.User_DataBase + "' ");
                foreach (DataRow drr in dtt.Rows)
                {
                    TreeListNode node = null;
                    node = trlRoute11.AppendNode(new object[] { Convert.ToString(drr["Id"]), Convert.ToString(drr["Route_Name"]), "Route" }, node);
                    trlRoute11.SetFocusedNode(node);

                    foreach (DataRow dr in dt.Select("Id ='" + Convert.ToString(drr["Id"]).Trim() + "' "))
                    {
                        Insert_Machine(PublicClass.DefVal(Convert.ToString(dr["Type_ID"]), "0"));
                    }
                }
            }
            catch { }
        }