private void button_New_Click(object sender, EventArgs e) { if (Tag.ToString() == "Empty" || Tag.ToString() == "Select") { Form_Mode("New"); Tag = "New"; } else if (Tag.ToString() == "New") { if (txt_Value.Text == "" || txt_Value.Text == "." || Convert.ToDecimal(txt_Value.Text) == 0) { MessageBox.Show("يجب إدخال المبلغ"); txt_Value.Focus(); return; } if (com_ACC_ID_From.SelectedValue == null) { MessageBox.Show("يجب تحديد الحساب"); com_ACC_Name_Form.Focus(); com_ACC_Name_Form.DroppedDown = true; return; } //insert into database var(); string t = Money_In.Insert(); txt_Bill_ID.Text = t.ToString(); Form_Mode("Select"); Tag = "Select"; // Insert Last Bill From DataBase To dt DataTable p1 = new DataTable(); p1 = G.Select_LastBill(txt_Bill_ID.Text, 14); foreach (DataRow r in p1.Rows) { Main.dt_Money_In.Rows.Add(r.ItemArray); } // Reset Cursor Position n = Main.dt_Money_In.Rows.Count - 1; dr_Money_In = Main.dt_Money_In.Rows[n]; Navigate(); // Jor if (btn_Jor_No.Text != "") { // Get Jor DataTable j = new DataTable(); j = G.Select_Jor(btn_Jor_No.Text); foreach (DataRow dr in j.Rows) { Main.dt_Jor.Rows.Add(dr.ItemArray); } // Get Jor_D DataTable j_d = new DataTable(); j_d = G.Select_Jor_D(btn_Jor_No.Text); foreach (DataRow dr in j_d.Rows) { Main.dt_Jor_D.Rows.Add(dr.ItemArray); } } } }
private void button_New_Click(object sender, EventArgs e) { if (Tag.ToString() == "Empty") { Tag = "New"; Form_Mode("New"); tree.Nodes.Add(""); tree.SelectedNode = tree.Nodes[tree.Nodes.Count - 1]; lbl_Level.Text = "المستوى : " + (tree.SelectedNode.Level + 1).ToString(); Color_Nodes(tree.SelectedNode, Color.Red); s = lbl_Path.Text; } else if (Tag.ToString() == "Select_Node") { Tag = "New"; Form_Mode("New"); tree.SelectedNode.Expand(); tree.SelectedNode.Nodes.Add(""); tree.SelectedNode = tree.SelectedNode.Nodes[tree.SelectedNode.Nodes.Count - 1]; lbl_Level.Text = "المستوى : " + (tree.SelectedNode.Level + 1).ToString(); Color_Nodes(tree.SelectedNode, Color.Red); s = lbl_Path.Text + " / "; } else if (Tag.ToString() == "New") { var(); string t = CC.Insert(); txt_CC_ID.Text = t; tree.SelectedNode.Tag = t; // Add CC From DataBase To dt DataTable p1 = new DataTable(); p1 = G.Select_LastBill(t, 17); foreach (DataRow r in p1.Rows) { Main.dt_CC.Rows.Add(r.ItemArray); } Tag = "Select_Node"; Form_Mode("Select_Node"); } }