protected void CheckPowerFailWithWindowField(FineUI.Grid grid, string columnID) { FineUI.WindowField btn = grid.FindColumn(columnID) as FineUI.WindowField; btn.Hidden = true; btn.Enabled = false; btn.ToolTip = CHECK_POWER_FAIL_ACTION_MESSAGE; }
protected void CheckPowerWithWindowField(string powerName, FineUI.Grid grid, string columnID) { if (!CheckPower(powerName)) { CheckPowerFailWithWindowField(grid, columnID); } }
/// <summary> /// 商品查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODSearch_Click(object sender, EventArgs e) { conditionList = null; //conditionList = new List<ConditionFun.SqlqueryCondition>(); //绑定Grid表格 FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; V_Product01_PRCAREABll.GetInstence().BindGrid(Grid4, 0, 0, InquiryConditionProduct(), sortList); }
public void ButtonPRODSearch2_Click(Object sender, EventArgs e) { conditionList = null; //conditionList = new List<ConditionFun.SqlqueryCondition>(); //绑定Grid表格 FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; PRODUCT00Bll.GetInstence().BindGrid(Grid4, 0, 0, InquiryCondition(), sortList); }
/// <summary> /// 添加商品,采购单位未完成,价格取值未完成,税额未完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _TAKEIN_ID = tbxTAKEIN_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_TAKEIN_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("TAKEIN_ID01", _TAKEIN_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", model.Purchase_UNIT); deObject.Add("STD_CONVERT01", model.PROD_CONVERT1); deObject.Add("STD_QUAN01", model.Purchase_QUAN); deObject.Add("STD_PRICE01", model.COST); deObject.Add("Tax01", 0); deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("Item_DISC_Amt01", 0); deObject.Add("MEMO", ""); deObject.Add("BAT_NO", ""); //var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); //string lgname = OlUser.Manager_LoginName; //deObject.Add("CRT_USER_ID1", lgname); //deObject.Add("CRT_DATETIME1", DateTime.Now.ToString()); //deObject.Add("MOD_USER_ID1", OlUser.Manager_LoginName); //deObject.Add("MOD_DATETIME1", DateTime.Now.ToString()); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 更新排序 /// </summary> /// <param name="page">当前页面指针</param> /// <param name="Grid1">页面表格</param> /// <param name="tbxSortId">表格中绑定排序的表单名</param> /// <param name="tableName">表名</param> /// <param name="sortIdName">排序字段名</param> /// <param name="pkName">主键字段名</param> /// <returns>更新成功返回true,失败返回false</returns> public static bool UpdateSort(Page page, FineUI.Grid Grid1, string tbxSortId, string tableName, string sortIdName, string pkName) { try { //如果不存在记录则不操作 if (Grid1.Rows.Count <= 0) { return(false); } //获取记录数量 int count = Grid1.Rows.Count; var strArray = new string[Grid1.Rows.Count]; int j = 0; //遍历所有记录 for (int i = 0; i < count; i++) { //读取一行 GridRow row = Grid1.Rows[i]; //获取主键Id值 int k = ConvertHelper.Cint0(row.DataKeys[0].ToString()); if (k > 0) { //读取当前行排序值 var tbx = (System.Web.UI.WebControls.TextBox)row.FindControl(tbxSortId); //如果排序值不为空 if (tbx.Text.Trim() != "") { //将排序值转为数值 int sortId = ConvertHelper.Cint1(tbx.Text); //拼接SQL语句 strArray[j] = string.Format("update {0} set {1}={2} where {3}={4};", tableName, sortIdName, sortId, pkName, k); j++; } } } //------------------------------------------------ if (j >= 1) { UpdateHelper update = new UpdateHelper(); update.Update(strArray); return(true); } return(false); } catch (Exception ex) { //出现异常,保存出错日志信息 WriteLog("更新排序值失败", ex); return(false); } }
// 排序后分页 protected IQueryable <T> SortAndPage <T>(IQueryable <T> q, FineUI.Grid grid) { if (grid.PageIndex >= grid.PageCount && grid.PageCount >= 1) { grid.PageIndex = grid.PageCount - 1; } return(Sort(q, grid).Skip(grid.PageIndex * grid.PageSize).Take(grid.PageSize)); }
/// <summary> /// 添加商品,采购单位未完成,价格取值未完成,税额未完成 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _tbxPREPAR_ID = tbxPREPAR_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_tbxPREPAR_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("PREPARE_ID01", _tbxPREPAR_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", 0); deObject.Add("STD_CONVERT01", 0); deObject.Add("STD_QUAN01", 0); deObject.Add("STD_PRICE01", 0); deObject.Add("COST01", ""); deObject.Add("sProd_ID01", ""); deObject.Add("BAT_NO01", ""); deObject.Add("IsScales01", 0); deObject.Add("IsFlag01", 0); deObject.Add("Scales_User01", ""); deObject.Add("Scale_Date01", DateTime.Now.ToString()); deObject.Add("MEMO01", ""); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 获取当前页面上所有的权限按钮 /// </summary> private void CheckPowerEdit(ControlCollection controls) { for (int i = 0; i < controls.Count; i++) { ControlBase ctrl = controls[i] as ControlBase; if (ctrl == null) { continue; } if (ctrl is FineUI.Grid) { #region Grid的权限控制 FineUI.Grid grid = ctrl as FineUI.Grid; foreach (GridColumn column in grid.Columns) { if (!controlList.Contains(column.ColumnID)) { continue; } Modules.SYS_PageAuthority auth = SessionAuthorityList.Where(a => a.MenuID == currentMenu.ID && a.ControlID == column.ColumnID).FirstOrDefault(); if (auth == null) { if (column is LinkButtonField) { LinkButtonField c = (LinkButtonField)column; c.Enabled = false; c.ToolTip = Resources.Resource.CHECK_POWER_FAIL_ACTION_MESSAGE; } else if (column is WindowField) { WindowField c = (WindowField)column; c.Enabled = false; c.ToolTip = Resources.Resource.CHECK_POWER_FAIL_ACTION_MESSAGE; } } } #endregion } else { #region 其他控件的权限控制 if (controlList.Contains(ctrl.ID) && !IsPostBack) { Modules.SYS_PageAuthority auth = SessionAuthorityList.Where(a => a.MenuID == currentMenu.ID && a.ControlID == ctrl.ID).FirstOrDefault(); if (auth == null) { ctrl.Enabled = false; } } CheckPowerEdit(ctrl.Controls); #endregion } } }
protected void ButtonOrderAdd_Click(Object sender, EventArgs e) { FineUI.Grid Grid4 = Window4.FindControl("PanelGrid5").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; //tbxRELATE_ID.Text = Grid4.DataKeys[0][0].ToString(); DataTable Inda = SPs.IN_Purchase00_TAKEIN11(Grid4.DataKeys[selections[0]][0].ToString(), tbxTAKEIN_ID.Text, ddlSHOP_NAME.SelectedValue).ExecuteDataTable(); Grid2.DataSource = Inda; Grid2.DataBind(); Toolbar21111.Enabled = false; }
private string GetGridTableHtml(FineUI.Grid grid) { StringBuilder sb = new StringBuilder(); sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>"); sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">"); sb.Append("<tr>"); foreach (GridColumn column in grid.Columns) { sb.AppendFormat("<td>{0}</td>", column.HeaderText); } sb.Append("</tr>"); foreach (GridRow row in grid.Rows) { sb.Append("<tr>"); foreach (object value in row.Values) { string html = value.ToString(); if (html.StartsWith(FineUI.Grid.TEMPLATE_PLACEHOLDER_PREFIX)) { // 模板列 string templateID = html.Substring(FineUI.Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length); Control templateCtrl = row.FindControl(templateID); html = GetRenderedHtmlSource(templateCtrl); } else { // 处理CheckBox if (html.Contains("f-grid-static-checkbox")) { if (html.Contains("uncheck")) { html = "×"; } else { html = "√"; } } // 处理图片 if (html.Contains("<img")) { string prefix = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, ""); html = html.Replace("src=\"", "src=\"" + prefix); } } sb.AppendFormat("<td>{0}</td>", html); } sb.Append("</tr>"); } sb.Append("</table>"); return(sb.ToString()); }
// 根据权限设置网格列状态 // Common.SetGridColumnByPower("CoreDeptEdit", Grid1, "editField"); // Common.SetGridColumnByPower("CoreDeptDelete", Grid1, "deleteField"); public static void SetGridColumnByPower(FineUI.Grid grid, string columnID, PowerType power) { if (!Common.CheckPower(power)) { BaseField field = grid.FindColumn(columnID) as BaseField; field.ToolTip = Common.CHECK_POWER_FAIL_ACTION_MESSAGE; field.Hidden = true; // 整个列都隐藏 //field.Enabled = false; // 按钮不能点 //field.Visible = false; // BUG: 加上该语句页面就无法显示 } }
/// <summary> /// 添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _INV_ID = tbxINV_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; if (!String.IsNullOrEmpty(_INV_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _prod_name = Grid4.DataKeys[i][1].ToString(); string checkresult = ProdAddCheck(_Prod_ID, _prod_name); if (!String.IsNullOrEmpty(checkresult)) { result = result + "\r\n" + checkresult; continue; } string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME101", _Shop_Name); deObject.Add("INV_ID01", _INV_ID); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("QUANTITY01", model.SAFE_QUAN); deObject.Add("QUAN01", 0); deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("QUAN_B01", 0); deObject.Add("MEMO01", 0); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 子表添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void btn_DetailAdd(Object sender, EventArgs e) { //string Pur_status = ddlStatus.SelectedValue; FineUI.Panel P_search = Window3.FindControl("PanelGrid4").FindControl("Panel_Search") as FineUI.Panel; P_search.Hidden = false; FineUI.DropDownList ddlstock = Window3.FindControl("PanelGrid4").FindControl("Panel_Search").FindControl("window_ddl_Stock") as FineUI.DropDownList; STOCKBll.GetInstence().BandDropDownListStock(this, ddlstock); Window3.Hidden = false; FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; Grid4.DataSource = null; Grid4.DataBind(); }
protected void ButtonOrderAdd_Click(Object sender, EventArgs e) { FineUI.Grid Grid4 = Window4.FindControl("PanelGrid5").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; tbxRELATE_ID.Text = Grid4.DataKeys[0][0].ToString(); foreach (int i in selections) { List <ConditionFun.SqlqueryCondition> order00con = new List <ConditionFun.SqlqueryCondition>(); order00con.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, OUT_BACK01Table.BK_ID, Comparison.Equals, Grid4.DataKeys[i][0].ToString(), false, false)); List <string> colList = new List <string>(); colList.Add("SHOP_ID"); colList.Add("PROD_ID"); colList.Add("QUANTITY"); colList.Add("STD_UNIT"); colList.Add("STD_CONVERT"); colList.Add("STD_QUAN"); colList.Add("STD_PRICE"); //colList.Add("COST_PRICE"); //colList.Add("");预留采购单位类别 DataTable da = OUT_BACK01Bll.GetInstence().GetDataTable(false, 0, colList, 0, 0, order00con, null); foreach (DataRow dr in da.Rows) { string _shopid = dr["SHOP_ID"].ToString(); string _PROD_ID = dr["PROD_ID"].ToString(); var model = new SHOP00(x => x.SHOP_ID == _shopid); var model2 = new PRODUCT00(x => x.PROD_ID == _PROD_ID); int rowCount = Grid2.Rows.Count; JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", dr["SHOP_ID"].ToString()); deObject.Add("SHOP_NAME01", model.SHOP_NAME1); deObject.Add("IB_ID01", tbxIB_ID.Text); deObject.Add("SNo01", rowCount + 1); deObject.Add("PROD_ID01", dr["PROD_ID"].ToString()); deObject.Add("PROD_NAME01", model2.PROD_NAME1); deObject.Add("QUANTITY01", dr["QUANTITY"].ToString()); deObject.Add("STD_TYPE01", dr["STD_UNIT"].ToString()); deObject.Add("STD_UNIT01", dr["STD_UNIT"].ToString()); deObject.Add("STD_CONVERT01", dr["STD_CONVERT"].ToString()); deObject.Add("STD_QUAN01", dr["STD_QUAN"].ToString()); deObject.Add("STD_PRICE01", dr["STD_PRICE"].ToString()); deObject.Add("COST01", dr["STD_PRICE"].ToString()); deObject.Add("QUAN101", dr["STD_QUAN"].ToString()); deObject.Add("QUAN201", dr["STD_QUAN"].ToString()); deObject.Add("MEMO01", ""); deObject.Add("BAT_NO", ""); Grid2.AddNewRecord(deObject, true); } } }
//翻页 protected void grid_PageIndexChange(object sender, GridPageEventArgs e) { FineUI.Grid grid = (FineUI.Grid)sender; if (grid.ID == "gridBOMParent") { gridBOMParent.PageIndex = e.NewPageIndex; this.BindGrid(); } if (grid.ID == "gridBOMSub") { gridBOMSub.PageIndex = e.NewPageIndex; string materialNO = gridBOMParent.Rows[gridBOMParent.SelectedRowIndex].Values[1].ToString(); this.BindGridSub(materialNO); } }
protected void grid_PageIndexChange(object sender, FineUI.GridPageEventArgs e) { FineUI.Grid grid = (FineUI.Grid)sender; if (grid.ID == "gridMPS") { gridMPS.PageIndex = e.NewPageIndex; this.BindGridMPS(); } if (grid.ID == "gridMRP") { gridMRP.PageIndex = e.NewPageIndex; string referenceID = gridMPS.DataKeys[gridMPS.SelectedRowIndex][0].ToString(); this.BindGridMRP(referenceID); } }
/// <summary> /// 新增按钮触发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void btn_Pur02Add(Object sender, EventArgs e) { string Pur_status = ddlStatus.SelectedValue; FineUI.Panel P_search = Window3.FindControl("PanelGrid4").FindControl("Panel_Search") as FineUI.Panel; P_search.Hidden = false; FineUI.Button B_BtnSearchCon = Window3.FindControl("PanelGrid4").FindControl("tool_btn").FindControl("BtnSearchCon") as FineUI.Button; FineUI.Button B_BtnAddCon = Window3.FindControl("PanelGrid4").FindControl("tool_btn").FindControl("BtnAddCon") as FineUI.Button; B_BtnSearchCon.Hidden = false; B_BtnAddCon.Hidden = false; Window3.Hidden = false; FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; Grid4.DataSource = null; Grid4.DataBind(); }
//翻页 protected void grid_PageIndexChange(object sender, GridPageEventArgs e) { FineUI.Grid grid = (FineUI.Grid)sender; if (grid.ID == "gridRouting") { gridRouting.PageIndex = e.NewPageIndex; this.BindGrid(); } else { gridRoutingSub.PageIndex = e.NewPageIndex; string id = gridRouting.DataKeys[gridRouting.SelectedRowIndex][0].ToString(); this.BindGridSub(id); } }
/// <summary> /// 选中的行 /// </summary> /// <param name="grid"></param> /// <returns></returns> protected string HowManyRowsAreSelected(Grid grid) { StringBuilder sb = new StringBuilder(); int selectedCount = grid.SelectedRowIndexArray.Length; if (selectedCount > 0) { sb.AppendFormat("共选中了 {0} 行:", selectedCount); sb.Append("<table class=\"result\">"); sb.Append("<tr><th>行号</th>"); foreach (string datakey in grid.DataKeyNames) { sb.AppendFormat("<th>{0}</th>", datakey); } sb.Append("</tr>"); for (int i = 0; i < selectedCount; i++) { int rowIndex = grid.SelectedRowIndexArray[i]; sb.Append("<tr>"); sb.AppendFormat("<td>{0}</td>", rowIndex + 1); // 如果是内存分页,所有分页的数据都存在,rowIndex 就是在全部数据中的顺序,而不是当前页的顺序 if (grid.AllowPaging && !grid.IsDatabasePaging) { rowIndex = grid.PageIndex * grid.PageSize + rowIndex; } object[] dataKeys = grid.DataKeys[rowIndex]; for (int j = 0; j < dataKeys.Length; j++) { sb.AppendFormat("<td>{0}</td>", dataKeys[j]); } sb.Append("</tr>"); } sb.Append("</table>"); } else { sb.Append("<strong>没有选中任何一行!</strong>"); } return sb.ToString(); }
//排序 protected void grid_Sort(object sender, GridSortEventArgs e) { FineUI.Grid grid = (FineUI.Grid)sender; if (grid.ID == "gridRouting") { gridRouting.SortDirection = e.SortDirection; gridRouting.SortField = e.SortField; BindGrid(); } if (grid.ID == "gridRoutingSub") { gridRoutingSub.SortDirection = e.SortDirection; gridRoutingSub.SortField = e.SortField; string id = gridRouting.DataKeys[gridRouting.SelectedRowIndex][0].ToString(); this.BindGridSub(id); } }
//排序 protected void grid_Sort(object sender, GridSortEventArgs e) { FineUI.Grid grid = (FineUI.Grid)sender; if (grid.ID == "gridBOMParent") { gridBOMParent.SortDirection = e.SortDirection; gridBOMParent.SortField = e.SortField; BindGrid(); } if (grid.ID == "gridBOMSub") { gridBOMSub.SortDirection = e.SortDirection; gridBOMSub.SortField = e.SortField; string materialNO = gridBOMParent.Rows[gridBOMParent.SelectedRowIndex].Values[1].ToString(); this.BindGridSub(materialNO); } }
protected void Grid2AddNewRow_Click(object sender, EventArgs e) { FineUI.Grid Grid3 = Window2.FindControl("PanelA").FindControl("Grid3") as FineUI.Grid; int[] selections = Grid3.SelectedRowIndexArray; string _ORDDEP_ID = hidORDDEP_ID.Text.ToString(); string result = ""; if (!String.IsNullOrEmpty(_ORDDEP_ID)) { foreach (int i in selections) { int _Id = ConvertHelper.Cint(Grid3.DataKeys[i][0].ToString()); var model = new PROD_DEP(x => x.Id == _Id); string checkResult = CheckDataAddDep(model.DEP_ID); if (!String.IsNullOrEmpty(checkResult)) { result = result + checkResult + Environment.NewLine; continue; } JObject deObject = new JObject(); deObject.Add("Id1", "0"); deObject.Add("ORDDEP_ID1", _ORDDEP_ID); deObject.Add("DEP_ID1", model.DEP_ID); deObject.Add("DEP_NAME1", model.DEP_NAME); deObject.Add("Meno", " "); deObject.Add("USABLE1", true); var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString()); string lgname = OlUser.Manager_LoginName; deObject.Add("CRT_USER_ID1", lgname); deObject.Add("CRT_DATETIME1", DateTime.Now.ToString()); deObject.Add("MOD_USER_ID1", OlUser.Manager_LoginName); deObject.Add("MOD_DATETIME1", DateTime.Now.ToString()); Grid2.AddNewRecord(deObject, true); } } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
/// <summary> /// 商品查询 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODSearch_Click(object sender, EventArgs e) { string _shop_id = ddlSHOP_NAME.SelectedValue; string _stock_id = ddlSTOCK_ID.SelectedValue; if (String.IsNullOrEmpty(_shop_id)) { FineUI.Alert.ShowInParent("到货商店未选择", FineUI.MessageBoxIcon.Information); return; } if (String.IsNullOrEmpty(_stock_id)) { FineUI.Alert.ShowInParent("仓库未选择", FineUI.MessageBoxIcon.Information); return; } conditionList = null; //conditionList = new List<ConditionFun.SqlqueryCondition>(); //绑定Grid表格 FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; V_STOCK01_PRODUCT01Bll.GetInstence().BindGrid(Grid4, 0, 0, InquiryConditionProduct(), sortList); }
/// <summary> /// 初始化Grid(自动添加列,自动列宽) /// </summary> public void InitializeGrid(FUI.Grid grid, string[] columns, int[] widths) { List <string> list = new List <string>(); int cnt = grid.Columns.Count; // 动态添加列 for (int i = 0; i < columns.Length; i++) { string title = columns[i]; FUI.BoundField bf = new FUI.BoundField(); bf.DataField = title; bf.HeaderText = title; bf.DataFormatString = "{0}"; bf.Width = new Unit(widths[i]); Grid1.Columns.Add(bf); list.Add(columns[i]); } // 添加导入备注列 FUI.BoundField bz = new FUI.BoundField(); bz.DataField = BzName; bz.HeaderText = BzName; bz.DataFormatString = "{0}"; bz.MinWidth = new Unit(300); bz.ExpandUnusedSpace = true; bz.DataToolTipField = BzName; bz.DataToolTipFormatString = "{0}"; Grid1.Columns.Add(bz); //Ext.TemplateField bz = new Ext.TemplateField(); //bz.ItemTemplate = new Ext.GridRowControl(..TemplateField . = n.DataField = "导入备注"; //bz.HeaderText = "导入备注"; //columnTitles[i]; //bz.DataFormatString = "<span style='color:red'>{0}</span>"; //bz.Width = new Unit(300); //Grid1.Columns.Add(bz); Grid1.DataKeyNames = list.ToArray(); }
/// <summary> /// 获取表格选中项DataKeys的第一个值,并转化为整型列表 /// </summary> /// <param name="grid"></param> /// <returns></returns> protected List<int> GetSelectedDataKeyIDs(Grid grid) { List<int> ids = new List<int>(); foreach (int rowIndex in grid.SelectedRowIndexArray) { ids.Add(Convert.ToInt32(grid.DataKeys[rowIndex][0])); } return ids; }
// 根据权限设置多选列的显隐 public static void SetGridCheckColumnByPower(FineUI.Grid grid, PowerType power) { grid.EnableCheckBoxSelect = Common.CheckPower(power); }
/* Response.Clear(); Response.Buffer = true; Response.Charset = "GB2312"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312"); Response.AddHeader("content-disposition", String.Format("attachment; filename={0}.xls",System.DateTime.Now.ToString("MMddHHmmss"))); Response.ContentType = "application/vnd.ms-excel"; Response.Write(App_Com.Helper.GetGridTableHtml(Grid1)); Response.End(); */ public static string GetGridTableHtml(Grid grid) { StringBuilder sb = new StringBuilder(); sb.Append("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset=UTF-8\"/>"); sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">"); sb.Append("<tr>"); foreach (GridColumn column in grid.Columns) { if (!column.Hidden) sb.AppendFormat("<td>{0}</td>", column.HeaderText); } sb.Append("</tr>"); foreach (GridRow row in grid.Rows) { sb.Append("<tr>"); foreach (GridColumn column in grid.Columns) { if (!column.Hidden) { string html = row.Values[column.ColumnIndex].ToString(); // 处理CheckBox if (html.Contains("box-grid-static-checkbox")) { if (html.Contains("box-grid-static-checkbox-uncheck")) { html = "×"; } else { html = "√"; } } // 处理图片 if (html.ToLower().Contains("<img")) { string prefix = HttpContext.Current.Request.Url.AbsoluteUri.Replace(HttpContext.Current.Request.Url.AbsolutePath, ""); if (html.ToLower().Contains("../")) { html = html.Replace("../", ""); prefix = prefix + "/"; } html = html.Replace("src=\"", "src=\"" + prefix); } if (html.ToLower().StartsWith("<a") && html.ToLower().EndsWith("</a>")) { sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@'>{0}</td>", html.Substring(html.IndexOf("\">") + 2).Replace("</a>", "")); continue; } if (html.ToLower().Contains("class=_csiscolor") && html.ToUpper().Contains("BACKGROUND-COLOR:")) { sb.AppendFormat("<td style=\"BACKGROUND-COLOR:{0};\"> </td>", html.Substring(html.ToUpper().LastIndexOf("BACKGROUND-COLOR:") + 17, 8)); continue; } if (column.TextAlign == FineUI.TextAlign.Right) sb.AppendFormat("<td>{0}</td>", html); else sb.AppendFormat("<td style='vnd.ms-excel.numberformat:@'>{0}</td>", html); } } sb.Append("</tr>"); } sb.Append("</table>"); return sb.ToString(); }
protected void ButtonOrderSearch_Click(Object sender, EventArgs e) { FineUI.Grid grid4 = Window4.FindControl("PanelGrid5").FindControl("Grid4") as FineUI.Grid; OUT_BACK00Bll.GetInstence().BindGrid(grid4, 0, 0, OrderCondition(), null); }
/// <summary> /// 获取选中角色的ID /// 修改人:金协民 2015年7月29日 /// </summary> /// <param name="grid"></param> /// <returns></returns> public string GetSelectedDataKeyID(Grid grid) { var id = string.Empty; int rowIndex = grid.SelectedRowIndex; if (rowIndex >= 0) { id = grid.DataKeys[rowIndex][0].ToString(); } return id; }
private void ResolveEnableStatusButtonForGrid(MenuButton btn, Grid grid, bool enabled) { string enabledStr = "启用"; if (!enabled) { enabledStr = "禁用"; } btn.OnClientClick = grid.GetNoSelectionAlertInParentReference("请至少应该选择一项记录!"); btn.ConfirmText = String.Format("确定要{1}选中的<span class=\"highlight\"><script>{0}</script></span>项记录吗?", grid.GetSelectedCountReference(), enabledStr); btn.ConfirmTarget = FineUI.Target.Top; }
/// <summary> /// 跨页保持选中项 - 根据隐藏字段的数据更新表格当前页面的选中行 /// </summary> /// <param name="hfSelectedIDS"></param> /// <param name="grid"></param> public void UpdateSelectedRowIndexArray(FineUI.HiddenField hfSelectedIDS, Grid grid) { List<int> ids = GetSelectedIDsFromHiddenField(hfSelectedIDS); List<int> nextSelectedRowIndexArray = new List<int>(); if (grid.IsDatabasePaging) { for (int i = 0, count = Math.Min(grid.PageSize, (grid.RecordCount - grid.PageIndex * grid.PageSize)); i < count; i++) { int id = Convert.ToInt32(grid.DataKeys[i][0]); if (ids.Contains(id)) { nextSelectedRowIndexArray.Add(i); } } } else { int nextStartPageIndex = grid.PageIndex * grid.PageSize; for (int i = nextStartPageIndex, count = Math.Min(nextStartPageIndex + grid.PageSize, grid.RecordCount); i < count; i++) { int id = Convert.ToInt32(grid.DataKeys[i][0]); if (ids.Contains(id)) { nextSelectedRowIndexArray.Add(i - nextStartPageIndex); } } } grid.SelectedRowIndexArray = nextSelectedRowIndexArray.ToArray(); }
protected string GetSelectedDataKey(Grid grid, int dataIndex) { string data = String.Empty; int rowIndex = grid.SelectedRowIndex; if (rowIndex >= 0) { data = grid.DataKeys[rowIndex][dataIndex].ToString(); } return data; }
private string GetGridTableHtml(Grid grid) { StringBuilder sb = new StringBuilder(); sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">"); sb.Append("<tr>"); foreach (GridColumn column in grid.Columns) { sb.AppendFormat("<td>{0}</td>", column.HeaderText); } sb.Append("</tr>"); //DataTable dtTemp = (DataTable)Grid1.DataSource; //DataSet ds = m_bllCK_Payment.GetList(""); //Grid1.DataSource = ds.Tables[0]; //Grid1.DataBind(); foreach (GridRow row in grid.Rows) { sb.Append("<tr>"); foreach (object value in row.Values) { string html = value.ToString(); if (html.StartsWith(Grid.TEMPLATE_PLACEHOLDER_PREFIX)) { // 模板列 string templateID = html.Substring(Grid.TEMPLATE_PLACEHOLDER_PREFIX.Length); Control templateCtrl = row.FindControl(templateID); html = GetRenderedHtmlSource(templateCtrl); } else { // 处理CheckBox if (html.Contains("box-grid-static-checkbox")) { if (html.Contains("uncheck")) { html = "×"; } else { html = "√"; } } // 处理图片 if (html.Contains("<img")) { string prefix = Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, ""); html = html.Replace("src=\"", "src=\"" + prefix); } } sb.AppendFormat("<td>{0}</td>", html); } sb.Append("</tr>"); } sb.Append("</table>"); //Grid1.DataSource = dtTemp; //Grid1.DataBind(); return sb.ToString(); }
protected int GetSelectedDataKeyID(Grid grid) { int id = -1; int rowIndex = grid.SelectedRowIndex; if (rowIndex >= 0) { id = Convert.ToInt32(grid.DataKeys[rowIndex][0]); } return id; }
/// <summary> /// 添加商品 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ButtonPRODAdd_Click(object sender, EventArgs e) { FineUI.Grid Grid4 = Window3.FindControl("PanelGrid4").FindControl("Grid4") as FineUI.Grid; int[] selections = Grid4.SelectedRowIndexArray; string _Pur00_ID = hidPurchase_ID.Text; string _Shop_ID = ddlSHOP_NAME.SelectedValue; string _Shop_Name = ddlSHOP_NAME.SelectedText; string result = ""; var m_Shop = new SHOP00(x => x.SHOP_ID == _Shop_ID); string _priceArea_id = m_Shop.SHOP_Price_Area; int rowCount = Grid2.Rows.Count; if (!String.IsNullOrEmpty(_Pur00_ID)) { foreach (int i in selections) { string _Prod_ID = Grid4.DataKeys[i][0].ToString(); string _prod_name = Grid4.DataKeys[i][1].ToString(); string checkresult = ProdAddCheck(_Prod_ID, _prod_name); if (!String.IsNullOrEmpty(checkresult)) { result = result + "\r\n" + checkresult; continue; } string _shop_id = ddlSHOP_NAME.SelectedValue; var model = new V_Product01_PRCAREA(x => x.PROD_ID == _Prod_ID && x.PRCAREA_ID == _priceArea_id); JObject deObject = new JObject(); deObject.Add("Id01", "0"); deObject.Add("SHOP_ID01", _Shop_ID); deObject.Add("SHOP_NAME01", _Shop_Name); deObject.Add("Purchase_ID01", _Pur00_ID); rowCount = rowCount + 1; deObject.Add("SNo01", rowCount); deObject.Add("PROD_ID01", _Prod_ID); deObject.Add("PROD_NAME01", model.PROD_NAME1); deObject.Add("PROD_NAME02", model.PROD_NAME1); deObject.Add("QUANTITY01", model.ORDER_QUAN); deObject.Add("STD_UNIT01", model.Purchase_UNIT); deObject.Add("STD_UNIT_NAME01", model.Purchase_UNIT_NAME); deObject.Add("STD_CONVERT01", model.Purchase_CONVERT); deObject.Add("STD_QUAN01", model.Purchase_QUAN); deObject.Add("STD_PRICE01", model.Purchase_PRICE); if (model.TAX_TYPE == '0') { deObject.Add("Tax01", 0); } else { deObject.Add("Tax01", ConvertHelper.Cdbl((model.Purchase_PRICE.ToString())) * ConvertHelper.Cdbl((model.Purchase_QUAN.ToString())) * ConvertHelper.Cdbl((model.Tax.ToString())) * 0.01); } deObject.Add("QUAN101", 0); deObject.Add("QUAN201", 0); deObject.Add("Item_DISC_Amt01", 0); deObject.Add("MEMO", ""); deObject.Add("UNIT_NAME01", model.UNIT_NAME); deObject.Add("UNIT_NAME101", model.UNIT_NAME1); deObject.Add("UNIT_NAME201", model.UNIT_NAME2); deObject.Add("PROD_CONVERT101", model.PROD_CONVERT1); deObject.Add("PROD_CONVERT201", model.PROD_CONVERT2); deObject.Add("SUP_COST01", model.SUP_COST); deObject.Add("SUP_COST101", model.SUP_COST1); deObject.Add("SUP_COST201", model.SUP_COST2); deObject.Add("Tax_Num01", model.Tax); deObject.Add("Tax_Type01", model.TAX_TYPE); Grid2.AddNewRecord(deObject, true); } } else { FineUI.Alert.ShowInParent("未选中订单无法添加", FineUI.MessageBoxIcon.Information); } if (!String.IsNullOrEmpty(result.Trim())) { FineUI.Alert.ShowInParent(result, FineUI.MessageBoxIcon.Information); } }
public abstract void BindGrid(FineUI.Grid grid, int parentValue, List <ConditionFun.SqlqueryCondition> wheres = null, List <string> orders = null, string parentId = "ParentId");
/// <summary> /// ���캯�� /// </summary> /// <param name="grid">���ʵ��</param> /// <param name="dataItem">�ж�Ӧ������Դ���ڻط�ʱΪnull��</param> /// <param name="rowIndex">�����</param> public GridRow(Grid grid, object dataItem, int rowIndex) { _grid = grid; _dataItem = dataItem; _rowIndex = rowIndex; }
protected void ResolveDeleteButtonForGrid(FineUI.Button btn, Grid grid, string noSelectionMessage, string confirmTemplate) { // 点击删除按钮时,至少选中一项 btn.OnClientClick = grid.GetNoSelectionAlertInParentReference(noSelectionMessage); btn.ConfirmText = String.Format(confirmTemplate, " <span class=\"highlight\"><script>" + grid.GetSelectedCountReference() + "</script></span> "); btn.ConfirmTarget = Target.Top; }
/// <summary> /// 跨页保持选中项 - 将表格当前页面选中行对应的数据同步到隐藏字段中 /// </summary> /// <param name="hfSelectedIDS"></param> /// <param name="grid"></param> public void SyncSelectedRowIndexArrayToHiddenField(FineUI.HiddenField hfSelectedIDS, Grid grid) { List<int> ids = GetSelectedIDsFromHiddenField(hfSelectedIDS); List<int> selectedRows = new List<int>(); if (grid.SelectedRowIndexArray != null && grid.SelectedRowIndexArray.Length > 0) { selectedRows = new List<int>(grid.SelectedRowIndexArray); } if (grid.IsDatabasePaging) { for (int i = 0, count = Math.Min(grid.PageSize, (grid.RecordCount - grid.PageIndex * grid.PageSize)); i < count; i++) { int id = Convert.ToInt32(grid.DataKeys[i][0]); if (selectedRows.Contains(i)) { if (!ids.Contains(id)) { ids.Add(id); } } else { if (ids.Contains(id)) { ids.Remove(id); } } } } else { int startPageIndex = grid.PageIndex * grid.PageSize; for (int i = startPageIndex, count = Math.Min(startPageIndex + grid.PageSize, grid.RecordCount); i < count; i++) { int id = Convert.ToInt32(grid.DataKeys[i][0]); if (selectedRows.Contains(i - startPageIndex)) { if (!ids.Contains(id)) { ids.Add(id); } } else { if (ids.Contains(id)) { ids.Remove(id); } } } } hfSelectedIDS.Text = new JArray(ids).ToString(Formatting.None); }
/// <summary> /// 通用编辑单击事件 /// </summary> /// <param name="Grid1">Grid</param> /// <param name="Window1">Window Id</param> /// <param name="EditPage">编辑页面名称</param> /// <param name="WindowTitle">窗体标题</param> protected void EditClick(Grid Grid1, Window Window1, string EditPage, string WindowTitle) { try { if (Grid1.SelectedRowIndexArray.Length == 0) { Alert.Show("请至少选择一项!", MessageBoxIcon.Information); } else if (Grid1.SelectedRowIndexArray.Length > 1) { Alert.Show("只能选择一项!", MessageBoxIcon.Information); } else { string id = Grid1.DataKeys[Grid1.SelectedRowIndexArray[0]][0].ToString(); PageContext.RegisterStartupScript( Window1.GetShowReference(string.Format("{0}.aspx?id={1}&action=2", EditPage, id), WindowTitle)); } } catch (Exception) { Alert.Show("编辑失败,请重试!", MessageBoxIcon.Warning); } }
public abstract void BindGrid(FineUI.Grid grid, int pageIndex = 0, int pageSize = 0, List <ConditionFun.SqlqueryCondition> wheres = null, List <string> orders = null);
/// <summary> /// 为删除Grid中选中项的按钮添加提示信息 /// </summary> /// <param name="btn"></param> /// <param name="grid"></param> protected void ResolveDeleteButtonForGrid(FineUI.Button btn, Grid grid) { ResolveDeleteButtonForGrid(btn, grid, "确定要删除选中的{0}项记录吗?"); }
public abstract void BindGrid(FineUI.Grid grid, int parentValue, List <string> orders = null, string parentId = "ParentId");
protected void ResolveDeleteButtonForGrid(FineUI.Button btn, Grid grid, string confirmTemplate) { ResolveDeleteButtonForGrid(btn, grid, "请至少应该选择一项记录!", confirmTemplate); }