protected void Page_Load(object sender, EventArgs e) { MCSTreeControl tr_Category = (MCSTreeControl)pl_detail.FindControl("PDT_ProductExtInfo_Category"); if (!Page.IsPostBack) { ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); ViewState["Category"] = Request.QueryString["Category"] == null ? 0 : int.Parse(Request.QueryString["Category"]); if ((int)ViewState["ID"] > 0) { BindData(); } else { if (tr_Category != null && (int)ViewState["Category"] > 0) { tr_Category.SelectValue = ViewState["Category"].ToString(); } } } if (tr_Category != null) { tr_Category.DataSource = PDT_CategoryBLL.GetListByOwnerClient((int)Session["OwnerType"], (int)Session["OwnerClient"]); tr_Category.DataBind(); } }
private void BindDropDown() { MCSTreeControl tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { if ((int)Session["OwnerType"] == 2 && (int)Session["OwnerClient"] > 0) { CM_Client c = new CM_ClientBLL((int)Session["OwnerClient"]).Model; if (c != null) { int prov = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OfficialCity", c.OfficialCity, 1); tr_OfficialCity.RootValue = prov.ToString(); } } } if ((int)Session["OwnerType"] == 2 && (int)Session["OrganizeCity"] > 1) { DropDownList ddl_VisitRoute = (DropDownList)pl_detail.FindControl("CM_ClientManufactInfo_VisitRoute"); if (ddl_VisitRoute != null) { ddl_VisitRoute.DataValueField = "ID"; ddl_VisitRoute.DataTextField = "Name"; ddl_VisitRoute.DataSource = VST_RouteBLL.GetByOrganizeCity((int)Session["OrganizeCity"]); ddl_VisitRoute.DataBind(); ddl_VisitRoute.Items.Insert(0, new ListItem("请选择...", "0")); } } }
protected void btn_Add_Click(object sender, EventArgs e) { dvBasePay.BindData(new PM_StdBasePay()); MCSTreeControl officialCity = (MCSTreeControl)dvBasePay.FindControl("PM_StdBasePay_City"); officialCity.RootValue = "0"; officialCity.SelectValue = tr_OfficialCity.SelectValue; btn_Add.Enabled = false; dvBasePay.Visible = true; gvList.SelectedIndex = -1; btnDelete.Text = "取 消"; }
protected void btn_SalesForcast_Click(object sender, EventArgs e) { #region 已有分配单展示,没有则生成 MCSTreeControl tr_OrganizeCity = (MCSTreeControl)UC_DetailView1.FindControl("SVM_ClassifyForcast_OrganizeCity"); MCSSelectControl select_Client = (MCSSelectControl)UC_DetailView1.FindControl("SVM_ClassifyForcast_Client"); DropDownList ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_ClassifyForcast_AccountMonth"); int id = SVM_ClassifyForcastBLL.Init(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(ddl_Month.SelectedValue), int.Parse(select_Client.SelectValue == "" ? "0" : select_Client.SelectValue), (int)Session["UserID"]); Response.Redirect("ClassifyForcastDetail.aspx?ForcastID=" + id.ToString()); #endregion }
private void BindDropDown() { MCSTreeControl tr_Position = (MCSTreeControl)pl_detail.FindControl("Org_Staff_Position"); if (tr_Position != null) { tr_Position.RootValue = ConfigHelper.GetConfigInt("TDP-MainPosition").ToString(); } foreach (string rolename in Roles.GetAllRoles().Where(p => p.StartsWith("TDP"))) { cbx_Roles.Items.Add(new ListItem(rolename, rolename)); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 获取页面参数 ViewState["PriceID"] = Request.QueryString["PriceID"] == null ? 0 : int.Parse(Request.QueryString["PriceID"]); ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] == null ? 0 : int.Parse(Request.QueryString["OrganizeCity"]); #endregion BindDropDown(); ViewState["LabelVisiable"] = false; if ((int)ViewState["PriceID"] != 0)//修改客户价表 { BindData(); } else { btn_Apply.Visible = false; btn_UnActive.Visible = false; btn_Approve.Visible = false; btn_UnApprove.Visible = false; btn_ApplyCity.Visible = false; if ((int)ViewState["OrganizeCity"] != 0) { MCSTreeControl tr_OrganizeCity = panel1.FindControl("PDT_StandardPrice_OrganizeCity") != null ? (MCSTreeControl)panel1.FindControl("PDT_StandardPrice_OrganizeCity") : null; tr_OrganizeCity.SelectValue = ViewState["OrganizeCity"].ToString(); } } } DropDownList ddl_IsRebatePrice = panel1.FindControl("PDT_StandardPrice_IsRebatePrice") != null ? (DropDownList)panel1.FindControl("PDT_StandardPrice_IsRebatePrice") : null; if (ddl_IsRebatePrice != null) { ddl_IsRebatePrice.SelectedIndexChanged += new EventHandler(ddl_IsRebatePrice_SelectedIndexChanged); ddl_IsRebatePrice.AutoPostBack = true; } #region 注册弹出窗口 string script = "function PopApplyCity(){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("PDT_StandardPrice_ApplyCity.aspx") + "?PriceID=" + ViewState["PriceID"].ToString() + "&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopApplyCity", script, true); string script2 = "function PopChangeHistory(){\r\n"; script2 += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("PDT_StandardPriceChangeHistory.aspx") + "?ID=" + ViewState["PriceID"].ToString() + "&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopChangeHistory", script2, true); #endregion }
protected void Page_Load(object sender, System.EventArgs e) { #region 初始化界面控件 tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("VST_Route_OrganizeCity"); ddl_RelateStaff = (DropDownList)pl_detail.FindControl("VST_Route_RelateStaff"); if (tr_OrganizeCity != null) { tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; tr_OrganizeCity.AutoPostBack = true; } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null?int.Parse(Request.QueryString["ID"]) : 0; #endregion BindDropDown(); //TDP维护自己的路线 if ((int)Session["OwnerType"] == 3) { Header.Attributes["WebPageSubCode"] = "OwnerType=3"; } if ((int)ViewState["ID"] != 0) { //修改 BindData(); } else { //新增 VST_Route m = new VST_Route(); m.OrganizeCity = (int)Session["OrganizeCity"]; m.EnableFlag = "Y"; m.InsertTime = DateTime.Now; pl_detail.BindData(m); tr_OrganizeCity_Selected(null, null); } } }
public void BindDropDown() { MCSTreeControl tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { if ((int)Session["OwnerType"] == 2 && (int)Session["OwnerClient"] > 0) { CM_Client c = new CM_ClientBLL((int)Session["OwnerClient"]).Model; if (c != null) { int prov = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OfficialCity", c.OfficialCity, 1); tr_OfficialCity.RootValue = prov.ToString(); } } } }
protected void select_Staff_SelectChange(object sender, SelectChangeEventArgs e) { if (select_Staff.SelectValue != "") { Org_StaffBLL staff = new Org_StaffBLL(int.Parse(select_Staff.SelectValue), true); select_Staff.SelectText = staff.Model.RealName; select_Staff.SelectValue = staff.Model.ID.ToString(); Org_PositionBLL position = new Org_PositionBLL(staff.Model.Position); lbl_Position.Text = position.Model.Name; MCSTreeControl tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("JN_Journal_OfficialCity"); tr_OfficialCity.SelectValue = staff.Model.OfficialCity.ToString(); } else { MessageBox.Show(this, "请正确选择日志填报人!"); return; } }
protected void btn_SalesTarget_Click(object sender, EventArgs e) { #region 已有分配单展示,没有则生成 MCSTreeControl tr_OrganizeCity = (MCSTreeControl)UC_DetailView1.FindControl("SVM_SalesTarget_OrganizeCity"); MCSSelectControl select_Client = (MCSSelectControl)UC_DetailView1.FindControl("SVM_SalesTarget_Client"); DropDownList ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_SalesTarget_AccountMonth"); if (tr_OrganizeCity.SelectValue == "0" || select_Client.SelectValue == "") { lb_Msg.Text = "必填先选择要填报的客户!"; MessageBox.Show(this, "必填先选择要填报的客户!" + tr_OrganizeCity.SelectValue + "|" + select_Client.SelectValue); return; } int id = SVM_SalesTargetBLL.InitProductList(int.Parse(tr_OrganizeCity.SelectValue), int.Parse(ddl_Month.SelectedValue), int.Parse(select_Client.SelectValue == "" ? "0" : select_Client.SelectValue), (int)Session["UserID"]); Response.Redirect("SalesTargetDetail.aspx?TargetID=" + id.ToString()); #endregion }
protected void Page_Load(object sender, System.EventArgs e) { #region 初始化界面控件 tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("VST_Route_OrganizeCity"); ddl_RelateStaff = (DropDownList)pl_detail.FindControl("VST_Route_RelateStaff"); if (tr_OrganizeCity != null) { tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; tr_OrganizeCity.AutoPostBack = true; } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null ? int.Parse(Request.QueryString["ID"]) : 0; #endregion BindDropDown(); //TDP维护自己的路线 if ((int)Session["OwnerType"] == 3) Header.Attributes["WebPageSubCode"] = "OwnerType=3"; if ((int)ViewState["ID"] != 0) { //修改 BindData(); } else { //新增 VST_Route m = new VST_Route(); m.OrganizeCity = (int)Session["OrganizeCity"]; m.EnableFlag = "Y"; m.InsertTime = DateTime.Now; pl_detail.BindData(m); tr_OrganizeCity_Selected(null, null); } } }
protected void Page_Load(object sender, EventArgs e) { ddl_Brand = (DropDownList)pl_detail.FindControl("PDT_Product_Brand"); if (!Page.IsPostBack) { ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); if ((int)Session["OwnerType"] == 2) { ddl_Brand.DataSource = PDT_BrandBLL.GetModelList("IsOpponent=1"); ddl_Brand.DataValueField = "ID"; ddl_Brand.DataTextField = "Name"; ddl_Brand.DataBind(); } if ((int)ViewState["ID"] > 0) { BindData(); } else { if (Request.QueryString["Brand"] != null && Request.QueryString["Brand"] != "0") { ddl_Brand.SelectedValue = Request.QueryString["Brand"]; ddl_Brand.Enabled = false; } MCSTabControl1.Visible = false; } } MCSTreeControl tr_Category = (MCSTreeControl)pl_detail.FindControl("PDT_Product_Category"); if (tr_Category != null) { tr_Category.DataSource = PDT_CategoryBLL.GetListByOwnerClient((int)Session["OwnerType"], (int)Session["OwnerClient"]); tr_Category.DataBind(); } }
void ddl_FeeType_SelectedIndexChanged(object sender, EventArgs e) { int organizecity = 0, month = 0, feetype = 0; month = AC_AccountMonthBLL.GetCurrentMonth(); MCSTreeControl tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("FNA_BudgetExtraApply_OrganizeCity"); if (tr_OrganizeCity != null) { int.TryParse(tr_OrganizeCity.SelectValue, out organizecity); } DropDownList ddl_FeeType = (DropDownList)pl_detail.FindControl("FNA_BudgetExtraApply_FeeType"); if (ddl_FeeType != null) { int.TryParse(ddl_FeeType.SelectedValue, out feetype); } BindBudget(month, organizecity, feetype); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["ID"] = Request.QueryString["KB_Article_ID"] == null ? 0 : int.Parse(Request.QueryString["KB_Article_ID"]); ViewState["Catalog"] = Request.QueryString["Catalog"] == null ? 0 : int.Parse(Request.QueryString["Catalog"]); ckedit_content.Text = ""; if ((int)ViewState["ID"] > 0) { this.UploadFile1.Visible = true; this.UploadFile1.RelateID = (int)ViewState["ID"]; BindData(); } else { if ((int)ViewState["Catalog"] > 0) { MCSTreeControl select_Catalog = (MCSTreeControl)panel1.FindControl("KB_Article_Catalog"); if (select_Catalog != null) { select_Catalog.SelectValue = ViewState["Catalog"].ToString(); } TextBox tbx_Author = (TextBox)panel1.FindControl("KB_Article_Author"); if (tbx_Author != null) { tbx_Author.Text = (string)Session["UserRealName"]; } } tr_Approve.Visible = false; UploadFile1.Visible = false; } ViewState["Catalog"] = 0; } }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { HtmlTable T_Content = new HtmlTable(); T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); UD_DetailViewBLL _DetailViewBll = new UD_DetailViewBLL(DetailViewCode, true); IList <UD_Panel> _panellist = _DetailViewBll.GetDetailPanels(); Hashtable _htFieldControlsInfo = new Hashtable(); foreach (UD_Panel _panelmodel in _panellist) { HtmlTableRow tr_panel = new HtmlTableRow();//Create one TableRow for a panel tr_panel.ID = _panelmodel.Code; if (_panelmodel.Enable.ToUpper() == "N") { tr_panel.Visible = false; } HtmlTableCell tc_panel = new HtmlTableCell(); string _tablestytle = _panelmodel.TableStyle; string[] _tablestyles = _panelmodel.TableStyle.Split(new char[] { ',' }); if (_tablestyles.Length < 3) { _tablestyles = ("tabForm,dataLabel,dataField").Split(new char[] { ',' }); } #region The title of the panel if (_panelmodel.Name != "") { HtmlTable tb_panel_title = new HtmlTable(); tb_panel_title.CellPadding = 0; tb_panel_title.CellSpacing = 0; tb_panel_title.Width = "100%"; tb_panel_title.Height = "28px"; tb_panel_title.Border = 0; tb_panel_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_panel_title = new HtmlTableRow(); HtmlTableCell tc_panel_title = new HtmlTableCell(); tc_panel_title.InnerHtml = "<h3>" + _panelmodel.Name + "</h3>"; tr_panel_title.Cells.Add(tc_panel_title); tb_panel_title.Rows.Add(tr_panel_title); tc_panel.Controls.Add(tb_panel_title); } #endregion #region The content of the panel IList <UD_Panel_ModelFields> fields = new UD_PanelBLL(_panelmodel.ID, true).GetModelFields(); int FieldCount = _panelmodel.FieldCount; HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = _tablestyles[0]; int i = 0; foreach (UD_Panel_ModelFields _panel_modelfields in fields) { if (_panel_modelfields.Visible == "N") { continue; } UD_ModelFields _modelfieldsmodel = new UD_ModelFieldsBLL(_panel_modelfields.FieldID, true).Model; UD_TableList _tablemodel = new UD_TableListBLL(_modelfieldsmodel.TableID, true).Model; #region 判断该控件是否已存在 if (_htFieldControlsInfo.Contains(_tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName)) { continue; } #endregion #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = _tablestyles[1]; tc_displayname.InnerText = string.IsNullOrEmpty(_panel_modelfields.LabelText) ? _modelfieldsmodel.DisplayName : _panel_modelfields.LabelText; if (tc_displayname.InnerText.Length <= 6) { tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; } else { tc_displayname.Attributes["Style"] = "width: 100px; height: 18px;"; } tc_displayname.Attributes["nowrap"] = "nowrap"; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = _tablestyles[2]; if (_panel_modelfields.ColSpan > 0) { if (i + _panel_modelfields.ColSpan <= FieldCount) { tc_control.ColSpan = 2 * _panel_modelfields.ColSpan - 1; i = i + _panel_modelfields.ColSpan; } else { tc_control.ColSpan = 2 * (FieldCount - i) - 1; i = 0; } } else { i++; } WebControl control = null; int RelationType = _modelfieldsmodel.RelationType; string RelationTableName = _modelfieldsmodel.RelationTableName; string RelationValueField = _modelfieldsmodel.RelationValueField; string RelationTextField = _modelfieldsmodel.RelationTextField; #region 根据控件类型生成相应的控件 switch (_panel_modelfields.ControlType) { case 1: //Label control = new Label(); break; case 2: //TextBox control = new TextBox(); if (_modelfieldsmodel.DataType == 4) { control.Attributes["onfocus"] = "WdatePicker();"; } break; case 3: //DropDownList control = new DropDownList(); if (RelationType == 1) //Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); if (_modelfieldsmodel.DataType != 5) { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); } else { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); } break; case 4: //RadioButtonList control = new RadioButtonList(); if (RelationType == 1) //Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) { ((RadioButtonList)control).SelectedIndex = 0; } break; case 5: //MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; if (_panel_modelfields.ControlHeight > 0) { ((TextBox)control).Height = new Unit(_panel_modelfields.ControlHeight); } break; case 6: //TextBox supports search control = new MCSSelectControl(); if (RelationType == 2) //Relation to the model table { control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; if (_panel_modelfields.SearchPageURL != "") { ((MCSSelectControl)control).PageUrl = _panel_modelfields.SearchPageURL; } else if (_modelfieldsmodel.SearchPageURL != "") { ((MCSSelectControl)control).PageUrl = _modelfieldsmodel.SearchPageURL; } } break; case 7: //MCSTreeControl control = new MCSTreeControl(); if (RelationType == 2) //Relation to the model table { control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; if (_modelfieldsmodel.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取所能管辖的片区 if (System.Web.HttpContext.Current.Session["AccountType"] == null || (int)System.Web.HttpContext.Current.Session["AccountType"] == 1) { //员工 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } } } else if ((int)System.Web.HttpContext.Current.Session["AccountType"] == 2 && System.Web.HttpContext.Current.Session["OrganizeCity"] != null) { //商业客户 int city = (int)System.Web.HttpContext.Current.Session["OrganizeCity"]; Addr_OrganizeCityBLL citybll = new Addr_OrganizeCityBLL(city); ((MCSTreeControl)control).DataSource = citybll.GetAllChildNodeIncludeSelf(); ((MCSTreeControl)control).RootValue = citybll.Model.SuperID.ToString(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = city.ToString(); } } #endregion } else if (_modelfieldsmodel.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity") { ((MCSTreeControl)control).TableName = "MCS_SYS.dbo.Addr_OfficialCity"; ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; } } break; } #endregion control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; control.Enabled = _panel_modelfields.Enable.ToUpper() == "Y"; if (_panel_modelfields.ControlWidth > 0) { control.Width = _panel_modelfields.ControlWidth; } tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (_panel_modelfields.IsRequireField == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = " *"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } if (_panel_modelfields.ControlType == 2 || _panel_modelfields.ControlType == 5) { if (_panel_modelfields.IsRequireField == "Y") { RequiredFieldValidator _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; _requiredfieldvalidator.ValidationGroup = _validationgroup; tc_control.Controls.Add(_requiredfieldvalidator); } if (_panel_modelfields.RegularExpression != "") { RegularExpressionValidator _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = _panel_modelfields.RegularExpression; _regularexpressionvalidator.ValidationGroup = ValidationGroup; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } else { if (_modelfieldsmodel.DataType == 1 || _modelfieldsmodel.DataType == 2 || _modelfieldsmodel.DataType == 4) //非varchar 字符串 { CompareValidator _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; _comparevalidator.ValidationGroup = _validationgroup; if (_modelfieldsmodel.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (_modelfieldsmodel.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (_modelfieldsmodel.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } } } #endregion if (!string.IsNullOrEmpty(_panel_modelfields.Description)) { Label lb = new Label(); lb.Text = " " + _panel_modelfields.Description; tc_control.Controls.Add(lb); } tr_panel_detail.Cells.Add(tc_control); #endregion #region 将控件记录到字段控件HashTable中 FieldControlInfo fieldcontrolinfo = new FieldControlInfo(); fieldcontrolinfo.FieldID = _modelfieldsmodel.ID; fieldcontrolinfo.FieldName = _modelfieldsmodel.FieldName; fieldcontrolinfo.ModelName = _tablemodel.ModelClassName; fieldcontrolinfo.ControlType = _panel_modelfields.ControlType; fieldcontrolinfo.ControlName = control.ID; fieldcontrolinfo.DisplayMode = _panel_modelfields.DisplayMode; fieldcontrolinfo.Panel_Field_ID = _panel_modelfields.ID; _htFieldControlsInfo.Add(fieldcontrolinfo.ControlName, fieldcontrolinfo); #endregion } #endregion tc_panel.Controls.Add(tb_panel_content); tr_panel.Cells.Add(tc_panel); T_Content.Rows.Add(tr_panel); } ViewState["FieldControlsInfo"] = _htFieldControlsInfo; }
protected void Page_Load(object sender, System.EventArgs e) { #region 获取界面控件 tr_OfficialCity = UC_DetailView1.FindControl("PM_Promotor_OfficialCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OfficialCity"); tr_OrganizeCity = UC_DetailView1.FindControl("PM_Promotor_OrganizeCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OrganizeCity"); txt_IDCode = UC_DetailView1.FindControl("PM_Promotor_IDCode") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_IDCode"); txt_Name = UC_DetailView1.FindControl("PM_Promotor_Name") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_Name"); txt_AccountName = UC_DetailView1.FindControl("PM_Promotor_AccountName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountName"); ddl_BankType = UC_DetailView1.FindControl("PM_Promotor_BankType") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_BankType"); txt_BankName = UC_DetailView1.FindControl("PM_Promotor_BankName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName"); ddl_Classify = UC_DetailView1.FindControl("PM_Promotor_Classfiy") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Classfiy"); if (ddl_BankType != null) { ddl_BankType.AutoPostBack = true; ddl_BankType.SelectedIndexChanged += new EventHandler(ddl_BankType_SelectedIndexChanged); } if (ddl_Classify != null) { ddl_Classify.AutoPostBack = true; ddl_Classify.SelectedIndexChanged += new EventHandler(ddl_Classify_SelectedIndexChanged); } if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += new SelectedEventHandler(tr_OrganizeCity_Selected); } if (txt_IDCode != null) { txt_IDCode.AutoPostBack = true; txt_IDCode.TextChanged += new EventHandler(txt_IDCode_TextChanged); } if (txt_Name != null) { txt_Name.AutoPostBack = true; txt_Name.TextChanged += new EventHandler(txt_Name_TextChanged); } #endregion if (!Page.IsPostBack) { ViewState["PromotorID"] = Request.QueryString["PromotorID"] == null ? 0 : int.Parse(Request.QueryString["PromotorID"]); if ((int)ViewState["PromotorID"] > 0) { BindDropDown(); BindData(); UploadFile1.RelateID = (int)ViewState["PromotorID"]; UploadFile1.BindGrid(); } else { Org_Staff s = new Org_StaffBLL((int)Session["UserID"]).Model; if (s != null) { if (tr_OfficialCity != null) { tr_OfficialCity.SelectValue = s.OfficialCity.ToString(); } if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = s.OrganizeCity.ToString(); } } DropDownList ddl_SalaryFlag = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_SalaryFlag"); if (ddl_SalaryFlag != null) { ddl_SalaryFlag.SelectedValue = "1"; } DropDownList ddl_Dimission = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Dimission"); if (ddl_Dimission != null) { ddl_Dimission.Enabled = false; ddl_Dimission.SelectedValue = "1"; } TextBox tbx_EndWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_EndWorkDate"); if (tbx_EndWorkDate != null) { tbx_EndWorkDate.Enabled = false; } tbl_Promotor.Visible = false; UploadFile1.Visible = false; gv_list.Visible = false; bt_AddApply.Visible = false; bt_Approve.Visible = false; bt_RevocationApply.Visible = false; } //根据管理片区,获取可用的薪酬级别 tr_OrganizeCity_Selected(null, null); } #region 给账号/开户行文本框添加事件 //TextBox tbx_BankName = (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName"); //tbx_BankName.AutoPostBack = true; //tbx_BankName.TextChanged += new EventHandler(tbx_Bank_TextChanged); TextBox tbx_BankAccountNo = (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountCode"); tbx_BankAccountNo.AutoPostBack = true; tbx_BankAccountNo.TextChanged += new EventHandler(tbx_Bank_TextChanged); #endregion if ((int)ViewState["PromotorID"] == 0) { MCSTabControl1.Items[1].Visible = false; } string script = "function PopPMClassify_Approve(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/PM/PMClassify_Approve.aspx?PromotorID=' + id ") + ", window, 'dialogWidth:930px;DialogHeight=600px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopPMClassify_Approve", script, true); }
protected void Page_Load(object sender, System.EventArgs e) { #region 给行政城市加事件 tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { tr_OfficialCity.AutoPostBack = true; tr_OfficialCity.Selected += tr_OfficialCity_Selected; } tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; } tr_Channel = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_Channel"); if (tr_Channel != null) { tr_Channel.AutoPostBack = true; tr_Channel.Selected += tr_Channel_Selected; } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion Session["MCSMenuControl_FirstSelectIndex"] = "11"; BindDropDown(); if (ViewState["ClientID"] != null) { BindData(); } else if (Request.QueryString["Mode"] == "New") { #region 新增门店时的初始值 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) { ddl_ActiveFlag.SelectedValue = "1"; } TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_Client_OpenTime"); if (tbx_OpenTime != null) { tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } bt_Approve.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在‘零售商列表’中选择要查看的零售商!", "RetailerList.aspx?URL=" + Request.Url.PathAndQuery); } } #region 给活跃标志加事件 //DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); //ddl_ActiveFlag_1.AutoPostBack = true; //ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion //TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); //tbx_Code.AutoPostBack = true; //tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); #region 注册弹出窗口脚本 string script = "function PopReplaceClientManager(id,clienttype){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceClientManager.aspx") + "?ClientManager=' + id + '&ClientType='+clienttype+'&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceClientManager", script, true); script = "function Pop_SetPrimaryAccount(client){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/RM/AccountOpen/Pop_SetPrimaryAccount.aspx") + "?Client=' + client + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=400px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pop_SetPrimaryAccount", script, true); script = "function Pop_MapShow(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.open('" + Page.ResolveClientUrl("../Map/ClientInMap.aspx") + "?ClientID=' + id + '&tempid='+tempid);}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopShow", script, true); #endregion }
protected void Page_Load(object sender, System.EventArgs e) { CM_Client_Classification = pl_detail.FindControl("CM_Client_Classification") != null ? (DropDownList)pl_detail.FindControl("CM_Client_Classification") : null; // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion //Session["MCSMenuControl_FirstSelectIndex"] = "11"; if (ViewState["ClientID"] != null) { BindData(); BindDropDown(); } else if (Request.QueryString["Mode"] == "New") { #region 新增门店时的初始值 Org_Staff staff = new Org_StaffBLL((int)Session["UserID"]).Model; if (staff == null) { Response.Redirect("~/SubModule/Desktop.aspx"); } #region 新增客户时,详细资料界面控件初始化 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) { ddl_ActiveFlag.SelectedValue = "4"; } TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_Client_OpenTime"); if (tbx_OpenTime != null) { tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } MCSTreeControl tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = staff.OrganizeCity.ToString(); } MCSTreeControl tr_OfficalCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity"); if (tr_OfficalCity != null) { tr_OfficalCity.SelectValue = staff.OfficialCity.ToString(); } MCSSelectControl select_ClientManager = (MCSSelectControl)pl_detail.FindControl("CM_Client_ClientManager"); if (select_ClientManager != null) { select_ClientManager.SelectText = staff.RealName; select_ClientManager.SelectValue = staff.ID.ToString(); } DropDownList ddl_ChiefLinkMan = pl_detail.FindControl("CM_Client_ChiefLinkMan") != null ? (DropDownList)pl_detail.FindControl("CM_Client_ChiefLinkMan") : null; if (ddl_ChiefLinkMan != null) { ddl_ChiefLinkMan.Items.Clear(); ddl_ChiefLinkMan.Enabled = false; } DropDownList ddl_RTClassify = (DropDownList)pl_detail.FindControl("CM_Client_RTClassify"); if (ddl_RTClassify != null) { if (ddl_RTClassify.Items.FindByValue("1") != null) { ddl_RTClassify.SelectedValue = "1"; } } #endregion bt_AddLinkMan.Visible = false; bt_Approve.Visible = false; tr_Contract.Visible = false; tr_LinkMan.Visible = false; tr_Promotor.Visible = false; bt_Analysis.Visible = false; bt_AddApply.Visible = false; bt_RevocationApply.Visible = false; bt_Record.Visible = false; bt_ReplaceClientManager.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在‘零售商列表’中选择要查看的零售商!", "RetailerList.aspx?URL=" + Request.Url.PathAndQuery); } } #region 给活跃标志加事件 DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); ddl_ActiveFlag_1.AutoPostBack = true; ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); tbx_Code.AutoPostBack = true; tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); CM_Client_MarketType = pl_detail.FindControl("CM_Client_MarketType") != null ? (DropDownList)pl_detail.FindControl("CM_Client_MarketType") as DropDownList : null; CM_Client_OfficalCity = pl_detail.FindControl("CM_Client_OfficalCity") != null ? (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity") : null; if (CM_Client_OfficalCity != null) { CM_Client_OfficalCity.AutoPostBack = true; CM_Client_OfficalCity.Selected += new SelectedEventHandler(CM_Client_OfficalCity_Selected); } TextBox tbx_FullName = pl_detail.FindControl("CM_Client_FullName") == null ? null : (TextBox)pl_detail.FindControl("CM_Client_FullName"); if (tbx_FullName != null) { tbx_FullName.AutoPostBack = true; tbx_FullName.TextChanged += new EventHandler(tbx_FullName_TextChanged); } #region 注册弹出窗口脚本 string script = "function PopReplaceClientManager(id,clienttype){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceClientManager.aspx") + "?ClientManager=' + id + '&ClientType='+clienttype+'&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceClientManager", script, true); #endregion //ddl_RTChannel = pl_detail.FindControl("CM_Client_RTChannel") as DropDownList; //ddl_RTChannel.AutoPostBack = true; //ddl_RTChannel.SelectedIndexChanged += new EventHandler(ddl_RTChannel_SelectedIndexChanged); DropDownList ddl_IsRMSClient = pl_detail.FindControl("CM_Client_IsRMSClient") as DropDownList; //ddl_IsRMSClient.AutoPostBack = true; //ddl_IsRMSClient.SelectedIndexChanged += new EventHandler(ddl_IsRMSClient_SelectedIndexChanged); //foreach (ListItem item in ddl_IsRMSClient.Items) //{ // if (item.Value == "1" && item.Text == "已启动") // { // item.Attributes.Add("disabled", "true"); // } //} //非"雅慧电商"的流通店 不允许选择积分店状态 //DropDownList ddl_RTClassifyTemp = pl_detail.FindControl("CM_Client_RTClassify") as DropDownList; //if (ddl_RTClassifyTemp != null && ddl_RTClassifyTemp.SelectedValue == "1" && ddl_RTChannel.SelectedValue != "20") //{ // ddl_IsRMSClient.SelectedValue = "2"; // ddl_IsRMSClient.Enabled = false; // DropDownList ddl_RMSAccountEnabled = pl_detail.FindControl("CM_Client_RMSAccountEnabled") as DropDownList; // ddl_RMSAccountEnabled.SelectedValue = "2"; //} //this.ddl_RMSAccountEnabled_Select(); //this.ShowRMSCloseDate(); }
protected void Page_Load(object sender, System.EventArgs e) { #region 初始化页面控件 Page.ClientScript.RegisterClientScriptInclude("meizzDate", Page.ResolveClientUrl("~/App_Themes/basic/meizzDate.js")); select_RelateClient = (MCSSelectControl)pl_detail.FindControl("JN_Journal_RelateClient"); if (select_RelateClient != null) { select_RelateClient.SelectChange += new SelectChangeEventHandler(select_RelateClient_SelectChange); } ddl_RelateLinkMan = (DropDownList)pl_detail.FindControl("JN_Journal_RelateLinkMan"); if (ddl_RelateLinkMan != null) { ddl_RelateLinkMan.DataTextField = "Name"; ddl_RelateLinkMan.DataValueField = "ID"; } rbl_HasSynergeticStaff = (RadioButtonList)pl_detail.FindControl("JN_Journal_HasSynergeticStaff"); if (rbl_HasSynergeticStaff != null) { rbl_HasSynergeticStaff.AutoPostBack = true; rbl_HasSynergeticStaff.SelectedIndexChanged += new EventHandler(rbl_HasSynergeticStaff_SelectedIndexChanged); } ddl_RelateActivity = (DropDownList)pl_detail.FindControl("JN_Journal_RelateActivity"); if (ddl_RelateActivity != null) { ddl_RelateActivity.DataTextField = "Topic"; ddl_RelateActivity.DataValueField = "ID"; ddl_RelateActivity.AutoPostBack = true; ddl_RelateActivity.SelectedIndexChanged += new EventHandler(ddl_RelateActivity_SelectedIndexChanged); } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null?Int32.Parse(Request.QueryString["ID"]) : 0; #endregion BindDropDown(); if ((int)ViewState["ID"] != 0) { if (rbl_HasSynergeticStaff != null) { rbl_HasSynergeticStaff.SelectedValue = "2"; //默认非协同拜访 } BindData(); } else { if (Request.QueryString["Day"] != null && Request.QueryString["Day"] != "0") { tbx_begindate.Text = DateTime.Today.AddDays(int.Parse(Request.QueryString["Day"]) - DateTime.Today.DayOfYear).ToString("yyyy-MM-dd"); } else { tbx_begindate.Text = DateTime.Today.ToString("yyyy-MM-dd"); } #region 获取日志填报人信息 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"], true); select_Staff.SelectText = staff.Model.RealName; select_Staff.SelectValue = Session["UserID"].ToString(); Org_PositionBLL position = new Org_PositionBLL(staff.Model.Position); lbl_Position.Text = position.Model.Name; MCSTreeControl tr_OfficialCity = pl_detail.FindControl("JN_Journal_OfficialCity") != null ? (MCSTreeControl)pl_detail.FindControl("JN_Journal_OfficialCity") : null; if (tr_OfficialCity != null) { tr_OfficialCity.SelectValue = staff.Model.OfficialCity.ToString(); } #endregion #region 获取本机IP TextBox tbx_IPAddress = pl_detail.FindControl("JN_Journal_IPAddress") != null ? (TextBox)pl_detail.FindControl("JN_Journal_IPAddress") : null; if (tbx_IPAddress != null) { tbx_IPAddress.Text = Request.UserHostAddress; TextBox tbx_IPLocation = pl_detail.FindControl("JN_Journal_IPLocation") != null ? (TextBox)pl_detail.FindControl("JN_Journal_IPLocation") : null; userAddress = Const_IPLocationBLL.FindByIP(Request.UserHostAddress); if (tbx_IPLocation != null) { tbx_IPLocation.Text = userAddress != null ? userAddress.Location : ""; } } #endregion #region 新增日志时,联系人字段不可编辑 if (ddl_RelateLinkMan != null) { ddl_RelateLinkMan.Items.Clear(); ddl_RelateLinkMan.Enabled = false; } #endregion pl_detail.SetPanelVisible("Panel_OA_JournalDetail_02", false); pl_detail.SetPanelVisible("Panel_OA_JournalDetail_03", false); pl_detail.SetPanelVisible("Panel_OA_JournalDetail_04", false); #region 默认无领导协同拜访 if (rbl_HasSynergeticStaff != null) { rbl_HasSynergeticStaff.SelectedValue = "2"; //默认非协同拜访 rbl_HasSynergeticStaff_SelectedIndexChanged(null, null); } #endregion bt_AddNewClient.Visible = false; bt_Delete.Visible = false; tbl_comment.Visible = false; UploadFile1.Visible = false; bt_ToEvectionRoute.Visible = false; } } #region 注册脚本 string script = "function OpenClientInput(Journalid,OfferMan,Activityid){\r\n"; script += "window.open('../../CSO/CSO_SampleOfferDetail.aspx?JournalID='+Journalid+'&OfferMan='+OfferMan+'&ActivityID='+Activityid);}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OpenClientInput", script, true); #endregion }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { if (DataSet == Guid.Empty) return; IList<Rpt_DataSetParams> paramfields = new Rpt_DataSetBLL(DataSet, true).GetParams(); if (paramfields.Count == 0) return; //无参数 HtmlTable T_Content = new HtmlTable(); string[] tablestyles = new string[] { "tabForm", "dataLabel", "dataField" }; T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); HtmlTableRow tr_panel = new HtmlTableRow();//Create one TableRow for a panel tr_panel.ID = "DataSetParamPanel"; HtmlTableCell tc_panel = new HtmlTableCell(); #region The title of the panel HtmlTable tb_panel_title = new HtmlTable(); tb_panel_title.CellPadding = 0; tb_panel_title.CellSpacing = 0; tb_panel_title.Width = "100%"; tb_panel_title.Height = "28px"; tb_panel_title.Border = 0; tb_panel_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_panel_title = new HtmlTableRow(); HtmlTableCell tc_panel_title = new HtmlTableCell(); tc_panel_title.InnerHtml = "<h3>请设置统计报表参数信息</h3>"; tr_panel_title.Cells.Add(tc_panel_title); tb_panel_title.Rows.Add(tr_panel_title); tc_panel.Controls.Add(tb_panel_title); #endregion #region The content of the panel int FieldCount = 3; HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = tablestyles[0]; int i = 0; foreach (Rpt_DataSetParams param in paramfields) { string ControlID = "Param_" + param.ParamName.Replace("@", ""); //判断该控件是否已存在 if (ParamControlsInfo.ContainsKey(ControlID)) continue; ParamControlsInfo.Add(ControlID, param); if (param.Visible == "Y") { #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = tablestyles[1]; tc_displayname.InnerText = param.DisplayName; if (tc_displayname.InnerText.Length <= 6) tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; else tc_displayname.Attributes["Style"] = "width: 100px; height: 18px;"; tc_displayname.Attributes["nowrap"] = "nowrap"; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = tablestyles[2]; i++; WebControl control = null; int RelationType = param.RelationType; string RelationTableName = param.RelationTableName; string RelationValueField = param.RelationValueField; string RelationTextField = param.RelationTextField; #region 根据控件类型生成相应的控件 switch (param.ControlType) { case 1://Label control = new Label(); ((Label)control).Text = GetDefaule(param.DefaultValue); break; case 2://TextBox control = new TextBox(); if (param.DataType == 4) { control.Attributes["onfocus"] = "WdatePicker();"; } ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 3://DropDownList control = new DropDownList(); if (RelationType == 1)//Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); if (param.DataType != 5) ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); else ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); if (param.DefaultValue != "") { if (((DropDownList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) ((DropDownList)control).SelectedValue = GetDefaule(param.DefaultValue); } break; case 4://RadioButtonList control = new RadioButtonList(); if (RelationType == 1)//Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) ((RadioButtonList)control).SelectedIndex = 0; if (param.DefaultValue != "") { if (((RadioButtonList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) ((RadioButtonList)control).SelectedValue = GetDefaule(param.DefaultValue); } break; case 5://MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 6://TextBox supports search control = new MCSSelectControl(); control.ID = ControlID; if (param.SearchPageURL != "") ((MCSSelectControl)control).PageUrl = param.SearchPageURL; if (param.DefaultValue != "") { control.Init += new EventHandler(control_Init); } break; case 7://MCSTreeControl control = new MCSTreeControl(); control.ID = ControlID; if (param.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = "0"; } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = "0"; } if (param.DefaultValue != "") { if (((MCSTreeControl)control).SelectValue == "0" || ((MCSTreeControl)control).SelectValue == "") ((MCSTreeControl)control).SelectValue = GetDefaule(param.DefaultValue); } break; } #endregion control.ID = ControlID; control.Enabled = param["Enable"] != "N"; int controlwidth = 0; if (int.TryParse(param["ControlWidth"], out controlwidth)) control.Width = new Unit(controlwidth); tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (param["IsRequireField"] == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = " *"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } if (param.ControlType == 2 || param.ControlType == 5) { if (param["IsRequireField"] == "Y") { RequiredFieldValidator _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(_requiredfieldvalidator); } if (param.DataType == 1 || param.DataType == 2 || param.DataType == 4) //非varchar 字符串 { CompareValidator _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; if (param.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (param.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (param.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } else { if (param.RegularExpression != "") { RegularExpressionValidator _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = param.RegularExpression; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } } } #endregion tr_panel_detail.Cells.Add(tc_control); #endregion } } #endregion tc_panel.Controls.Add(tb_panel_content); tr_panel.Cells.Add(tc_panel); T_Content.Rows.Add(tr_panel); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { ViewState["ID"] = Request.QueryString["ID"] == null ? 0 : int.Parse(Request.QueryString["ID"]); #region 如果非总部职位,其只能选择自己职位及以下职位 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); Org_Position p = new Org_PositionBLL(staff.Model.Position).Model; MCSTreeControl tr_Position = (MCSTreeControl)panel1.FindControl("Org_Staff_Position"); if (p != null && p.IsHeadOffice != "Y" && p.Remark != "OfficeHR") //备注为"OfficeHR":人事经理,可以选择全部职位 { tr_Position.RootValue = p.SuperID.ToString(); tr_Position.SelectValue = staff.Model.Position.ToString(); } else if (tr_Position != null) { tr_Position.RootValue = "1"; tr_Position.SelectValue = "1"; } #endregion DropDownList ddl_Dimission = (DropDownList)panel1.FindControl("Org_Staff_Dimission"); if (ddl_Dimission != null) { ddl_Dimission.Enabled = false; } TextBox tbx_EndWorkTime = (TextBox)panel1.FindControl("Org_Staff_EndWorkTime"); if (tbx_EndWorkTime != null) { tbx_EndWorkTime.Enabled = false; } if ((int)ViewState["ID"] > 0) { BindData(); } else { tr_LoginUser.Visible = false; tr_StaffInOrganizeCity.Visible = false; UploadFile1.Visible = false; bt_AddApply.Visible = false; bt_RevocationApply.Visible = false; bt_Approve.Visible = false; bt_Print.Visible = false; if (ddl_Dimission != null) { ddl_Dimission.SelectedValue = "1"; } RadioButtonList rbl_ApproveFlag = (RadioButtonList)panel1.FindControl("Org_Staff_ApproveFlag"); if (rbl_ApproveFlag != null) { rbl_ApproveFlag.SelectedValue = "2"; } DropDownList ddl_SalaryFlag = (DropDownList)panel1.FindControl("Org_Staff_SalaryFlag"); if (ddl_SalaryFlag != null) { ddl_SalaryFlag.SelectedValue = "1"; } } } }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { HtmlTable T_Content = new HtmlTable(); T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); UD_DetailViewBLL _DetailViewBll = new UD_DetailViewBLL(DetailViewCode, true); IList<UD_Panel> _panellist = _DetailViewBll.GetDetailPanels(); Hashtable _htFieldControlsInfo = new Hashtable(); foreach (UD_Panel _panelmodel in _panellist) { HtmlTableRow tr_panel = new HtmlTableRow();//Create one TableRow for a panel tr_panel.ID = _panelmodel.Code; if (_panelmodel.Enable.ToUpper() == "N") tr_panel.Visible = false; HtmlTableCell tc_panel = new HtmlTableCell(); string _tablestytle = _panelmodel.TableStyle; string[] _tablestyles = _panelmodel.TableStyle.Split(new char[] { ',' }); if (_tablestyles.Length < 3) _tablestyles = ("tabForm,dataLabel,dataField").Split(new char[] { ',' }); #region The title of the panel if (_panelmodel.Name != "") { HtmlTable tb_panel_title = new HtmlTable(); tb_panel_title.CellPadding = 0; tb_panel_title.CellSpacing = 0; tb_panel_title.Width = "100%"; tb_panel_title.Height = "28px"; tb_panel_title.Border = 0; tb_panel_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_panel_title = new HtmlTableRow(); HtmlTableCell tc_panel_title = new HtmlTableCell(); tc_panel_title.InnerHtml = "<h3>" + _panelmodel.Name + "</h3>"; tr_panel_title.Cells.Add(tc_panel_title); tb_panel_title.Rows.Add(tr_panel_title); tc_panel.Controls.Add(tb_panel_title); } #endregion #region The content of the panel IList<UD_Panel_ModelFields> fields = new UD_PanelBLL(_panelmodel.ID, true).GetModelFields(); int FieldCount = _panelmodel.FieldCount; HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = _tablestyles[0]; int i = 0; foreach (UD_Panel_ModelFields _panel_modelfields in fields) { if (_panel_modelfields.Visible == "N") continue; UD_ModelFields _modelfieldsmodel = new UD_ModelFieldsBLL(_panel_modelfields.FieldID, true).Model; UD_TableList _tablemodel = new UD_TableListBLL(_modelfieldsmodel.TableID, true).Model; #region 判断该控件是否已存在 if (_htFieldControlsInfo.Contains(_tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName)) continue; #endregion #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = _tablestyles[1]; tc_displayname.InnerText = string.IsNullOrEmpty(_panel_modelfields.LabelText) ? _modelfieldsmodel.DisplayName : _panel_modelfields.LabelText; if (tc_displayname.InnerText.Length <= 6) tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; else tc_displayname.Attributes["Style"] = "width: 100px; height: 18px;"; tc_displayname.Attributes["nowrap"] = "nowrap"; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = _tablestyles[2]; if (_panel_modelfields.ColSpan > 0) { if (i + _panel_modelfields.ColSpan <= FieldCount) { tc_control.ColSpan = 2 * _panel_modelfields.ColSpan - 1; i = i + _panel_modelfields.ColSpan; } else { tc_control.ColSpan = 2 * (FieldCount - i) - 1; i = 0; } } else { i++; } WebControl control = null; int RelationType = _modelfieldsmodel.RelationType; string RelationTableName = _modelfieldsmodel.RelationTableName; string RelationValueField = _modelfieldsmodel.RelationValueField; string RelationTextField = _modelfieldsmodel.RelationTextField; #region 根据控件类型生成相应的控件 switch (_panel_modelfields.ControlType) { case 1://Label control = new Label(); break; case 2://TextBox control = new TextBox(); if (_modelfieldsmodel.DataType == 4) { control.Attributes["onfocus"] = "WdatePicker();"; } break; case 3://DropDownList control = new DropDownList(); if (RelationType == 1)//Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); if (_modelfieldsmodel.DataType != 5) ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); else ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); break; case 4://RadioButtonList control = new RadioButtonList(); if (RelationType == 1)//Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) ((RadioButtonList)control).SelectedIndex = 0; break; case 5://MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; if (_panel_modelfields.ControlHeight > 0) ((TextBox)control).Height = new Unit(_panel_modelfields.ControlHeight); break; case 6://TextBox supports search control = new MCSSelectControl(); if (RelationType == 2)//Relation to the model table { control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; if (_panel_modelfields.SearchPageURL != "") ((MCSSelectControl)control).PageUrl = _panel_modelfields.SearchPageURL; else if (_modelfieldsmodel.SearchPageURL != "") ((MCSSelectControl)control).PageUrl = _modelfieldsmodel.SearchPageURL; } break; case 7://MCSTreeControl control = new MCSTreeControl(); if (RelationType == 2)//Relation to the model table { control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; if (_modelfieldsmodel.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取所能管辖的片区 if (System.Web.HttpContext.Current.Session["AccountType"] == null || (int)System.Web.HttpContext.Current.Session["AccountType"] == 1) { //员工 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = "0"; } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } } else if ((int)System.Web.HttpContext.Current.Session["AccountType"] == 2 && System.Web.HttpContext.Current.Session["OrganizeCity"] != null) { //商业客户 int city = (int)System.Web.HttpContext.Current.Session["OrganizeCity"]; Addr_OrganizeCityBLL citybll = new Addr_OrganizeCityBLL(city); ((MCSTreeControl)control).DataSource = citybll.GetAllChildNodeIncludeSelf(); ((MCSTreeControl)control).RootValue = citybll.Model.SuperID.ToString(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = city.ToString(); } #endregion } else if (_modelfieldsmodel.RelationTableName == "MCS_SYS.dbo.Addr_OfficialCity") { ((MCSTreeControl)control).TableName = "MCS_SYS.dbo.Addr_OfficialCity"; ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = "0"; } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; } } break; } #endregion control.ID = _tablemodel.ModelClassName + "_" + _modelfieldsmodel.FieldName; control.Enabled = _panel_modelfields.Enable.ToUpper() == "Y"; if (_panel_modelfields.ControlWidth > 0) control.Width = _panel_modelfields.ControlWidth; tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (_panel_modelfields.IsRequireField == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = " *"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } if (_panel_modelfields.ControlType == 2 || _panel_modelfields.ControlType == 5) { if (_panel_modelfields.IsRequireField == "Y") { RequiredFieldValidator _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; _requiredfieldvalidator.ValidationGroup = _validationgroup; tc_control.Controls.Add(_requiredfieldvalidator); } if (_panel_modelfields.RegularExpression != "") { RegularExpressionValidator _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = _panel_modelfields.RegularExpression; _regularexpressionvalidator.ValidationGroup = ValidationGroup; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } else { if (_modelfieldsmodel.DataType == 1 || _modelfieldsmodel.DataType == 2 || _modelfieldsmodel.DataType == 4) //非varchar 字符串 { CompareValidator _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; _comparevalidator.ValidationGroup = _validationgroup; if (_modelfieldsmodel.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (_modelfieldsmodel.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (_modelfieldsmodel.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } } } #endregion if (!string.IsNullOrEmpty(_panel_modelfields.Description)) { Label lb = new Label(); lb.Text = " " + _panel_modelfields.Description; tc_control.Controls.Add(lb); } tr_panel_detail.Cells.Add(tc_control); #endregion #region 将控件记录到字段控件HashTable中 FieldControlInfo fieldcontrolinfo = new FieldControlInfo(); fieldcontrolinfo.FieldID = _modelfieldsmodel.ID; fieldcontrolinfo.FieldName = _modelfieldsmodel.FieldName; fieldcontrolinfo.ModelName = _tablemodel.ModelClassName; fieldcontrolinfo.ControlType = _panel_modelfields.ControlType; fieldcontrolinfo.ControlName = control.ID; fieldcontrolinfo.DisplayMode = _panel_modelfields.DisplayMode; fieldcontrolinfo.Panel_Field_ID = _panel_modelfields.ID; _htFieldControlsInfo.Add(fieldcontrolinfo.ControlName, fieldcontrolinfo); #endregion } #endregion tc_panel.Controls.Add(tb_panel_content); tr_panel.Cells.Add(tc_panel); T_Content.Rows.Add(tr_panel); } ViewState["FieldControlsInfo"] = _htFieldControlsInfo; }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { Hashtable _htDataObjectdControlsInfo = new Hashtable(); HtmlTable T_Content = new HtmlTable(); T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); HtmlTableRow T_tr_title = new HtmlTableRow(); HtmlTableCell T_tc_title = new HtmlTableCell(); T_tr_title.Cells.Add(T_tc_title); T_Content.Rows.Add(T_tr_title); #region The title of the panel HtmlTable tb_title = new HtmlTable(); T_tc_title.Controls.Add(tb_title); tb_title.CellPadding = 0; tb_title.CellSpacing = 0; tb_title.Width = "100%"; tb_title.Height = "30px"; tb_title.Border = 0; tb_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_title = new HtmlTableRow(); HtmlTableCell tc_title = new HtmlTableCell(); tr_title.Cells.Add(tc_title); tb_title.Rows.Add(tr_title); tc_title.InnerHtml = "<h3>工作流提交的数据字段内容</h3>"; #endregion #region The content of the panel HtmlTableRow T_tr_panelcontent = new HtmlTableRow(); T_tr_panelcontent.ID = "T_tr_panelcontent"; HtmlTableCell T_tc_panelcontent = new HtmlTableCell(); T_tr_panelcontent.Cells.Add(T_tc_panelcontent); T_Content.Rows.Add(T_tr_panelcontent); HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = "tabForm"; T_tc_panelcontent.Controls.Add(tb_panel_content); IList <EWF_Flow_DataObject> _dataobjects = new EWF_Flow_AppBLL(App).GetDataObjectList(); int i = 0; foreach (EWF_Flow_DataObject _dataobject in _dataobjects) { if (_dataobject.Visible == "N") { continue; } #region 判断该控件是否已存在 if (_htDataObjectdControlsInfo.Contains(_dataobject.Name)) { continue; } #endregion #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = "dataLabel"; tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; tc_displayname.Attributes["nowrap"] = "nowrap"; tc_displayname.InnerText = _dataobject.DisplayName; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = "dataField"; if (_dataobject.ColSpan > 0) { if (i + _dataobject.ColSpan <= FieldCount) { tc_control.ColSpan = 2 * _dataobject.ColSpan - 1; i = i + _dataobject.ColSpan; } else { tc_control.ColSpan = 2 * (FieldCount - i) - 1; i = 0; } } else { i++; } WebControl control = null; int RelationType = _dataobject.RelationType; string RelationTableName = _dataobject.RelationTableName; string RelationValueField = _dataobject.RelationValueField; string RelationTextField = _dataobject.RelationTextField; #region 根据控件类型生成相应的控件 switch (_dataobject.ControlType) { case 1: //Label control = new Label(); break; case 2: //TextBox control = new TextBox(); if (_dataobject.DataType == 4) { control.Attributes["onfocus"] = "setday(this);"; } break; case 3: //DropDownList control = new DropDownList(); if (RelationType == 1) //Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); break; case 4: //RadioButtonList control = new RadioButtonList(); if (RelationType == 1) //Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) { ((RadioButtonList)control).SelectedIndex = 0; } break; case 5: //MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; if (_dataobject.ControlHeight > 0) { ((TextBox)control).Height = new Unit(_dataobject.ControlHeight); } break; case 6: //TextBox supports search control = new MCSSelectControl(); control.ID = "C_" + _dataobject.Name.ToString(); if (RelationType == 2) //Relation to the model table { ((MCSSelectControl)control).PageUrl = _dataobject.SearchPageURL; } break; case 7: //MCSTreeControl control = new MCSTreeControl(); if (RelationType == 2) //Relation to the model table { control.ID = "C_" + _dataobject.Name.ToString(); //在设置控件DataSource之前,必须要有ID属性 Shen Gang 20090110 if (_dataobject.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } } #endregion } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; } } break; } #endregion control.ID = "C_" + _dataobject.Name.ToString(); control.Enabled = _dataobject.Enable.ToUpper() == "Y"; control.ToolTip = _dataobject.Description; if (_dataobject.ControlWidth > 0) { control.Width = _dataobject.ControlWidth; } tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (_dataobject.IsRequireField == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = "*"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } //add validate control for the textbox if (_dataobject.ControlType == 2 || _dataobject.ControlType == 5) { RequiredFieldValidator _requiredfieldvalidator = null; CompareValidator _comparevalidator = null; RegularExpressionValidator _regularexpressionvalidator = null; if (_dataobject.IsRequireField == "Y") { _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; _requiredfieldvalidator.ValidationGroup = _validationgroup; tc_control.Controls.Add(_requiredfieldvalidator); } if (_dataobject.DataType == 1 || _dataobject.DataType == 2 || _dataobject.DataType == 4) //非varchar 字符串 { _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; _comparevalidator.ValidationGroup = _validationgroup; if (_dataobject.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (_dataobject.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (_dataobject.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } else { if (_dataobject.RegularExpression != "") { _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = _dataobject.RegularExpression; _regularexpressionvalidator.ValidationGroup = ValidationGroup; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } } } #endregion tr_panel_detail.Cells.Add(tc_control); #endregion #region Record the info of the control created DataObjectControlInfo dataobjectcontrolinfo = new DataObjectControlInfo(); dataobjectcontrolinfo.ControlName = control.ID; dataobjectcontrolinfo.ControlType = _dataobject.ControlType; dataobjectcontrolinfo.DataObjectID = _dataobject.ID; dataobjectcontrolinfo.DataObjectName = _dataobject.Name; _htDataObjectdControlsInfo.Add(dataobjectcontrolinfo.DataObjectName, dataobjectcontrolinfo); #endregion } #endregion ViewState["HTDataObjectControlInfo"] = _htDataObjectdControlsInfo; if (new EWF_Flow_AppBLL(App).Model.RelateBusiness.ToUpper() == "Y") { SetPanelEnable(false); } }
protected void Page_Load(object sender, System.EventArgs e) { #region 获取界面控件 tr_OfficialCity = UC_DetailView1.FindControl("PM_Promotor_OfficialCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OfficialCity"); tr_OrganizeCity = UC_DetailView1.FindControl("PM_Promotor_OrganizeCity") == null ? null : (MCSTreeControl)UC_DetailView1.FindControl("PM_Promotor_OrganizeCity"); txt_IDCode = UC_DetailView1.FindControl("PM_Promotor_IDCode") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_IDCode"); txt_Name = UC_DetailView1.FindControl("PM_Promotor_Name") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_Name"); txt_AccountName = UC_DetailView1.FindControl("PM_Promotor_AccountName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountName"); ddl_BankType = UC_DetailView1.FindControl("PM_Promotor_BankType") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_BankType"); txt_BankName = UC_DetailView1.FindControl("PM_Promotor_BankName") == null ? null : (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName"); ddl_Classify = UC_DetailView1.FindControl("PM_Promotor_Classfiy") == null ? null : (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Classfiy"); if (ddl_BankType != null) { ddl_BankType.AutoPostBack = true; ddl_BankType.SelectedIndexChanged += new EventHandler(ddl_BankType_SelectedIndexChanged); } if (ddl_Classify != null) { ddl_Classify.AutoPostBack = true; ddl_Classify.SelectedIndexChanged += new EventHandler(ddl_Classify_SelectedIndexChanged); } if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += new SelectedEventHandler(tr_OrganizeCity_Selected); } if (txt_IDCode != null) { txt_IDCode.AutoPostBack = true; txt_IDCode.TextChanged += new EventHandler(txt_IDCode_TextChanged); } if (txt_Name != null) { txt_Name.AutoPostBack = true; txt_Name.TextChanged += new EventHandler(txt_Name_TextChanged); } #endregion if (!Page.IsPostBack) { ViewState["PromotorID"] = Request.QueryString["PromotorID"] == null ? 0 : int.Parse(Request.QueryString["PromotorID"]); if ((int)ViewState["PromotorID"] > 0) { BindDropDown(); BindData(); UploadFile1.RelateID = (int)ViewState["PromotorID"]; UploadFile1.BindGrid(); } else { Org_Staff s = new Org_StaffBLL((int)Session["UserID"]).Model; if (s != null) { if (tr_OfficialCity != null) tr_OfficialCity.SelectValue = s.OfficialCity.ToString(); if (tr_OrganizeCity != null) tr_OrganizeCity.SelectValue = s.OrganizeCity.ToString(); } DropDownList ddl_SalaryFlag = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_SalaryFlag"); if (ddl_SalaryFlag != null) ddl_SalaryFlag.SelectedValue = "1"; DropDownList ddl_Dimission = (DropDownList)UC_DetailView1.FindControl("PM_Promotor_Dimission"); if (ddl_Dimission != null) { ddl_Dimission.Enabled = false; ddl_Dimission.SelectedValue = "1"; } TextBox tbx_EndWorkDate = (TextBox)UC_DetailView1.FindControl("PM_Promotor_EndWorkDate"); if (tbx_EndWorkDate != null) tbx_EndWorkDate.Enabled = false; tbl_Promotor.Visible = false; UploadFile1.Visible = false; gv_list.Visible = false; bt_AddApply.Visible = false; bt_Approve.Visible = false; bt_RevocationApply.Visible = false; } //根据管理片区,获取可用的薪酬级别 tr_OrganizeCity_Selected(null, null); } #region 给账号/开户行文本框添加事件 //TextBox tbx_BankName = (TextBox)UC_DetailView1.FindControl("PM_Promotor_BankName"); //tbx_BankName.AutoPostBack = true; //tbx_BankName.TextChanged += new EventHandler(tbx_Bank_TextChanged); TextBox tbx_BankAccountNo = (TextBox)UC_DetailView1.FindControl("PM_Promotor_AccountCode"); tbx_BankAccountNo.AutoPostBack = true; tbx_BankAccountNo.TextChanged += new EventHandler(tbx_Bank_TextChanged); #endregion if ((int)ViewState["PromotorID"] == 0) { MCSTabControl1.Items[1].Visible = false; } string script = "function PopPMClassify_Approve(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/PM/PMClassify_Approve.aspx?PromotorID=' + id ") + ", window, 'dialogWidth:930px;DialogHeight=600px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopPMClassify_Approve", script, true); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 获取页面参数 ViewState["InventoryID"] = Request.QueryString["InventoryID"] == null ? 0 : int.Parse(Request.QueryString["InventoryID"]); ViewState["ClientID"] = Request.QueryString["ClientID"] == null ? 0 : int.Parse(Request.QueryString["ClientID"]); ViewState["IsCXP"] = Request.QueryString["IsCXP"] == null ? false : int.Parse(Request.QueryString["IsCXP"]) != 0; //是否是赠品销量录入 0:成品 1:赠品 #endregion ViewState["EditEnable"] = true; if ((int)ViewState["InventoryID"] != 0) { if (Request.QueryString["Flag"] == null) { cb_OnlyDisplayUnZero.Checked = true; } BindData(); btn_Inventory.Visible = false; TextBox tbx_InventoryDate = UC_DetailView1.FindControl("SVM_Inventory_InventoryDate") != null ? (TextBox)UC_DetailView1.FindControl("SVM_Inventory_InventoryDate") : null; } else { if ((int)ViewState["ClientID"] == 0) { Response.Redirect("InventoryList.aspx"); } #region 新增库存 CM_Client c = new CM_ClientBLL((int)ViewState["ClientID"]).Model; MCSSelectControl select_Client = (MCSSelectControl)UC_DetailView1.FindControl("SVM_Inventory_Client"); if (select_Client != null) { select_Client.SelectValue = ViewState["ClientID"].ToString(); select_Client.SelectText = c.FullName; select_Client.Enabled = false; } MCSTreeControl tr_OrganizeCity = (MCSTreeControl)UC_DetailView1.FindControl("SVM_Inventory_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = c.OrganizeCity.ToString(); tr_OrganizeCity.Enabled = false; } DropDownList ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_Inventory_AccountMonth"); if (ddl_Month != null) { double JXCDelayDays = Convert.ToDouble(System.Configuration.ConfigurationManager.AppSettings["JXCDelayDays"]); ddl_Month.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(-JXCDelayDays)).ToString(); } #region 判断是否有未审核销售 //if (c.ClientType == 2 && SVM_SalesVolumeBLL.GetModelList("Supplier=" + c.ID.ToString() + " AND ApproveFlag=2 AND AccountMonth=" + ddl_Month.SelectedValue).Count > 0) //{ // MessageBox.ShowAndRedirect(this, "该经销商本月还有未审核销量,请先审核销量再作此操作。", "SalesVolumeList.aspx?Type=2&SellOutClientID=" + c.ID.ToString()); // return; //} #endregion TextBox tbx_InventoryDate = (TextBox)UC_DetailView1.FindControl("SVM_Inventory_InventoryDate"); if (tbx_InventoryDate != null) { tbx_InventoryDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); } bt_Del.Visible = false; bt_Save.Visible = false; bt_Approve.Visible = false; bt_Submit.Visible = false; bt_Approve.Visible = false; bt_Re_Approve.Visible = false; tb_AddProduct.Visible = false; #endregion } BindDropDown(); #region 确定页面权限 if ((int)ViewState["ClientID"] != 0) { CM_Client _r = new CM_ClientBLL((int)ViewState["ClientID"]).Model; ViewState["ClientType"] = _r.ClientType; if (_r.ClientType == 3) { Header.Attributes["WebPageSubCode"] += "ClientType=3"; bt_Submit.Enabled = false; ViewState["EditEnable"] = false; lbl_Notice.Text = "请以最小单位数量填报"; } else if (_r.ClientType == 2) { Header.Attributes["WebPageSubCode"] += "ClientType=2&DIClassify=" + _r["DIClassify"]; } } #endregion } }
protected void Page_Load(object sender, System.EventArgs e) { #region 给行政城市加事件 tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { tr_OfficialCity.AutoPostBack = true; tr_OfficialCity.Selected += tr_OfficialCity_Selected; } tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; } tr_Channel = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_Channel"); if (tr_Channel != null) { tr_Channel.AutoPostBack = true; tr_Channel.Selected += tr_Channel_Selected; } #endregion // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion Session["MCSMenuControl_FirstSelectIndex"] = "11"; BindDropDown(); if (ViewState["ClientID"] != null) { BindData(); } else if (Request.QueryString["Mode"] == "New") { #region 新增门店时的初始值 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) ddl_ActiveFlag.SelectedValue = "1"; TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_Client_OpenTime"); if (tbx_OpenTime != null) tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); bt_Approve.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在‘零售商列表’中选择要查看的零售商!", "RetailerList.aspx?URL=" + Request.Url.PathAndQuery); } } #region 给活跃标志加事件 //DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); //ddl_ActiveFlag_1.AutoPostBack = true; //ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion //TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); //tbx_Code.AutoPostBack = true; //tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); #region 注册弹出窗口脚本 string script = "function PopReplaceClientManager(id,clienttype){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceClientManager.aspx") + "?ClientManager=' + id + '&ClientType='+clienttype+'&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceClientManager", script, true); script = "function Pop_SetPrimaryAccount(client){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("~/SubModule/RM/AccountOpen/Pop_SetPrimaryAccount.aspx") + "?Client=' + client + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=400px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "Pop_SetPrimaryAccount", script, true); script = "function Pop_MapShow(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.open('" + Page.ResolveClientUrl("../Map/ClientInMap.aspx") + "?ClientID=' + id + '&tempid='+tempid);}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopShow", script, true); #endregion }
protected void Page_Load(object sender, System.EventArgs e) { #region 给行政城市加事件 tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { tr_OfficialCity.AutoPostBack = true; tr_OfficialCity.Selected += tr_OfficialCity_Selected; } tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; } #endregion if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion Session["MCSMenuControl_FirstSelectIndex"] = "12"; BindDropDown(); if (ViewState["ClientID"] != null) { BindData(); } else if (Request.QueryString["Mode"] == "New") { //新增客户时的初始值 DropDownList ddl_State = (DropDownList)pl_detail.FindControl("CM_ClientManufactInfo_State"); if (ddl_State != null) { ddl_State.SelectedValue = "1"; } TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_ClientManufactInfo_BeginDate"); if (tbx_OpenTime != null) { tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } } } #region 给活跃标志加事件 //DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); //ddl_ActiveFlag_1.AutoPostBack = true; //ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion #region 给判断重复编码加事件 //TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); //tbx_Code.AutoPostBack = true; //tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Request.QueryString["Mode"] != "New" && Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion if (ViewState["ClientID"] != null) { BindData(); BindDropDown(); } else if (Request.QueryString["Mode"] == "New") { #region 新增物业时的初始值 Org_Staff staff = new Org_StaffBLL((int)Session["UserID"]).Model; if (staff == null) { Response.Redirect("~/SubModule/Desktop.aspx"); } #region 新增客户时,详细资料界面控件初始化 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) { ddl_ActiveFlag.SelectedValue = "4"; } MCSTreeControl tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = staff.OrganizeCity.ToString(); } MCSTreeControl tr_OfficalCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity"); if (tr_OfficalCity != null) { tr_OfficalCity.SelectValue = staff.OfficialCity.ToString(); } #endregion bt_Approve.Visible = false; tr_Contract.Visible = false; tr_Staff.Visible = false; tr_PropertyInOrganizeCity.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在物业列表’中选择要查看的物业!", "PropertyList.aspx?URL=" + Request.Url.PathAndQuery); } } }
protected void Page_Load(object sender, System.EventArgs e) { CM_Client_Classification = pl_detail.FindControl("CM_Client_Classification") != null ? (DropDownList)pl_detail.FindControl("CM_Client_Classification") : null; // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion //Session["MCSMenuControl_FirstSelectIndex"] = "11"; if (ViewState["ClientID"] != null) { BindData(); BindDropDown(); } else if (Request.QueryString["Mode"] == "New") { #region 新增门店时的初始值 Org_Staff staff = new Org_StaffBLL((int)Session["UserID"]).Model; if (staff == null) Response.Redirect("~/SubModule/Desktop.aspx"); #region 新增客户时,详细资料界面控件初始化 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) ddl_ActiveFlag.SelectedValue = "4"; TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_Client_OpenTime"); if (tbx_OpenTime != null) tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); MCSTreeControl tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OrganizeCity"); if (tr_OrganizeCity != null) tr_OrganizeCity.SelectValue = staff.OrganizeCity.ToString(); MCSTreeControl tr_OfficalCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity"); if (tr_OfficalCity != null) tr_OfficalCity.SelectValue = staff.OfficialCity.ToString(); MCSSelectControl select_ClientManager = (MCSSelectControl)pl_detail.FindControl("CM_Client_ClientManager"); if (select_ClientManager != null) { select_ClientManager.SelectText = staff.RealName; select_ClientManager.SelectValue = staff.ID.ToString(); } DropDownList ddl_ChiefLinkMan = pl_detail.FindControl("CM_Client_ChiefLinkMan") != null ? (DropDownList)pl_detail.FindControl("CM_Client_ChiefLinkMan") : null; if (ddl_ChiefLinkMan != null) { ddl_ChiefLinkMan.Items.Clear(); ddl_ChiefLinkMan.Enabled = false; } DropDownList ddl_RTClassify = (DropDownList)pl_detail.FindControl("CM_Client_RTClassify"); if (ddl_RTClassify != null) { if (ddl_RTClassify.Items.FindByValue("1") != null) ddl_RTClassify.SelectedValue = "1"; } #endregion bt_AddLinkMan.Visible = false; bt_Approve.Visible = false; tr_Contract.Visible = false; tr_LinkMan.Visible = false; tr_Promotor.Visible = false; bt_Analysis.Visible = false; bt_AddApply.Visible = false; bt_RevocationApply.Visible = false; bt_Record.Visible = false; bt_ReplaceClientManager.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在‘零售商列表’中选择要查看的零售商!", "RetailerList.aspx?URL=" + Request.Url.PathAndQuery); } } #region 给活跃标志加事件 DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); ddl_ActiveFlag_1.AutoPostBack = true; ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); tbx_Code.AutoPostBack = true; tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); CM_Client_MarketType = pl_detail.FindControl("CM_Client_MarketType") != null ? (DropDownList)pl_detail.FindControl("CM_Client_MarketType") as DropDownList : null; CM_Client_OfficalCity = pl_detail.FindControl("CM_Client_OfficalCity") != null ? (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity") : null; if (CM_Client_OfficalCity != null) { CM_Client_OfficalCity.AutoPostBack = true; CM_Client_OfficalCity.Selected += new SelectedEventHandler(CM_Client_OfficalCity_Selected); } TextBox tbx_FullName = pl_detail.FindControl("CM_Client_FullName") == null ? null : (TextBox)pl_detail.FindControl("CM_Client_FullName"); if (tbx_FullName != null) { tbx_FullName.AutoPostBack = true; tbx_FullName.TextChanged += new EventHandler(tbx_FullName_TextChanged); } #region 注册弹出窗口脚本 string script = "function PopReplaceClientManager(id,clienttype){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceClientManager.aspx") + "?ClientManager=' + id + '&ClientType='+clienttype+'&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceClientManager", script, true); #endregion //ddl_RTChannel = pl_detail.FindControl("CM_Client_RTChannel") as DropDownList; //ddl_RTChannel.AutoPostBack = true; //ddl_RTChannel.SelectedIndexChanged += new EventHandler(ddl_RTChannel_SelectedIndexChanged); DropDownList ddl_IsRMSClient = pl_detail.FindControl("CM_Client_IsRMSClient") as DropDownList; //ddl_IsRMSClient.AutoPostBack = true; //ddl_IsRMSClient.SelectedIndexChanged += new EventHandler(ddl_IsRMSClient_SelectedIndexChanged); //foreach (ListItem item in ddl_IsRMSClient.Items) //{ // if (item.Value == "1" && item.Text == "已启动") // { // item.Attributes.Add("disabled", "true"); // } //} //非"雅慧电商"的流通店 不允许选择积分店状态 //DropDownList ddl_RTClassifyTemp = pl_detail.FindControl("CM_Client_RTClassify") as DropDownList; //if (ddl_RTClassifyTemp != null && ddl_RTClassifyTemp.SelectedValue == "1" && ddl_RTChannel.SelectedValue != "20") //{ // ddl_IsRMSClient.SelectedValue = "2"; // ddl_IsRMSClient.Enabled = false; // DropDownList ddl_RMSAccountEnabled = pl_detail.FindControl("CM_Client_RMSAccountEnabled") as DropDownList; // ddl_RMSAccountEnabled.SelectedValue = "2"; //} //this.ddl_RMSAccountEnabled_Select(); //this.ShowRMSCloseDate(); }
public void BindDropDown() { #region 业务人员 DropDownList ddlSalesMan = pl_detail.FindControl("CM_ClientSupplierInfo_Salesman") as DropDownList; if (ddlSalesMan != null) { ddlSalesMan.DataTextField = "RealName"; ddlSalesMan.DataValueField = "ID"; IList <Org_Staff> listStaff = Org_StaffBLL.GetStaffList("Dimission=1 AND Position=1030 AND OwnerClient= " + Session["OwnerClient"].ToString()); if (listStaff == null) { listStaff = new List <Org_Staff>(1); } listStaff.Insert(0, new Org_Staff { RealName = "请选择", ID = 0 }); ddlSalesMan.DataSource = listStaff; ddlSalesMan.DataBind(); } #endregion #region 经销商自分渠道 DropDownList ddlTDPChannel = pl_detail.FindControl("CM_ClientSupplierInfo_TDPChannel") as DropDownList; if (ddlTDPChannel != null) { ddlTDPChannel.DataTextField = "Name"; ddlTDPChannel.DataValueField = "ID"; IList <CM_RTChannel_TDP> listChannel = CM_RTChannel_TDPBLL.GetModelList("OwnerClient= " + Session["OwnerClient"].ToString()); if (listChannel == null) { listChannel = new List <CM_RTChannel_TDP>(1); } listChannel.Insert(0, new CM_RTChannel_TDP { Name = "请选择", ID = 0 }); ddlTDPChannel.DataSource = listChannel; ddlTDPChannel.DataBind(); } #endregion #region 经销商所属区域 DropDownList ddlTDPSalesArea = pl_detail.FindControl("CM_ClientSupplierInfo_TDPSalesArea") as DropDownList; if (ddlTDPSalesArea != null) { ddlTDPSalesArea.DataTextField = "Name"; ddlTDPSalesArea.DataValueField = "ID"; IList <CM_RTSalesArea_TDP> listSalesArea = CM_RTSalesArea_TDPBLL.GetModelList("OwnerClient= " + Session["OwnerClient"].ToString()); if (listSalesArea == null) { listSalesArea = new List <CM_RTSalesArea_TDP>(1); } listSalesArea.Insert(0, new CM_RTSalesArea_TDP { Name = "请选择", ID = 0 }); ddlTDPSalesArea.DataSource = listSalesArea; ddlTDPSalesArea.DataBind(); } #endregion #region 经销商价表 DropDownList ddlStandardPrice = pl_detail.FindControl("CM_ClientSupplierInfo_StandardPrice") as DropDownList; if (ddlStandardPrice != null) { ddlStandardPrice.DataTextField = "Name"; ddlStandardPrice.DataValueField = "ID"; IList <PDT_StandardPrice> listPrice = PDT_StandardPriceBLL.GetAllPrice_BySupplier((int)Session["OwnerClient"]); if (listPrice == null) { listPrice = new List <PDT_StandardPrice>(1); } listPrice.Insert(0, new PDT_StandardPrice { Name = "请选择", ID = 0 }); ddlStandardPrice.DataSource = listPrice; ddlStandardPrice.DataBind(); } #endregion #region 经销商自营路线 DropDownList ddlVisitRoute = pl_detail.FindControl("CM_ClientSupplierInfo_VisitRoute") as DropDownList; if (ddlVisitRoute != null) { ddlVisitRoute.DataTextField = "Name"; ddlVisitRoute.DataValueField = "ID"; IList <VST_Route> listRoute = VST_RouteBLL.GetRouteListByTDP((int)Session["OwnerClient"]); listRoute.Insert(0, new VST_Route { Name = "请选择", ID = 0 }); ddlVisitRoute.DataSource = listRoute; ddlVisitRoute.DataBind(); } #endregion #region 行政城市默认为厂商所在省份 MCSTreeControl tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { if ((int)Session["Manufacturer"] > 0) { CM_Client c = new CM_ClientBLL((int)Session["Manufacturer"]).Model; if (c != null) { int prov = TreeTableBLL.GetSuperIDByLevel("MCS_SYS.dbo.Addr_OfficialCity", c.OfficialCity, 1); tr_OfficialCity.RootValue = prov.ToString(); } } } #endregion }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { if (DataSet == Guid.Empty) { return; } IList <Rpt_DataSetParams> paramfields = new Rpt_DataSetBLL(DataSet, true).GetParams(); if (paramfields.Count == 0) { return; //无参数 } HtmlTable T_Content = new HtmlTable(); string[] tablestyles = new string[] { "tabForm", "dataLabel", "dataField" }; T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); HtmlTableRow tr_panel = new HtmlTableRow();//Create one TableRow for a panel tr_panel.ID = "DataSetParamPanel"; HtmlTableCell tc_panel = new HtmlTableCell(); #region The title of the panel HtmlTable tb_panel_title = new HtmlTable(); tb_panel_title.CellPadding = 0; tb_panel_title.CellSpacing = 0; tb_panel_title.Width = "100%"; tb_panel_title.Height = "28px"; tb_panel_title.Border = 0; tb_panel_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_panel_title = new HtmlTableRow(); HtmlTableCell tc_panel_title = new HtmlTableCell(); tc_panel_title.InnerHtml = "<h3>请设置统计报表参数信息</h3>"; tr_panel_title.Cells.Add(tc_panel_title); tb_panel_title.Rows.Add(tr_panel_title); tc_panel.Controls.Add(tb_panel_title); #endregion #region The content of the panel int FieldCount = 3; HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = tablestyles[0]; int i = 0; foreach (Rpt_DataSetParams param in paramfields) { string ControlID = "Param_" + param.ParamName.Replace("@", ""); //判断该控件是否已存在 if (ParamControlsInfo.ContainsKey(ControlID)) { continue; } ParamControlsInfo.Add(ControlID, param); if (param.Visible == "Y") { #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = tablestyles[1]; tc_displayname.InnerText = param.DisplayName; if (tc_displayname.InnerText.Length <= 6) { tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; } else { tc_displayname.Attributes["Style"] = "width: 100px; height: 18px;"; } tc_displayname.Attributes["nowrap"] = "nowrap"; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = tablestyles[2]; i++; WebControl control = null; int RelationType = param.RelationType; string RelationTableName = param.RelationTableName; string RelationValueField = param.RelationValueField; string RelationTextField = param.RelationTextField; #region 根据控件类型生成相应的控件 switch (param.ControlType) { case 1: //Label control = new Label(); ((Label)control).Text = GetDefaule(param.DefaultValue); break; case 2: //TextBox control = new TextBox(); if (param.DataType == 4) { control.Attributes["onfocus"] = "WdatePicker();"; } ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 3: //DropDownList control = new DropDownList(); if (RelationType == 1) //Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); if (param.DataType != 5) { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); } else { ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); } if (param.DefaultValue != "") { if (((DropDownList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) { ((DropDownList)control).SelectedValue = GetDefaule(param.DefaultValue); } } break; case 4: //RadioButtonList control = new RadioButtonList(); if (RelationType == 1) //Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2) //Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else { break; } ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) { ((RadioButtonList)control).SelectedIndex = 0; } if (param.DefaultValue != "") { if (((RadioButtonList)control).Items.FindByValue(GetDefaule(param.DefaultValue)) != null) { ((RadioButtonList)control).SelectedValue = GetDefaule(param.DefaultValue); } } break; case 5: //MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; ((TextBox)control).Text = GetDefaule(param.DefaultValue); break; case 6: //TextBox supports search control = new MCSSelectControl(); control.ID = ControlID; if (param.SearchPageURL != "") { ((MCSSelectControl)control).PageUrl = param.SearchPageURL; } if (param.DefaultValue != "") { control.Init += new EventHandler(control_Init); } break; case 7: //MCSTreeControl control = new MCSTreeControl(); control.ID = ControlID; if (param.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } } #endregion } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) { ((MCSTreeControl)control).SelectValue = "0"; } } if (param.DefaultValue != "") { if (((MCSTreeControl)control).SelectValue == "0" || ((MCSTreeControl)control).SelectValue == "") { ((MCSTreeControl)control).SelectValue = GetDefaule(param.DefaultValue); } } break; } #endregion control.ID = ControlID; control.Enabled = param["Enable"] != "N"; int controlwidth = 0; if (int.TryParse(param["ControlWidth"], out controlwidth)) { control.Width = new Unit(controlwidth); } tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (param["IsRequireField"] == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = " *"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } if (param.ControlType == 2 || param.ControlType == 5) { if (param["IsRequireField"] == "Y") { RequiredFieldValidator _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(_requiredfieldvalidator); } if (param.DataType == 1 || param.DataType == 2 || param.DataType == 4) //非varchar 字符串 { CompareValidator _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; if (param.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (param.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (param.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } else { if (param.RegularExpression != "") { RegularExpressionValidator _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = param.RegularExpression; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } } } #endregion tr_panel_detail.Cells.Add(tc_control); #endregion } } #endregion tc_panel.Controls.Add(tb_panel_content); tr_panel.Cells.Add(tc_panel); T_Content.Rows.Add(tr_panel); }
protected void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (!Page.IsPostBack) { #region 获取页面参数 ViewState["ID"] = Request.QueryString["ID"] != null ? new Guid(Request.QueryString["ID"]) : Guid.Empty; ViewState["Folder"] = Request.QueryString["Folder"] != null?int.Parse(Request.QueryString["Folder"]) : 0; #endregion BindDropDown(); if ((Guid)ViewState["ID"] != Guid.Empty) { //修改 BindData(); } else { //新增 MCSTabControl1.Items[1].Visible = false; MCSTabControl1.Items[2].Visible = false; MCSTabControl1.Items[3].Visible = false; #region 限制报表目录为参数值 if ((int)ViewState["Folder"] == 0) { Response.Redirect("Rpt_ReportList.aspx"); } MCSTreeControl tr_Folder = (MCSTreeControl)pl_detail.FindControl("Rpt_Report_Folder"); DropDownList ddl_DataSet = (DropDownList)pl_detail.FindControl("Rpt_Report_DataSet"); if (tr_Folder != null && ddl_DataSet != null) { tr_Folder.SelectValue = ViewState["Folder"].ToString(); tr_Folder.Enabled = false; ddl_DataSet.DataValueField = "ID"; ddl_DataSet.DataTextField = "Name"; ddl_DataSet.DataSource = Rpt_DataSetBLL.GetDataByFolder((int)ViewState["Folder"], true); ddl_DataSet.DataBind(); ddl_DataSet.Items.Insert(0, new ListItem("请选择...", Guid.Empty.ToString())); } #endregion RadioButtonList rbl_AddRowTotal = (RadioButtonList)pl_detail.FindControl("Rpt_Report_AddRowTotal"); if (rbl_AddRowTotal != null) { rbl_AddRowTotal.SelectedValue = "N"; } RadioButtonList rbl_AddColumnTotal = (RadioButtonList)pl_detail.FindControl("Rpt_Report_AddColumnTotal"); if (rbl_AddColumnTotal != null) { rbl_AddColumnTotal.SelectedValue = "N"; } bt_ViewReport.Visible = false; bt_Delete.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 获取页面参数 ViewState["TargetID"] = Request.QueryString["TargetID"] == null ? 0 : int.Parse(Request.QueryString["TargetID"]); ViewState["ClientID"] = Request.QueryString["ClientID"] == null ? 0 : int.Parse(Request.QueryString["ClientID"]); #endregion BindDropDown(); if ((int)ViewState["TargetID"] != 0) { BindData(); btn_SalesTarget.Visible = false; } else { if ((int)ViewState["ClientID"] == 0) { Response.Redirect("SalesTarget.aspx"); } #region 新增销量目标 CM_Client c = new CM_ClientBLL((int)ViewState["ClientID"]).Model; MCSSelectControl select_Client = (MCSSelectControl)UC_DetailView1.FindControl("SVM_SalesTarget_Client"); if (select_Client != null) { select_Client.SelectValue = ViewState["ClientID"].ToString(); select_Client.SelectText = c.FullName; select_Client.Enabled = false; } MCSTreeControl tr_OrganizeCity = (MCSTreeControl)UC_DetailView1.FindControl("SVM_SalesTarget_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = c.OrganizeCity.ToString(); tr_OrganizeCity.Enabled = false; } DropDownList ddl_Month = (DropDownList)UC_DetailView1.FindControl("SVM_SalesTarget_AccountMonth"); if (ddl_Month != null) { ddl_Month.SelectedValue = AC_AccountMonthBLL.GetMonthByDate(DateTime.Now.AddDays(-7).AddMonths(1)).ToString(); } bt_Del.Visible = false; bt_Save.Visible = false; bt_Approve.Visible = false; #endregion } #region 确定页面权限 if ((int)ViewState["ClientID"] != 0) { CM_Client _r = new CM_ClientBLL((int)ViewState["ClientID"]).Model; ViewState["ClientType"] = _r.ClientType; if (_r.ClientType == 3) { Header.Attributes["WebPageSubCode"] += "ClientType=3"; } else if (_r.ClientType == 2) { Header.Attributes["WebPageSubCode"] += "ClientType=2&DIClassify=" + _r["DIClassify"]; } } #endregion } }
protected void Page_Load(object sender, System.EventArgs e) { if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion if (ViewState["ClientID"] != null) { BindData(); } else if (Request.QueryString["Mode"] == "New") { #region 新增客户时的初始值 Org_Staff staff = new Org_StaffBLL((int)Session["UserID"]).Model; if (staff == null) { Response.Redirect("~/SubModule/Desktop.aspx"); } #region 新增客户时,详细资料界面控件初始化 DropDownList ddl_ActiveFlag = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); if (ddl_ActiveFlag != null) { ddl_ActiveFlag.SelectedValue = "4"; } TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_Client_OpenTime"); if (tbx_OpenTime != null) { tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } MCSTreeControl tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.SelectValue = staff.OrganizeCity.ToString(); } MCSTreeControl tr_OfficalCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficalCity"); if (tr_OfficalCity != null) { tr_OfficalCity.SelectValue = staff.OfficialCity.ToString(); } MCSSelectControl select_ClientManager = (MCSSelectControl)pl_detail.FindControl("CM_Client_ClientManager"); if (select_ClientManager != null) { select_ClientManager.SelectText = staff.RealName; select_ClientManager.SelectValue = staff.ID.ToString(); } DropDownList ddl_ChiefLinkMan = (DropDownList)pl_detail.FindControl("CM_Client_ChiefLinkMan"); if (ddl_ChiefLinkMan != null) { ddl_ChiefLinkMan.Items.Clear(); ddl_ChiefLinkMan.Enabled = false; } DropDownList ddl_DIClassify = pl_detail.FindControl("CM_Client_DIClassify") == null ? null : (DropDownList)pl_detail.FindControl("CM_Client_DIClassify"); if (ddl_DIClassify != null) { ddl_DIClassify.SelectedValue = "2"; ddl_DIClassify.Enabled = false; } #endregion bt_Add.Enabled = false; bt_Approve.Visible = false; tbl_LinkMan.Visible = false; bt_Analysis.Visible = false; bt_AddApply.Visible = false; bt_RevocationApply.Visible = false; bt_Record.Visible = false; bt_ReplaceClientManager.Visible = false; bt_ReplaceSupplier.Visible = false; bt_DIACUpgrade.Visible = false; bt_ViewSubClient.Visible = false; bt_DIUP.Visible = false; #endregion } else { MessageBox.ShowAndRedirect(this, "请先在‘经销商列表’中选择要查看的经销商!", "DistributorList.aspx?URL=" + Request.Url.PathAndQuery); } } #region 给活跃标志加事件 DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); ddl_ActiveFlag_1.AutoPostBack = true; ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion #region 择经销商级别 一级则弹出仓库,二级则弹出经销商,并指定所属片区 MCSSelectControl select_Supplier = (MCSSelectControl)pl_detail.FindControl("CM_Client_Supplier"); //select_Supplier.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ExtCondition=ClientType in (1,2)"; MCSTreeControl select_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OrganizeCity"); DropDownList select_DIClassify = (DropDownList)pl_detail.FindControl("CM_Client_DIClassify"); select_DIClassify.AutoPostBack = true; int type = 0; type = select_DIClassify.SelectedIndex; switch (select_DIClassify.SelectedValue) { case "1": select_Supplier.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=1&OrganizeCity=" + select_OrganizeCity.SelectValue; //只可以选择仓库 break; case "2": case "3": select_Supplier.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType=2&ExtCondition=\"MCS_SYS.dbo.UF_Spilt(CM_Client.ExtPropertys,~|~,7)=1\"&OrganizeCity=" + select_OrganizeCity.SelectValue; break; default: select_Supplier.PageUrl = "~/SubModule/CM/PopSearch/Search_SelectClient.aspx?ClientType in (1,2)&OrganizeCity=" + select_OrganizeCity.SelectValue; //可以选择仓库及经销商 break; } #endregion #region 给判断重复编码加事件 TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); tbx_Code.AutoPostBack = true; tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); #endregion #region 给账号/开户行文本框添加事件 TextBox tbx_BankName = (TextBox)pl_detail.FindControl("CM_Client_BankName"); tbx_BankName.AutoPostBack = true; tbx_BankName.TextChanged += new EventHandler(tbx_Bank_TextChanged); TextBox tbx_BankAccountNo = (TextBox)pl_detail.FindControl("CM_Client_BankAccountNo"); tbx_BankAccountNo.AutoPostBack = true; tbx_BankAccountNo.TextChanged += new EventHandler(tbx_Bank_TextChanged); #endregion #region 注册弹出窗口脚本 string script = "function PopReplaceSupplier(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceSupplier.aspx") + "?Supplier=' + id + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceSupplier", script, true); script = "function PopReplaceSupplier2(id){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceSupplier.aspx") + "?Supplier2=' + id + '&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceSupplier2", script, true); script = "function PopReplaceClientManager(id,clienttype){\r\n"; script += "var tempid = Math.random() * 10000; \r\n window.showModalDialog('" + Page.ResolveClientUrl("../ReplaceClientManager.aspx") + "?ClientManager=' + id + '&ClientType='+clienttype+'&tempid='+tempid, window, 'dialogWidth:500px;DialogHeight=260px;status:yes;resizable=yes');}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopReplaceClientManager", script, true); #endregion }
/// <summary> /// Init the components of the panel through the special pageid /// </summary> private void InitComponents() { Hashtable _htDataObjectdControlsInfo = new Hashtable(); HtmlTable T_Content = new HtmlTable(); T_Content.CellPadding = 0; T_Content.CellSpacing = 0; T_Content.Width = "100%"; T_Content.Border = 0; T_Content.ID = "T_Content_" + ID; this.Controls.Add(T_Content); HtmlTableRow T_tr_title = new HtmlTableRow(); HtmlTableCell T_tc_title = new HtmlTableCell(); T_tr_title.Cells.Add(T_tc_title); T_Content.Rows.Add(T_tr_title); #region The title of the panel HtmlTable tb_title = new HtmlTable(); T_tc_title.Controls.Add(tb_title); tb_title.CellPadding = 0; tb_title.CellSpacing = 0; tb_title.Width = "100%"; tb_title.Height = "30px"; tb_title.Border = 0; tb_title.Attributes["class"] = "h3Row"; HtmlTableRow tr_title = new HtmlTableRow(); HtmlTableCell tc_title = new HtmlTableCell(); tr_title.Cells.Add(tc_title); tb_title.Rows.Add(tr_title); tc_title.InnerHtml = "<h3>工作流提交的数据字段内容</h3>"; #endregion #region The content of the panel HtmlTableRow T_tr_panelcontent = new HtmlTableRow(); T_tr_panelcontent.ID = "T_tr_panelcontent"; HtmlTableCell T_tc_panelcontent = new HtmlTableCell(); T_tr_panelcontent.Cells.Add(T_tc_panelcontent); T_Content.Rows.Add(T_tr_panelcontent); HtmlTable tb_panel_content = new HtmlTable(); tb_panel_content.Width = "100%"; tb_panel_content.Attributes["class"] = "tabForm"; T_tc_panelcontent.Controls.Add(tb_panel_content); IList<EWF_Flow_DataObject> _dataobjects = new EWF_Flow_AppBLL(App).GetDataObjectList(); int i = 0; foreach (EWF_Flow_DataObject _dataobject in _dataobjects) { if (_dataobject.Visible == "N") continue; #region 判断该控件是否已存在 if (_htDataObjectdControlsInfo.Contains(_dataobject.Name)) continue; #endregion #region 判断是否要增加新行 HtmlTableRow tr_panel_detail; if (i >= FieldCount || i == 0) { tr_panel_detail = new HtmlTableRow(); tb_panel_content.Rows.Add(tr_panel_detail); i = 0; } else { tr_panel_detail = tb_panel_content.Rows[tb_panel_content.Rows.Count - 1]; } #endregion #region 增加Label Cell HtmlTableCell tc_displayname = new HtmlTableCell(); tc_displayname.Attributes["Class"] = "dataLabel"; tc_displayname.Attributes["Style"] = "width: 80px; height: 18px;"; tc_displayname.Attributes["nowrap"] = "nowrap"; tc_displayname.InnerText = _dataobject.DisplayName; tr_panel_detail.Cells.Add(tc_displayname); #endregion #region 增加Field Cell HtmlTableCell tc_control = new HtmlTableCell(); tc_control.Attributes["Class"] = "dataField"; if (_dataobject.ColSpan > 0) { if (i + _dataobject.ColSpan <= FieldCount) { tc_control.ColSpan = 2 * _dataobject.ColSpan - 1; i = i + _dataobject.ColSpan; } else { tc_control.ColSpan = 2 * (FieldCount - i) - 1; i = 0; } } else { i++; } WebControl control = null; int RelationType = _dataobject.RelationType; string RelationTableName = _dataobject.RelationTableName; string RelationValueField = _dataobject.RelationValueField; string RelationTextField = _dataobject.RelationTextField; #region 根据控件类型生成相应的控件 switch (_dataobject.ControlType) { case 1://Label control = new Label(); break; case 2://TextBox control = new TextBox(); if (_dataobject.DataType == 4) { control.Attributes["onfocus"] = "setday(this);"; } break; case 3://DropDownList control = new DropDownList(); if (RelationType == 1)//Relation to the dictionary { ((DropDownList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((DropDownList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((DropDownList)control).DataTextField = "Value"; ((DropDownList)control).DataValueField = "Key"; ((DropDownList)control).DataBind(); ((DropDownList)control).Items.Insert(0, new ListItem("请选择...", "0")); break; case 4://RadioButtonList control = new RadioButtonList(); if (RelationType == 1)//Relation to the dictionary { ((RadioButtonList)control).DataSource = DictionaryBLL.GetDicCollections(RelationTableName, true); } else if (RelationType == 2)//Relation to the model table { ((RadioButtonList)control).DataSource = TreeTableBLL.GetRelationTableSourceData(RelationTableName, RelationValueField, RelationTextField); } else break; ((RadioButtonList)control).RepeatColumns = 6; ((RadioButtonList)control).RepeatDirection = RepeatDirection.Horizontal; ((RadioButtonList)control).DataTextField = "Value"; ((RadioButtonList)control).DataValueField = "Key"; ((RadioButtonList)control).DataBind(); if (((RadioButtonList)control).Items.Count != 0) ((RadioButtonList)control).SelectedIndex = 0; break; case 5://MutiLinesTextBox control = new TextBox(); ((TextBox)control).TextMode = TextBoxMode.MultiLine; if (_dataobject.ControlHeight > 0) ((TextBox)control).Height = new Unit(_dataobject.ControlHeight); break; case 6://TextBox supports search control = new MCSSelectControl(); control.ID = "C_" + _dataobject.Name.ToString(); if (RelationType == 2)//Relation to the model table { ((MCSSelectControl)control).PageUrl = _dataobject.SearchPageURL; } break; case 7://MCSTreeControl control = new MCSTreeControl(); if (RelationType == 2)//Relation to the model table { control.ID = "C_" + _dataobject.Name.ToString(); //在设置控件DataSource之前,必须要有ID属性 Shen Gang 20090110 if (_dataobject.RelationTableName == "MCS_SYS.dbo.Addr_OrganizeCity") { #region 如果为管理片区字段,则取员工所能管辖的片区 Org_StaffBLL staff = new Org_StaffBLL((int)System.Web.HttpContext.Current.Session["UserID"]); ((MCSTreeControl)control).DataSource = staff.GetStaffOrganizeCity(); ((MCSTreeControl)control).IDColumnName = "ID"; ((MCSTreeControl)control).NameColumnName = "Name"; ((MCSTreeControl)control).ParentColumnName = "SuperID"; if (((MCSTreeControl)control).DataSource.Select("ID = 1").Length > 0 || staff.Model.OrganizeCity == 0) { ((MCSTreeControl)control).RootValue = "0"; if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = "0"; } else { ((MCSTreeControl)control).RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); if (!Page.IsPostBack) ((MCSTreeControl)control).SelectValue = staff.Model.OrganizeCity.ToString(); } #endregion } else { ((MCSTreeControl)control).TableName = RelationTableName; ((MCSTreeControl)control).IDColumnName = RelationValueField; ((MCSTreeControl)control).NameColumnName = RelationTextField; ((MCSTreeControl)control).ParentColumnName = "SuperID"; } } break; } #endregion control.ID = "C_" + _dataobject.Name.ToString(); control.Enabled = _dataobject.Enable.ToUpper() == "Y"; control.ToolTip = _dataobject.Description; if (_dataobject.ControlWidth > 0) control.Width = _dataobject.ControlWidth; tc_control.Controls.Add(control); #region 如果是文本框时,加上输入验证控件 if (_dataobject.IsRequireField == "Y") { Label lbl_reqinfo = new Label(); lbl_reqinfo.Text = "*"; lbl_reqinfo.ForeColor = System.Drawing.Color.Red; tc_control.Controls.Add(lbl_reqinfo); } //add validate control for the textbox if (_dataobject.ControlType == 2 || _dataobject.ControlType == 5) { RequiredFieldValidator _requiredfieldvalidator = null; CompareValidator _comparevalidator = null; RegularExpressionValidator _regularexpressionvalidator = null; if (_dataobject.IsRequireField == "Y") { _requiredfieldvalidator = new RequiredFieldValidator(); _requiredfieldvalidator.ControlToValidate = control.ID; _requiredfieldvalidator.Display = ValidatorDisplay.Dynamic; _requiredfieldvalidator.ErrorMessage = "必填"; _requiredfieldvalidator.ForeColor = System.Drawing.Color.Red; _requiredfieldvalidator.ValidationGroup = _validationgroup; tc_control.Controls.Add(_requiredfieldvalidator); } if (_dataobject.DataType == 1 || _dataobject.DataType == 2 || _dataobject.DataType == 4) //非varchar 字符串 { _comparevalidator = new CompareValidator(); _comparevalidator.ControlToValidate = control.ID; _comparevalidator.Operator = ValidationCompareOperator.DataTypeCheck; _comparevalidator.Display = ValidatorDisplay.Dynamic; _comparevalidator.ForeColor = System.Drawing.Color.Red; _comparevalidator.ValidationGroup = _validationgroup; if (_dataobject.DataType == 1)//int { _comparevalidator.Type = ValidationDataType.Integer; _comparevalidator.ErrorMessage = "应为整数"; } if (_dataobject.DataType == 2)//decimal { _comparevalidator.Type = ValidationDataType.Double; _comparevalidator.ErrorMessage = "应为数字"; } if (_dataobject.DataType == 4)//datetime { _comparevalidator.Type = ValidationDataType.Date; _comparevalidator.ErrorMessage = "日期格式不正确"; } tc_control.Controls.Add(_comparevalidator); } else { if (_dataobject.RegularExpression != "") { _regularexpressionvalidator = new RegularExpressionValidator(); _regularexpressionvalidator.ControlToValidate = control.ID; _regularexpressionvalidator.ErrorMessage = "数据格式不正确"; _regularexpressionvalidator.ForeColor = System.Drawing.Color.Red; _regularexpressionvalidator.ValidationExpression = _dataobject.RegularExpression; _regularexpressionvalidator.ValidationGroup = ValidationGroup; _regularexpressionvalidator.Display = ValidatorDisplay.Dynamic; tc_control.Controls.Add(_regularexpressionvalidator); } } } #endregion tr_panel_detail.Cells.Add(tc_control); #endregion #region Record the info of the control created DataObjectControlInfo dataobjectcontrolinfo = new DataObjectControlInfo(); dataobjectcontrolinfo.ControlName = control.ID; dataobjectcontrolinfo.ControlType = _dataobject.ControlType; dataobjectcontrolinfo.DataObjectID = _dataobject.ID; dataobjectcontrolinfo.DataObjectName = _dataobject.Name; _htDataObjectdControlsInfo.Add(dataobjectcontrolinfo.DataObjectName, dataobjectcontrolinfo); #endregion } #endregion ViewState["HTDataObjectControlInfo"] = _htDataObjectdControlsInfo; if (new EWF_Flow_AppBLL(App).Model.RelateBusiness.ToUpper() == "Y") SetPanelEnable(false); }
protected void Page_Load(object sender, System.EventArgs e) { #region 给行政城市加事件 tr_OfficialCity = (MCSTreeControl)pl_detail.FindControl("CM_Client_OfficialCity"); if (tr_OfficialCity != null) { tr_OfficialCity.AutoPostBack = true; tr_OfficialCity.Selected += tr_OfficialCity_Selected; } tr_OrganizeCity = (MCSTreeControl)pl_detail.FindControl("CM_ClientManufactInfo_OrganizeCity"); if (tr_OrganizeCity != null) { tr_OrganizeCity.AutoPostBack = true; tr_OrganizeCity.Selected += tr_OrganizeCity_Selected; } #endregion if (!Page.IsPostBack) { #region 获取页面参数 if (Request.QueryString["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Request.QueryString["ClientID"]); Session["ClientID"] = ViewState["ClientID"]; } else if (Session["ClientID"] != null) { ViewState["ClientID"] = Int32.Parse(Session["ClientID"].ToString()); } #endregion Session["MCSMenuControl_FirstSelectIndex"] = "12"; BindDropDown(); if (ViewState["ClientID"] != null) { BindData(); } else if (Request.QueryString["Mode"] == "New") { //新增客户时的初始值 DropDownList ddl_State = (DropDownList)pl_detail.FindControl("CM_ClientManufactInfo_State"); if (ddl_State != null) ddl_State.SelectedValue = "1"; TextBox tbx_OpenTime = (TextBox)pl_detail.FindControl("CM_ClientManufactInfo_BeginDate"); if (tbx_OpenTime != null) tbx_OpenTime.Text = DateTime.Today.ToString("yyyy-MM-dd"); } } #region 给活跃标志加事件 //DropDownList ddl_ActiveFlag_1 = (DropDownList)pl_detail.FindControl("CM_Client_ActiveFlag"); //ddl_ActiveFlag_1.AutoPostBack = true; //ddl_ActiveFlag_1.SelectedIndexChanged += new EventHandler(ddl_ActiveFlag_SelectedIndexChanged); #endregion #region 给判断重复编码加事件 //TextBox tbx_Code = (TextBox)pl_detail.FindControl("CM_Client_Code"); //tbx_Code.AutoPostBack = true; //tbx_Code.TextChanged += new EventHandler(tbx_Code_TextChanged); #endregion }