private bool IsExists_Loop(string _Parent_Node, string _id) // 是否存在死循環 { SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@Pid", _Parent_Node), new SqlParameter("@Sub_id", _id) }; DataTable dtBom = clsApp.ExecuteProcedureReturnTable("usp_menu_isloop", paras); int records = dtBom.Rows.Count; if (records == 0) { return(false); } else { //從第一條記錄中取當前子節點 string id = dtBom.Rows[0]["id"].ToString(); //從最後一條記錄中取父節點 string parent_id = dtBom.Rows[records - 1]["parent_id"].ToString(); if (parent_id != id) { return(false); } else { string msgCustom = String.Format("设置的上级菜单节点有问题,将出现无限循环!\n\n 因已存在节点【{0}】-->子节点【{1}】.", dtBom.Rows[records - 1]["parent_id"], dtBom.Rows[records - 1]["id"]); MessageBox.Show(msgCustom, "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(true); } } }
private void BTNFIND_Click(object sender, EventArgs e) { if (txtpo_id1.Text == "" && txtpo_id2.Text == "" && dteorder_date1.Text == "" && dteorder_date2.Text == "" && txtvendor_id1.Text == "" && txtvendor_id2.Text == "" && txtdept_id1.Text == "" && txtdept_id2.Text == "" && txtgoods_id1.Text == "" && txtgoods_id2.Text == "" && txtgoods_name.Text == "" && txtvendor_name.Text == "" && txtmo_id.Text == "") { MessageBox.Show(clsCommon.GetTitle("t_msg_search_condition"), "System Information", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@po_id1", txtpo_id1.Text), new SqlParameter("@po_id2", txtpo_id2.Text), new SqlParameter("@vendor_id1", txtvendor_id1.Text), new SqlParameter("@vendor_id2", txtvendor_id2.Text), new SqlParameter("@vendor_name", txtvendor_name.Text), new SqlParameter("@order_date1", dteorder_date1.Text), new SqlParameter("@order_date2", dteorder_date2.Text), new SqlParameter("@goods_id1", txtgoods_id1.Text), new SqlParameter("@goods_id2", txtgoods_id2.Text), new SqlParameter("@goods_name", txtgoods_name.Text), new SqlParameter("@dept_id1", txtdept_id1.Text), new SqlParameter("@dept_id2", txtdept_id2.Text), new SqlParameter("@mo_id", txtmo_id.Text) }; dtPurchase = clsApp.ExecuteProcedureReturnTable("usp_temp_receipt_from_po", paras); gridControl1.DataSource = dtPurchase; }
/// <summary> /// 计算当前行的成本单价 /// </summary> void Set_cost_price() { dgvDetails.CloseEditor(); int cur_row = dgvDetails.FocusedRowHandle; float fltSec_qty = clsPub.Return_Float_Value(dgvDetails.GetRowCellDisplayText(cur_row, "sec_qty")); //刷新成本 if (lkeProvince.Text != "") { txtWeightCost.Text = dgvDetails.GetRowCellDisplayText(cur_row, "sec_qty"); Count_Cost_Price(lkeProvince.EditValue.ToString(), fltSec_qty); } string is_large; if (dgvDetails.GetRowCellValue(cur_row, "is_large").ToString() == "True") { is_large = "1"; } else { is_large = "0"; } SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@company_id", txtcompany_id.EditValue.ToString()), new SqlParameter("@serial_no", txtserial_no.Text), new SqlParameter("@is_large", is_large), new SqlParameter("@sec_qty", fltSec_qty) }; DataTable dt = new DataTable(); dt = clsApp.ExecuteProcedureReturnTable("usp_get_cost_price", paras); float fltResult; if (dt.Rows.Count > 0) { fltResult = clsPub.Return_Float_Value(dt.Rows[0]["cost_price"].ToString()); } else { fltResult = 0.00f; } dgvDetails.SetRowCellValue(cur_row, "amt_total", fltResult); }
private void Get_User_Data(string pNode_name, string pIs_group_id, string pPrent_node_id) { string cur_node_name = ""; if (pIs_group_id == "U") { //如為窗體節點(pis_group_id="U"),則取該節點父層節點下的所有窗體權限, //如為父層節點(pis_group_id="G"),pnode_name本身已是父層節點,不需重新賦值,也是取該節點父層節點下的所有窗體權限 cur_node_name = pPrent_node_id; } else { cur_node_name = pNode_name; } SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@language_id", lang_id), new SqlParameter("@user_id", user_group_id), new SqlParameter("@menu_id", cur_node_name), }; //找出父層菜單等于pPrent_node_id、且用戶名等于user_group_id的全部菜單出來 dtPopedom = clsApp.ExecuteProcedureReturnTable("usp_get_user_popedom", paras);//已有設置權限的列表 dgvDetails.DataSource = dtPopedom; Get_User_Date_Not_Exists(cur_node_name); //未有設置權限的列表 dtPopedom.DefaultView.Sort = "relatively_station ASC"; //排序 //dgvDetails.DataSource = dtPopedom; if (pIs_group_id == "U") { for (int i = 0; i < dgvDetails.RowCount; i++) { if (dgvDetails.Rows[i].Cells["menu_id"].Value.ToString() == pNode_name) { dgvDetails.Rows[i].Selected = true; //定位行 dgvDetails.CurrentCell = dgvDetails.Rows[i].Cells[1]; //設置當前焦點行 break; } } } }
private void frmMain_Left_Load(object sender, EventArgs e) { string _user_id = DBUtility._user_id; string strsql, within_code; if (_user_id.ToUpper() == "ADMIN") { //最高管理權限 within_code = ""; strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='{0}' and Isnull(A.menu_parent_id,'')='' and A.visible='1' and B.[language_id]='{1}' ORDER BY A.relatively_station", _user_id, lang_id); dtTopMenu = clsApp.GetDataTable(strsql); } else { //普通用戶此字段為非空 within_code = "0000"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@within_code", within_code), new SqlParameter("@user_id", _user_id), new SqlParameter("@language_id", lang_id) }; dtTopMenu = clsApp.ExecuteProcedureReturnTable("usp_get_user_menu", paras); } //取出ADMIN用戶(最高管理權限用戶)的菜單模板 strsql = string.Format( @"SELECT A.menu_id,A.menu_parent_id,A.window_id,A.relatively_station,B.[col_name] FROM sys_menu_window A INNER JOIN sys_dictionary B ON A.menu_id=B.col_code WHERE A.co_id='' and A.[language_id]=2 and A.user_id='ADMIN' and A.visible='1' and B.[language_id]='{0}' ORDER by A.relatively_station", lang_id); dtAllMenu = clsApp.GetDataTable(strsql); try { if (dtTopMenu.Rows.Count > 0) { InitMenu(); myTree.ExpandAll(); //展開 myTree.SelectedNode = myTree.Nodes[0]; //選中第上個節點 } else { MessageBox.Show("请首先添加好超级管理用户[ADMIN],并设置程序菜单!", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information); myTree.Nodes.Clear(); } } catch { myTree.Nodes.Clear(); } }
private bool IsExists_Loop(string _Parent_Node, string _id) // 是否存在死循環 { SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@Pid", _Parent_Node), new SqlParameter("@Sub_id", _id) }; DataTable dtBom = clsApp.ExecuteProcedureReturnTable("usp_brand_isloop", paras); int records = dtBom.Rows.Count; if (records == 0) { return(false); } else { //從第一條記錄中取當前子節點 string id = dtBom.Rows[0]["id"].ToString(); //從最後一條記錄中取父節點 string parent_id = dtBom.Rows[records - 1]["parent_id"].ToString(); if (parent_id != id) { return(false); } else { if (mLanguage == "2") { msgCustom = String.Format("There is a problem with the set parent node,an infinite loop will occur!\n\n Because the node already exists【{0}】-->Child node【{1}】.", dtBom.Rows[records - 1]["parent_id"], dtBom.Rows[records - 1]["id"]); } else { msgCustom = String.Format("設置的上級節點有問題,將出現無限循環!\n\n 因已存在節點【{0}】-->子節點【{1}】.", dtBom.Rows[records - 1]["parent_id"], dtBom.Rows[records - 1]["id"]); } MessageBox.Show(msgCustom, myMsg.msgTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(true); } } }
private void dgvList_SelectionChanged(object sender, EventArgs e) { if (dgvList.Rows.Count > 0) { SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@serial_no", dgvList.CurrentRow.Cells["serial_no"].Value.ToString()) }; DataTable dtBom = clsApp.ExecuteProcedureReturnTable("usp_bom_for_city", paras); dtBom2.Clear(); dtBom2 = dtBom.Copy(); if (dtBom.Rows.Count > 0) { lueLevel1.EditValue = ""; lueLevel2.EditValue = ""; lueLevel2.Properties.DataSource = null; lueLevel3.EditValue = ""; lueLevel3.Properties.DataSource = null; lueLevel4.EditValue = ""; lueLevel4.Properties.DataSource = null; lueLevel5.EditValue = ""; lueLevel5.Properties.DataSource = null; string strLevel = "", strSerial_no = ""; //for (int i = 0; i < dtBom.Rows.Count; i++) for (int i = dtBom.Rows.Count - 1; i >= 0; i--) { strLevel = dtBom.Rows[i]["levels"].ToString(); strSerial_no = dtBom.Rows[i]["serial_no"].ToString(); switch (strLevel) { case "5": //SetLevel5(strSerial_no, dtBom.Rows[i]["name"].ToString(), dtBom.Rows[i]["parent_id"].ToString()); lueLevel5.EditValue = strSerial_no; break; case "4": lueLevel4.EditValue = strSerial_no; SetLevels_By_Search(strSerial_no, lueLevel5); //SetLevel4(strSerial_no); break; case "3": lueLevel3.EditValue = strSerial_no; SetLevels_By_Search(strSerial_no, lueLevel4); break; case "2": lueLevel2.EditValue = strSerial_no; SetLevels_By_Search(strSerial_no, lueLevel3); break; case "1": lueLevel1.EditValue = strSerial_no; SetLevels_By_Search(strSerial_no, lueLevel2); break; default: break; } } } else { lueLevel1.EditValue = ""; lueLevel2.EditValue = ""; lueLevel2.Properties.DataSource = null; lueLevel3.EditValue = ""; lueLevel3.Properties.DataSource = null; lueLevel4.EditValue = ""; lueLevel4.Properties.DataSource = null; lueLevel5.EditValue = ""; lueLevel5.Properties.DataSource = null; } } }