Group
How do I use Group
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: ClassBLL.cs
Copy
15 public void ChuanBi3Table(string MaHK)
16 {
17 //Table 1
18 string sql1 = " select MaSV,'sotinchi'=sum(SoTC) " +
19 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
20 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaHK='" + MaHK + "' " +
21 " group by MaSV ";
22 DataTable dt1 = da.GetTable(sql1);
23 for (int i = 0; i < dt1.Rows.Count; i++)
24 {
25 string sql_1 = "Insert into Loptc values('" + dt1.Rows[i][0] + "'," + dt1.Rows[i][1] + ")";
26 da.ExcuteNonQuery(sql_1);
27 }
28 //Table 2
29 string sql2 = "select MaSV,'cuoiky'=sum(DiemTk10*SoTC) " +
30 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
31 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaHK='" + MaHK + "' " +
32 " group by MaSV ";
33 DataTable dt2 = da.GetTable(sql2);
34 for (int i = 0; i < dt2.Rows.Count; i++)
35 {
36 string sql_2 = "Insert into Lopdiem10 values('" + dt2.Rows[i][0] + "'," + dt2.Rows[i][1] + ")";
37 da.ExcuteNonQuery(sql_2);
38 }
39 //Table 3
40 string sql3 = " select Lopdiem10.MaSV,'TrungBinhCuoiKyHe10'=cuoiky/sotinchi " +
41 " from Lopdiem10 left join Loptc on Loptc.MaSV=Lopdiem10.MaSV";
42 DataTable dt3 = da.GetTable(sql3);
43 for (int i = 0; i < dt3.Rows.Count; i++)
44 {
45 string sql_3 = "Insert into DTB values('" + dt3.Rows[i][0] + "'," + dt3.Rows[i][1] + ")";
46 da.ExcuteNonQuery(sql_3);
47 }
48 }
File name: ClassBLL.cs
Copy
49 public void ChuanBi3Table()
50 {
51 //Table 1
52 string sql1 = " select MaSV,'sotinchi'=sum(SoTC) " +
53 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
54 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD " +
55 " group by MaSV ";
56 DataTable dt1 = da.GetTable(sql1);
57 for (int i = 0; i < dt1.Rows.Count; i++)
58 {
59 string sql_1 = "Insert into Loptc values('" + dt1.Rows[i][0] + "'," + dt1.Rows[i][1] + ")";
60 da.ExcuteNonQuery(sql_1);
61 }
62 //Table 2
63 string sql2 = "select MaSV,'cuoiky'=sum(DiemTk10*SoTC) " +
64 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
65 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD " +
66 " group by MaSV ";
67 DataTable dt2 = da.GetTable(sql2);
68 for (int i = 0; i < dt2.Rows.Count; i++)
69 {
70 string sql_2 = "Insert into Lopdiem10 values('" + dt2.Rows[i][0] + "'," + dt2.Rows[i][1] + ")";
71 da.ExcuteNonQuery(sql_2);
72 }
73 //Table 3
74 string sql3 = " select Lopdiem10.MaSV,'TrungBinhCuoiKyHe10'=cuoiky/sotinchi " +
75 " from Lopdiem10 left join Loptc on Loptc.MaSV=Lopdiem10.MaSV";
76 DataTable dt3 = da.GetTable(sql3);
77 for (int i = 0; i < dt3.Rows.Count; i++)
78 {
79 string sql_3 = "Insert into DTB values('" + dt3.Rows[i][0] + "'," + dt3.Rows[i][1] + ")";
80 da.ExcuteNonQuery(sql_3);
81 }
82 }
File name: ClassBLL.cs
Copy
213 public string TinhDiemTB(string MaSV, string MaHK)
214 {
215 SqlConnection con = da.GetConnect();
216 con.Open();
217 //view tc
218 string sql1 = " select 'sotinchi'=sum(SoTC) " +
219 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
220 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
221 " group by MaSV ";
222 SqlCommand cmd1 = new SqlCommand(sql1, con);
223 string tc = cmd1.ExecuteScalar().ToString();
224 // view diem10
225 string sql2 = " select 'cuoiky'=sum(DiemTk10*SoTC) " +
226 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
227 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
228 " group by MaSV ";
229 SqlCommand cmd2 = new SqlCommand(sql2, con);
230 string diem10 = cmd2.ExecuteScalar().ToString();
231 //view diem4
232 string sql3 = " select 'cuoiky'=sum(DiemTk4*SoTC) " +
233 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
234 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='"+MaSV+"' and MaHK='"+MaHK+"' " +
235 " group by MaSV ";
236 SqlCommand cmd3 = new SqlCommand(sql3, con);
237 string diem4 = cmd3.ExecuteScalar().ToString();
238
239
240 string ketqua="";
241 ketqua = Convert.ToDouble(diem10) / Convert.ToDouble(tc) + "," + Convert.ToDouble(diem4) / Convert.ToDouble(tc) ;
242 return ketqua;
243 }
File name: ClassBLL.cs
Copy
244 public string TinhDiemTB(string MaSV)
245 {
246 SqlConnection con = da.GetConnect();
247 con.Open();
248 //view tc
249 string sql1 = " select 'sotinchi'=sum(SoTC) " +
250 " from KetQua kq,HocPhan hp,NhomHocPhan nhp,KeHoachGiangDay khgd " +
251 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khgd.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
252 " group by MaSV ";
253 SqlCommand cmd1 = new SqlCommand(sql1, con);
254 string tc = cmd1.ExecuteScalar().ToString();
255 // view diem10
256 string sql2 = " select 'cuoiky'=sum(DiemTk10*SoTC) " +
257 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
258 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
259 " group by MaSV ";
260 SqlCommand cmd2 = new SqlCommand(sql2, con);
261 string diem10 = cmd2.ExecuteScalar().ToString();
262 //view diem4
263 string sql3 = " select 'cuoiky'=sum(DiemTk4*SoTC) " +
264 " from KetQua kq,NhomHocPhan nhp,HocPhan hp,KeHoachGiangDay khdt " +
265 " where kq.MaNhomHP=nhp.MaNhomHP and nhp.MaHP=hp.MaHP and khdt.MaKHGD=nhp.MaKHGD and MaSV='" + MaSV + "'" +
266 " group by MaSV ";
267 SqlCommand cmd3 = new SqlCommand(sql3, con);
268 string diem4 = cmd3.ExecuteScalar().ToString();
269
270
271 string ketqua = "";
272 ketqua = Convert.ToDouble(diem10) / Convert.ToDouble(tc) + "," + Convert.ToDouble(diem4) / Convert.ToDouble(tc);
273 return ketqua;
274 }
File name: frmThi.cs
Copy
184 private void btPre_Click(object sender, EventArgs e)
185 {
186 iRows -= sodonghienlen;
187 getData(iRows);
188 if (i < 100 && i > 1)
189 {
190 i--;
191 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
192 }
193 else
194 return;
195 }
File name: frmThi.cs
Copy
197 private void btNext_Click(object sender, EventArgs e)
198 {
199 test();
200 getdapan();
201 iRows += sodonghienlen;
202 getData(iRows);
203 if (i < 1)
204 return;
205 else
206 {
207 //strsoluongcauhoi1 = frmluachon.strsoluongcauhoi;
208 i++;
209 if (int.Parse(strsoluongcauhoi1)< i)
210 {
211 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
212 if (MessageBox.Show("Bạn đã làm xong","Thông báo",MessageBoxButtons.OKCancel,MessageBoxIcon.Warning)== DialogResult.OK)
213 {
214
215 }
216 }
217 else
218 {
219 groupBox1.Text = " Nội dung câu hỏi " + i.ToString();
220 }
221 }
222 j = j + 1;
223 }
File name: frmThiThat.cs
Copy
135 void LoadCauHoiVaoControl()
136 {
137
138 try
139 {
140 groupBox1.Text = "Câu: " + (CauHienTai + 1).ToString();
141 lbCauHoi.Text = BangDeThi.Rows[CauHienTai][1].ToString();
142 lbA.Text = BangDeThi.Rows[CauHienTai][2].ToString();
143 lbB.Text = BangDeThi.Rows[CauHienTai][3].ToString();
144 lbC.Text = BangDeThi.Rows[CauHienTai][4].ToString();
145 lbD.Text = BangDeThi.Rows[CauHienTai][5].ToString();
146
147 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("A"))
148 checkBox1.Checked = true;
149 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("B"))
150 checkBox2.Checked = true;
151 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("C"))
152 checkBox3.Checked = true;
153 if (BangDeThi.Rows[CauHienTai][7].ToString().Contains("D"))
154 checkBox4.Checked = true;
155 }
156 catch (Exception ex)
157 { MessageBox.Show(ex.Message); }
158 }
File name: PhotonTransformViewEditor.cs
Copy
203 private void DrawHelpBox(ref Rect propertyRect, bool isOpen, float height, string helpText, string url)
204 {
205 if (isOpen == true)
206 {
207 Rect helpRect = new Rect(propertyRect.xMin, propertyRect.yMin, propertyRect.width, height - 5);
208 GUI.BeginGroup(helpRect, GUI.skin.box);
209 GUI.Label(new Rect(5, 5, propertyRect.width - 10, height - 30), helpText, PhotonGUI.RichLabel);
210 if (GUI.Button(new Rect(5, height - 30, propertyRect.width - 10, 20), "Read more in our documentation"))
211 {
212 Application.OpenURL(url);
213 }
214 GUI.EndGroup();
215
216 propertyRect.y += height;
217 }
218 }
File name: PhotonViewInspector.cs
Copy
21 public override void OnInspectorGUI()
22 {
23 #if UNITY_3_5
24 EditorGUIUtility.LookLikeInspector();
25 #endif
26 //EditorGUI.indentLevel = 1;
27
28 m_Target = (PhotonView)this.target;
29 bool isProjectPrefab = EditorUtility.IsPersistent(m_Target.gameObject);
30
31 if( m_Target.ObservedComponents == null )
32 {
33 m_Target.ObservedComponents = new System.Collections.Generic.List
34 }
35
36 if( m_Target.ObservedComponents.Count == 0 )
37 {
38 m_Target.ObservedComponents.Add( null );
39 }
40
41 EditorGUILayout.BeginHorizontal();
42 // Owner
43 if (isProjectPrefab)
44 {
45 EditorGUILayout.LabelField("Owner:", "Set at runtime");
46 }
47 else if (m_Target.isSceneView)
48 {
49 EditorGUILayout.LabelField("Owner", "Scene");
50 }
51 else
52 {
53 PhotonPlayer owner = m_Target.owner;
54 string ownerInfo = (owner != null) ? owner.name : "
55
56 if (string.IsNullOrEmpty(ownerInfo))
57 {
58 ownerInfo = "
59 }
60
61 EditorGUILayout.LabelField("Owner", "[" + m_Target.ownerId + "] " + ownerInfo);
62 }
63
64 // ownership requests
65 EditorGUI.BeginDisabledGroup(Application.isPlaying);
66 m_Target.ownershipTransfer = (OwnershipOption)EditorGUILayout.EnumPopup(m_Target.ownershipTransfer, GUILayout.Width(100));
67 EditorGUI.EndDisabledGroup();
68
69 EditorGUILayout.EndHorizontal();
70
71
72 // View ID
73 if (isProjectPrefab)
74 {
75 EditorGUILayout.LabelField("View ID", "Set at runtime");
76 }
77 else if (EditorApplication.isPlaying)
78 {
79 EditorGUILayout.LabelField("View ID", m_Target.viewID.ToString());
80 }
81 else
82 {
83 int idValue = EditorGUILayout.IntField("View ID [1.."+(PhotonNetwork.MAX_VIEW_IDS-1)+"]", m_Target.viewID);
84 m_Target.viewID = idValue;
85 }
86
87
88
89 // Locally Controlled
90 if (EditorApplication.isPlaying)
91 {
92 string masterClientHint = PhotonNetwork.isMasterClient ? "(master)" : "";
93 EditorGUILayout.Toggle("Controlled locally: " + masterClientHint, m_Target.isMine);
94 }
95
96
97
98 //DrawOldObservedItem();
99 ConvertOldObservedItemToObservedList();
100
101
102 // ViewSynchronization (reliability)
103 if (m_Target.synchronization == ViewSynchronization.Off)
104 {
105 GUI.color = Color.grey;
106 }
107
108 EditorGUILayout.PropertyField( serializedObject.FindProperty( "synchronization" ), new GUIContent( "Observe option:" ) );
109
110 if( m_Target.synchronization != ViewSynchronization.Off &&
111 m_Target.ObservedComponents.FindAll( item => item != null ).Count == 0 )
112 {
113 GUILayout.BeginVertical( GUI.skin.box );
114 GUILayout.Label( "Warning", EditorStyles.boldLabel );
115 GUILayout.Label( "Setting the synchronization option only makes sense if you observe something." );
116 GUILayout.EndVertical();
117 }
118
119 /*ViewSynchronization vsValue = (ViewSynchronization)EditorGUILayout.EnumPopup("Observe option:", m_Target.synchronization);
120 if (vsValue != m_Target.synchronization)
121 {
122 m_Target.synchronization = vsValue;
123 if (m_Target.synchronization != ViewSynchronization.Off && m_Target.observed == null)
124 {
125 EditorUtility.DisplayDialog("Warning", "Setting the synchronization option only makes sense if you observe something.", "OK, I will fix it.");
126 }
127 }*/
128
129 DrawSpecificTypeSerializationOptions();
130
131 GUI.color = Color.white;
132 DrawObservedComponentsList();
133
134 // Cleanup: save and fix look
135 if (GUI.changed)
136 {
137 EditorUtility.SetDirty(m_Target);
138 PhotonViewHandler.HierarchyChange(); // TODO: check if needed
139 }
140
141 GUI.color = Color.white;
142 EditorGUIUtility.LookLikeControls();
143 }
File name: LoadbalancingPeer.cs
Copy
433 public virtual bool OpChangeGroups(byte[] groupsToRemove, byte[] groupsToAdd)
434 {
435 if (this.DebugOut >= DebugLevel.ALL)
436 {
437 this.Listener.DebugReturn(DebugLevel.ALL, "OpChangeGroups()");
438 }
439
440 Dictionary
441 if (groupsToRemove != null)
442 {
443 opParameters[(byte)LiteOpKey.Remove] = groupsToRemove;
444 }
445 if (groupsToAdd != null)
446 {
447 opParameters[(byte)LiteOpKey.Add] = groupsToAdd;
448 }
449
450 return this.OpCustom((byte)LiteOpCode.ChangeGroups, opParameters, true, 0);
451 }
Download file with original file name:Group
Group 307 lượt xem
Gõ tìm kiếm nhanh...