private void FindFieldValue(string field, ControlCollection objControls, ref string value) { foreach (Control control in objControls) { if (control.ID == field) { if (control is MyTextBox) { MyTextBox box = (MyTextBox)control; if (box.MaxCharLength == 0) { value = box.Text; } else { value = box.TextCut(box.MaxCharLength); } } else if (control is MyXheditor) { MyXheditor xheditor = (MyXheditor)control; value = xheditor.Text; } else if (control is MyDropDownList) { MyDropDownList list = (MyDropDownList)control; value = list.SelectedValue; } else if (control is MyCheckBoxList) { MyCheckBoxList list2 = (MyCheckBoxList)control; value = list2.SelectValueString; } else if (control is MyRadioButtonList) { MyRadioButtonList list3 = (MyRadioButtonList)control; value = list3.SelectedValue; } else { if (!(control is CheckBox)) { throw new ArgumentException("未能识别" + field + "控制类型,请使用MyTextBox,MyDropDownList,MyCheckBoxList,MyRadioButtonList,CheckBox,MyXheditor的控件"); } CheckBox box2 = (CheckBox)control; value = box2.Checked.ToString(); } } if (control.HasControls()) { this.FindFieldValue(field, control.Controls, ref value); } } }
public bool CreateButton(DataAccessLibrary dal, MyCheckBoxList lst, string userID, string width, string height) { string tmpModuleID = lst.Items[0].Value.Substring(0, 3); // 0 1 2 3 4 5 6 7 8 9 10 11 string sql = @"insert into Manage_ButtonBar (ButtonID,ModuleID,OpenModuleID,BtnTitle,OpenPageViewID,FindPageViewID,BtnTypeID,DisOrder,AddUserid,URL,WebWidth,WebHeight,IsNeedSelect) values ({0},{1},{2},'{3}',{4},{5},{6},{7},{8},'{9}',{10},{11},{12})"; int i = 1; foreach (ListItem item in lst.Items) { string btnTitle = item.Text.Split('_')[1]; if (item.Selected) { //选择了,创建按钮 switch (item.Text.Split('_')[1]) { // 0 1 2 3 4 5 6 7 8 9 10 11 case "添加": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "04"), "0", "40" + i, i * 10, userID, "DataForm.htm", width, height, "0")); break; case "查看": case "修改": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "04"), "0", "40" + i, i * 10, userID, "DataForm.htm", width, height, "1")); break; case "删除": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "03"), "0", "40" + i, i * 10, userID, "/Data/DataDelete.ashx", 0, 0, "1")); break; case "查询": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "02"), "0", "40" + i, i * 10, userID, "", 0, 0, "0")); break; case "导出Excel": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, "0", "0", "40" + i, i * 10, userID, "", 0, 0, "0")); break; } } i++; } return(true); }
protected void MyCheckBoxList_SelectedIndexChanged(object sender, EventArgs e) { try { MyCheckBoxList.Visible = true; CheckBoxList list = new CheckBoxList(); list.Items.Add(new ListItem("Male", "1")); list.Items.Add(new ListItem("Female", "2")); MyCheckBoxList.DataSource = list; MyCheckBoxList.DataBind(); } catch (Exception ex) { throw; } }
public bool CreatePageView(DataAccessLibrary dal, MyCheckBoxList lstPageView, string tableID, string userID) { string moduleID = lstPageView.Items[0].Value.Substring(0, 3); // 0 1 2 3 4 5 6 7 8 9 string sql = @"insert into Manage_PageView (PVID,ModuleID,PVTypeID,PVTitle,DisOrder,AddUserid,TableID_DataSource,TableID_Modifly,PKColumnID,ColumnCount) values ({0},{1},{2},'{3}',{4},{5},{6},{7},{8},{9})"; var pvTypeIDs = new[] { "701", "702", "704", "703", "703" }; var pvTitles = new[] { "列表视图", "查询视图", "删除视图", "添加视图", "修改视图" }; int i = 1; foreach (ListItem item in lstPageView.Items) { if (item.Selected) { //选择了,创建视图 0 1 2 3 4 5 6 7 8 switch (item.Text.Split('_')[1]) { case "列表": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, tableID, "0", tableID + "010", 1)); CreatePageTurn(dal, item.Value, tableID); break; case "查询": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, "0", "0", "0", 3)); break; case "删除": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, "0", tableID, tableID + "010", 1)); break; case "表单/添加": case "修改": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, tableID, tableID, tableID + "010", 1)); break; } } i++; } return(true); }
public bool CreateButton(DataAccessLibrary dal, MyCheckBoxList lst,string userID,string width,string height) { string tmpModuleID = lst.Items[0].Value.Substring(0, 3); // 0 1 2 3 4 5 6 7 8 9 10 11 string sql = @"insert into Manage_ButtonBar (ButtonID,ModuleID,OpenModuleID,BtnTitle,OpenPageViewID,FindPageViewID,BtnTypeID,DisOrder,AddUserid,URL,WebWidth,WebHeight,IsNeedSelect) values ({0},{1},{2},'{3}',{4},{5},{6},{7},{8},'{9}',{10},{11},{12})"; int i = 1; foreach (ListItem item in lst.Items) { string btnTitle = item.Text.Split('_')[1]; if (item.Selected) { //选择了,创建按钮 switch (item.Text.Split('_')[1]) { // 0 1 2 3 4 5 6 7 8 9 10 11 case "添加": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "04"), "0", "40" + i, i * 10, userID, "DataForm.htm", width, height, "0")); break; case "查看": case "修改": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle,(tmpModuleID + "04"), "0", "40" + i, i * 10, userID, "DataForm.htm", width, height,"1")); break; case "删除": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "03"), "0", "40" + i, i * 10, userID, "/Data/DataDelete.ashx", 0, 0,"1")); break; case "查询": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, (tmpModuleID + "02"), "0", "40" + i, i * 10, userID, "", 0, 0, "0")); break; case "导出Excel": dal.ExecuteNonQuery(string.Format(sql, item.Value, tmpModuleID, tmpModuleID, btnTitle, "0", "0", "40" + i, i * 10, userID, "", 0, 0, "0")); break; } } i++; } return true; }
public bool CreatePageView(DataAccessLibrary dal, MyCheckBoxList lstPageView, string tableID, string userID) { string moduleID = lstPageView.Items[0].Value.Substring(0, 3); // 0 1 2 3 4 5 6 7 8 9 string sql = @"insert into Manage_PageView (PVID,ModuleID,PVTypeID,PVTitle,DisOrder,AddUserid,TableID_DataSource,TableID_Modifly,PKColumnID,ColumnCount) values ({0},{1},{2},'{3}',{4},{5},{6},{7},{8},{9})"; var pvTypeIDs = new[] { "701", "702", "704","703", "703" }; var pvTitles = new[] { "列表视图", "查询视图", "删除视图","添加视图", "修改视图" }; int i = 1; foreach (ListItem item in lstPageView.Items) { if (item.Selected) { //选择了,创建视图 0 1 2 3 4 5 6 7 8 switch (item.Text.Split('_')[1]) { case "列表": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, tableID, "0" , tableID + "010",1)); CreatePageTurn(dal, item.Value, tableID); break; case "查询": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, "0" ,"0" ,"0",3)); break; case "删除": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, "0" , tableID, tableID + "010",1)); break; case "表单/添加": case "修改": dal.ExecuteNonQuery(string.Format(sql, item.Value, moduleID, pvTypeIDs[i - 1], pvTitles[i - 1], i * 10, userID, tableID, tableID, tableID + "010",1)); break; } } i++; } return true; }