/// <summary> /// Page_Load. loads any configurable control values (e.g lists for drop downs and combos) and required Helper javascripts /// </summary> /// <param name="sender">see MSDN documentation</param> /// <param name="e">see MSDN documentation</param> protected void Page_Load(object sender, EventArgs e) { Parent.Page.ClientScript.RegisterClientScriptInclude("MODSBuilder", Parent.Page.ClientScript.GetWebResourceUrl(typeof(MODSBasic), "CLIF.Solutions.Code.Modules.PublishMetaDataForms.Resources.Javascript.MODSBuilder.js")); try { CLIFConfigurationSettings configurationSettings = ConfigurationManager.GetSection("CLIFSendFedora") as CLIFConfigurationSettings; if (configurationSettings == null) System.Diagnostics.Trace.WriteLine("Failed to load configurationSettings."); else { HtmlInputText modsAuthority = (HtmlInputText)this.FindControl("txt_subjectAuthority_MODSBasic"); modsAuthority.Value = configurationSettings.MODSAuthority.Value; HtmlInputCheckBox ckAccessCondition = (HtmlInputCheckBox)this.FindControl("main_ckbc_accessCondition_MODSBasic"); ckAccessCondition.Value = String.Format(configurationSettings.RightsMainStatement.Value, DateTime.Now.Year); Label lblAccessCondition = (Label)this.FindControl("lbl_main_accessCondition"); lblAccessCondition.Text = ckAccessCondition.Value; PlaceHolder rightsPlaceHolder = (PlaceHolder)this.FindControl("accessConditionsPlaceHolder"); for (int i = 0; i < configurationSettings.RightsOptionalStatements.Count; i++) { HtmlInputCheckBox ckBox = new HtmlInputCheckBox(); ckBox.ID = i + "_ckbc_accessCondition_MODSBasic"; ckBox.Value = configurationSettings.RightsOptionalStatements[i].OptionValue; ckBox.Attributes.Add("class", "MODSBasic"); rightsPlaceHolder.Controls.Add(ckBox); rightsPlaceHolder.Controls.Add(new LiteralControl(configurationSettings.RightsOptionalStatements[i].OptionValue)); rightsPlaceHolder.Controls.Add(new LiteralControl("<br/>")); } HtmlInputText tbPublisher = (HtmlInputText)this.FindControl("txt_publisher_MODSBasic"); tbPublisher.Value = configurationSettings.MODSPublisher.Value; DropDownList cbMODSRoleTypes = (DropDownList)this.FindControl("rptd_ddl_roleType_MODSBasic"); cbMODSRoleTypes.Items.Clear(); for (int i = 0; i < configurationSettings.MODSRoleTypes.Count; i++) { cbMODSRoleTypes.Items.Add(new ListItem(configurationSettings.MODSRoleTypes[i].OptionValue, configurationSettings.MODSRoleTypes[i].OptionValue)); } DropDownList dlLanguageTerms = (DropDownList)this.FindControl("ddl_languageTermType_MODSBasic"); dlLanguageTerms.Items.Clear(); for (int i = 0; i < configurationSettings.LanguageTerms.Count; i++) { dlLanguageTerms.Items.Add(new ListItem(configurationSettings.LanguageTerms[i].Key, configurationSettings.LanguageTerms[i].Value)); } } } catch (ConfigurationErrorsException err) { System.Diagnostics.Trace.WriteLine("ReadCustomSection(string): {0}", err.ToString()); } }
private string getCheckBox(HtmlInputCheckBox check) { string strValue = ""; if (check.Checked) { strValue = check.Value; } return strValue; }
private static void AddEmailsTo(Control parent, IEnumerable <string> emailList, string name, bool isRadio, bool isOption = false) { parent.Controls.Clear(); var index = 1; foreach (var email in emailList) { var isChecked = index == 1; var id = name + index++; var div = new HtmlDiv().AddTo(parent, "tiptip"); div.Attributes["title"] = email; HtmlInputControl inputControl; if (isRadio) { inputControl = new HtmlInputRadioButton { ID = id, Value = email, Name = name, Checked = isChecked } } ; else { inputControl = new HtmlInputCheckBox { ID = id, Value = email } }; if (isOption) { inputControl.AddCssClasses("is-option-click"); } inputControl.AddTo(div); new HtmlLabel { InnerText = email }.AddTo(div) .Attributes["for"] = id; } } }
private void initTable_BL(int PatientID) { DataTool dbTool = new DataTool(); DataTable dtAllergy = dbTool.getAllergy(PatientID); int rCnt = dtAllergy.Rows.Count; for (int j = 0; j < rCnt; j++) { TableRow r = new TableRow(); for (int i = 0; i < 4; i++) { DataRow drAllergy = dtAllergy.Rows[j]; TableCell c = new TableCell(); if (c.HasControls()) { c.Controls.Clear(); } HtmlInputCheckBox chk = new HtmlInputCheckBox(); chk.Value = drAllergy["AllergyID"].ToString(); chk.ID = "chkAllergy" + drAllergy["AllergyID"].ToString(); chk.Disabled = true; if (!Convert.IsDBNull(drAllergy["PAllergy"])) { chk.Checked = true; } else { chk.Checked = false; } c.Controls.Add(chk); c.Width = System.Web.UI.WebControls.Unit.Percentage(25); c.Controls.Add(new LiteralControl(" " + drAllergy["AllergyName"].ToString())); r.Cells.Add(c); j++; } tblAll.Rows.Add(r); } }
//生成指标 protected void btnZB_Click(object sender, EventArgs e) { try { var list = new List <Mod_TMO_ORDER_PCZB>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox cbxID = (HtmlInputCheckBox)rptList.Items[i].FindControl("cbxID"); Literal ltlC_AREA = (Literal)rptList.Items[i].FindControl("ltlC_AREA"); HtmlInputText txtN_MONTH_JK_ZB = (HtmlInputText)rptList.Items[i].FindControl("txtN_MONTH_JK_ZB"); //月指标监控 HtmlInputText txtN_MONTH_JP_ZB = (HtmlInputText)rptList.Items[i].FindControl("txtN_MONTH_JP_ZB"); //月指标精品 HtmlInputText txtN_MONTH_PZ_ZB = (HtmlInputText)rptList.Items[i].FindControl("txtN_MONTH_PZ_ZB"); //月指标品种 HtmlInputText txtN_MONTH_PT_ZB = (HtmlInputText)rptList.Items[i].FindControl("txtN_MONTH_PT_ZB"); //月指标普碳钢 Literal ltlC_TYPE = (Literal)rptList.Items[i].FindControl("ltlC_TYPE"); //N/Y INSERT/UPDATE Mod_TMO_ORDER_PCZB mod = new Mod_TMO_ORDER_PCZB(); mod.C_ID = cbxID.Value; mod.C_AREA = ltlC_AREA.Text; //区域 mod.N_MONTH_JK_ZB = Convert.ToDecimal(txtN_MONTH_JK_ZB.Value == "" ? "0" : txtN_MONTH_JK_ZB.Value); //月监控指标 mod.N_MONTH_JP_ZB = Convert.ToDecimal(txtN_MONTH_JP_ZB.Value == "" ? "0" : txtN_MONTH_JP_ZB.Value); //月精品指标 mod.N_MONTH_PZ_ZB = Convert.ToDecimal(txtN_MONTH_PZ_ZB.Value == "" ? "0" : txtN_MONTH_PZ_ZB.Value); //月品种指标 mod.N_MONTH_PT_ZB = Convert.ToDecimal(txtN_MONTH_PT_ZB.Value == "" ? "0" : txtN_MONTH_PT_ZB.Value); //月普碳指标 mod.D_PLAN_DT = Convert.ToDateTime(txtStart.Value + "-1"); //计划日期 mod.C_CREATE_ID = ltlEmpName.Text; //制单人 mod.C_TYPE2 = ltlC_TYPE.Text; //N/Y 添加/修改 list.Add(mod); } if (tmo_order_pczb.Insert_Update2(list)) { GetList(); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script language='javascript'> _closemsg('保存成功');</script>", false); } } catch (Exception ex) { WebMsg.MessageBox(ex.Message); } }
protected void repModules_OnItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRow dr = (DataRow)e.Item.DataItem; HtmlInputCheckBox chkbx = (HtmlInputCheckBox)e.Item.FindControl("chkModule"); Label lblMod = (Label)e.Item.FindControl("lblModuleTitle"); string strMID = dr["MID"].ToString(); string strGrpID = dr["MODULE_GROUP_ID"].ToString(); chkbx.Attributes.Add("value", strMID + "|" + strGrpID + "|"); chkbx.Attributes.Add("groupid", strGrpID); lblMod.AssociatedControlID = chkbx.ID; lblMod.Attributes.Add("title", dr["DESCRIPTION"].ToString()); lblMod.Text = dr["MODULE"].ToString(); if (dsMods != null) { DataRow[] drs = dsMods.Tables[0].Select("MID = " + strMID + " AND MODULE_GROUP_ID = " + strGrpID); if (drs.Length > 0) { chkbx.Checked = true; long lStatus = 0; foreach (DataRow dr1 in drs) { if (!dr1.IsNull("STATUS")) { lStatus = Convert.ToInt32(dr1["STATUS"]); } } chkbx.Disabled = (lStatus > 0); } } if (bReadOnly) { chkbx.Disabled = true; } } }
protected void btnReset_Click(object sender, EventArgs e) { int successcount = 0; int failedcount = 0; try { int totalchecked = gvUser.Rows.Cast <GridViewRow>().Count(r => ((HtmlInputCheckBox)r.FindControl("ChkReview")).Checked); if (totalchecked < 1) { ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('no data checked');", true); return; } foreach (GridViewRow gvr in gvUser.Rows) { HtmlInputCheckBox ChkReview = (HtmlInputCheckBox)gvr.FindControl("ChkReview"); if (ChkReview != null) { if (ChkReview.Checked == true) { string password = mc.getrandomtext(); if (mc.reset_password_all_ct(int.Parse(gvr.Cells[2].Text), password, gvr.Cells[13].Text)) { sendemail(gvr.Cells[4].Text, gvr.Cells[9].Text, gvr.Cells[7].Text, password); successcount += 1; } else { failedcount += 1; } } } } } catch (Exception ex) { } string notif = string.Concat("alert('", successcount.ToString(), " password has been reset successfully & ", failedcount.ToString(), " password failed to reset');"); ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), Guid.NewGuid().ToString(), notif, true); }
protected void Lbsend_email_Click(object sender, EventArgs e) { int[] items = new int[RpItemList.Items.Count]; string _sMailContent = string.Empty; try { int j = 0; for (int i = 0; i < RpItemList.Items.Count; i++) { HtmlInputCheckBox check = RpItemList.Items[i].FindControl("chkSelect") as HtmlInputCheckBox; HtmlInputHidden s = RpItemList.Items[i].FindControl("newsid") as HtmlInputHidden; int _newid = Utils.CIntDef(s.Value); if (check.Checked) { items[j] = _newid; j++; } } var setMailcontent = DB.ESHOP_NEWs.Where(n => items.Contains(n.NEWS_ID)); foreach (var s in setMailcontent) { _sMailContent += setHtmlSendmail(s.NEWS_TITLE, subDesc(s.NEWS_DESC), GetImageT_News(s.NEWS_ID, s.NEWS_IMAGE3), Getprice(s.NEWS_PRICE1), Getlink_News(s.NEWS_URL, s.NEWS_SEO_URL, s.NEWS_TYPE), Utils.CIntDef(s.NEWS_TYPE)); } //Gửi mail var _vEmailReceive = DB.GetTable <ESHOP_MAIL_RECIVE>().Where(a => a.MAIL_ACTIVE == 1); foreach (var item in _vEmailReceive) { Send_Mail_Content(_sMailContent, item.MAIL_NAME); } Response.Write("<script LANGUAGE='JavaScript' >alert('Thông báo: Tin đã được gửi thành công!');document.location='" + ResolveClientUrl("/cpanel/page/news_list.aspx?type=" + _type) + "';</script>"); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { items = null; SearchResult(); } }
protected void lbtDelete_Click(object sender, EventArgs e) { int i = 0; int j = 0; HtmlInputCheckBox check = new HtmlInputCheckBox(); int[] items = new int[rptList.Items.Count]; try { foreach (DataGridItem item in rptList.Items) { check = new HtmlInputCheckBox(); check = (HtmlInputCheckBox)item.FindControl("chkSelect"); Label lblID = (Label)item.FindControl("lblID"); if (check.Checked) { int catId = Utils.CIntDef(lblID.Text, 0); items[j] = catId; j++; } i++; } //delete var g_delete = DB.GetTable <ESHOP_ONLINE>().Where(g => items.Contains(g.ONLINE_ID)); DB.ESHOP_ONLINEs.DeleteAllOnSubmit(g_delete); DB.SubmitChanges(); } catch (Exception ex) { clsVproErrorHandler.HandlerError(ex); } finally { items = null; SearchResult(); } }
//添加产品 protected void btnAdd_Click(object sender, EventArgs e) { Session[ltlempid.Text] = null; #region //DataTable初始化 DataTable dt = new DataTable(); dt.Columns.Add("C_ID", typeof(string)); //物料主键 dt.Columns.Add("C_MAT_CODE", typeof(string)); //物料编码 dt.Columns.Add("C_MAT_NAME", typeof(string)); //物料名称 dt.Columns.Add("C_STL_GRD", typeof(string)); //钢种 dt.Columns.Add("C_SPEC", typeof(string)); //规格 dt.Columns.Add("C_STD_CODE", typeof(string)); //执行标准 dt.Columns.Add("ZYX1", typeof(string)); //自由项1 dt.Columns.Add("ZYX2", typeof(string)); //自由项2 dt.Columns.Add("C_BY4", typeof(string)); //是否不锈钢 #endregion for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox cbxSelect = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkMat_Code"); //物料ID Literal ltlmatcode = (Literal)rptList.Items[i].FindControl("ltlmatcode"); //物料编码 Literal ltlmatname = (Literal)rptList.Items[i].FindControl("ltlmatname"); //物料名称 Literal ltlstlgrd = (Literal)rptList.Items[i].FindControl("ltlstlgrd"); //钢种 Literal ltlspec = (Literal)rptList.Items[i].FindControl("ltlspec"); //规格 Literal ltlstdcode = (Literal)rptList.Items[i].FindControl("ltlstdcode"); //执行标准 Literal ltlzyx1 = (Literal)rptList.Items[i].FindControl("ltlzyx1"); //自由项1 Literal ltlzyx2 = (Literal)rptList.Items[i].FindControl("ltlzyx2"); //自由项2 Literal ltlC_IS_BXG = (Literal)rptList.Items[i].FindControl("ltlC_IS_BXG"); //是否不锈钢 if (cbxSelect.Checked) { dt.Rows.Add(new object[] { cbxSelect.Value, ltlmatcode.Text, ltlmatname.Text, ltlstlgrd.Text, ltlspec.Text, ltlstdcode.Text, ltlzyx1.Text, ltlzyx2.Text, ltlC_IS_BXG.Text }); } } Session[ltlempid.Text] = dt; if (dt.Rows.Count > 0) { ScriptManager.RegisterStartupScript(UpdatePanel1, this.Page.GetType(), "", "window.parent.document.getElementById('imgbtnJz').click();", true); } }
private void BindAdmins() { gid = Common.Util.GetPageParamsAndToInt("id"); Group g = Logic.Consult.GetGroups(gid); id.Value = g.Id.ToString(); groupname.Value = g.GroupName; string[] admins = g.Caption.Split(new char[] { ',' }); HtmlInputHidden hih = new HtmlInputHidden(); hih.ID = "hid"; hih.Value = g.Caption + ","; Page.Form.Controls.Add(hih); using (DataSet reader = Logic.Consult.GetAdmins()) { if (Common.Util.CheckDataSet(reader)) { foreach (DataRow dr in reader.Tables[0].Rows) { HtmlGenericControl li = new HtmlGenericControl("li"); HtmlInputCheckBox checkbox = new HtmlInputCheckBox(); checkbox.ID = string.Format("admin{0}", dr["id"].ToString()); checkbox.Attributes.Add("onclick", "SetCustomizeAdmins(this);"); checkbox.Attributes.Add("value", dr["id"].ToString()); for (int i = 0; i < admins.Length; i++) { if (admins[i] == dr["id"].ToString()) { checkbox.Checked = true; break; } } li.Controls.Add(checkbox); HtmlGenericControl label = new HtmlGenericControl("label"); label.Attributes.Add("for", string.Format("admin{0}", dr["id"].ToString())); label.InnerText = dr["adminname"].ToString(); li.Controls.Add(label); RightsList.Controls.Add(li); } } } }
protected void rptData_ItemDataBound(object sender, RepeaterItemEventArgs e) { try { //Lấy data Category objCategory = (Category)e.Item.DataItem; if (objCategory == null) { return; } //Set ID (unique id) HtmlInputCheckBox cbxSelect = e.Item.FindControl("cbxcheck") as HtmlInputCheckBox; if (cbxSelect != null) { CategoryID = Convert.ToInt32(objCategory.CategoryID); cbxSelect.Attributes.Add("uid", objCategory.CategoryID.ToString()); } //set image ImageButton ibtIsActived = e.Item.FindControl("ibtIsActived") as ImageButton; if (ibtIsActived != null) { ibtIsActived.ImageUrl = "~/Images/uncheck.png"; if (objCategory.IsActived) { ibtIsActived.ImageUrl = "~/Images/check.png"; } ibtIsActived.Attributes.Add("checked", objCategory.IsActived.ToString()); } //set image ImageButton btnDelete = e.Item.FindControl("btnDelete") as ImageButton; if (btnDelete != null) { btnDelete.ImageUrl = "~/Images/delete.gif"; } } catch (Exception ex) { Global.WriteLogError("rptData_ItemDataBound : " + ex); } }
protected void lstItem_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView)e.Item.DataItem; HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); chkList.Value = dr["VariationID"].ToString(); HyperLink lnkVariationType = (HyperLink)e.Item.FindControl("lnkVariationType"); lnkVariationType.Text = dr["VariationType"].ToString(); //VariationID lnkVariationType.NavigateUrl = Constants.ROOT_DIRECTORY + "/MasterFiles/_Variation/Default.aspx?task=" + Common.Encrypt("details", Session.SessionID) + "&id=" + Common.Encrypt(dr["VariationID"].ToString(), Session.SessionID); TextBox txtDescription = (TextBox)e.Item.FindControl("txtDescription"); ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); txtDescription.Text = clsProductVariationsMatrix.Details(Convert.ToInt64(lblMatrixID.Text), Convert.ToInt32(chkList.Value)).Description; clsProductVariationsMatrix.CommitAndDispose(); } }
//MagicToolbar's MagicItem OnClick Event Handler, it's for both the top one and the bottom one. protected void MagicItemCommand(object sender, MagicItemEventArgs e) { if (e.CommandName == "Delete") { // do delete //Get Selected Items //IList<T> pks = new List<T>(); foreach (RepeaterItem item in this.rptUserGroup.Items) { HtmlInputCheckBox chk = item.FindControl("checkbox") as HtmlInputCheckBox; if (chk != null) { if (chk.Checked) { //Selected } } } //Do your logic } }
public void DoRepeaterItem(RepeaterItem item, ArrayList selectedList, ArrayList unselectedList) { HtmlInputCheckBox insertSelected = (HtmlInputCheckBox)item.FindControl("SystemFunctionEmailAlertInsert"); HtmlInputCheckBox updateSelected = (HtmlInputCheckBox)item.FindControl("SystemFunctionEmailAlertUpdate"); HtmlInputCheckBox deleteSelected = (HtmlInputCheckBox)item.FindControl("SystemFunctionEmailAlertDelete"); ESystemFunctionEmailAlert a = new ESystemFunctionEmailAlert(); a.FunctionID = int.Parse(insertSelected.Attributes["id"]); a.SystemFunctionEmailAlertInsert = insertSelected.Checked; a.SystemFunctionEmailAlertUpdate = updateSelected.Checked; a.SystemFunctionEmailAlertDelete = deleteSelected.Checked; if (a.SystemFunctionEmailAlertInsert || a.SystemFunctionEmailAlertUpdate || a.SystemFunctionEmailAlertDelete) { selectedList.Add(a); } else { unselectedList.Add(a); } }
protected void repeatControl_ItemDataBound(object sender, RepeaterItemEventArgs e) { DataRowView drv = e.Item.DataItem as DataRowView; if (drv == null) { return; } TextBox txt; txt = e.Item.FindControl("txtQty") as TextBox; txt.Text = RenderUtil.FormatNumber(drv["Quantity"], "#0.##"); if (this._head != null && this._head.Status != StockInStatus.New) { WebUtil.DisableControl(txt); HtmlInputCheckBox chk = e.Item.FindControl("checkbox") as HtmlInputCheckBox; chk.Visible = false; } }
private void lstItem_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = (DataRowView)e.Item.DataItem; HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); chkList.Value = dr["VariationID"].ToString(); Label lblVariationType = (Label)e.Item.FindControl("lblVariationType"); lblVariationType.Text = dr["VariationType"].ToString(); ProductVariationsMatrix clsProductVariationsMatrix = new ProductVariationsMatrix(); TextBox txtDescription = (TextBox)e.Item.FindControl("txtDescription"); txtDescription.Text = clsProductVariationsMatrix.Details(Convert.ToInt32(lblMatrixID.Text), Convert.ToInt32(chkList.Value)).Description; clsProductVariationsMatrix.CommitAndDispose(); } }
//删除行 protected void btndelrow_Click(object sender, EventArgs e) { var list = new List <Mod_TMC_TRAIN_ITEM>(); for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox cbxselect = (HtmlInputCheckBox)rptList.Items[i].FindControl("cbxselect"); if (cbxselect.Checked) { var mod = new Mod_TMC_TRAIN_ITEM(); mod.C_ID = cbxselect.Value; list.Add(mod); } } if (tmc_train_main.Del_ITEM(list)) { BindList(); } }
/// 获取选中的博客代码 /// </summary> /// <param name="GridViewMain"></param> /// <param name="RowCheckBoxName"></param> /// <param name="RowHiddenInputName"></param> /// <returns></returns> private static string RetrieveCheckValue(GridView GridViewMain, string RowCheckBoxName, string RowHiddenInputName) { string a = ""; foreach (GridViewRow GridViewMainItem in GridViewMain.Rows) { HtmlInputCheckBox chk = (HtmlInputCheckBox)(GridViewMainItem.FindControl(RowCheckBoxName)); HtmlInputHidden hiInput = (HtmlInputHidden)(GridViewMainItem.FindControl(RowHiddenInputName)); if (chk.Checked == true) { a += "," + hiInput.Value; } } if (a != "") { a = a.Substring(1, a.Length - 1); } return(a); }
protected void grvDanhSach_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { DataRow r = ((DataRowView)e.Row.DataItem).Row; HtmlInputCheckBox chkChon = (HtmlInputCheckBox)(e.Row.FindControl("chkChon")); Label lblStatus = (Label)(e.Row.FindControl("lblStatus")); HyperLink lnkIDCaSau = (HyperLink)(e.Row.FindControl("lnkIDCaSau")); Label lblSTT = (Label)(e.Row.FindControl("lblSTT")); DotNetNuke.Entities.Tabs.TabController tabCont = new DotNetNuke.Entities.Tabs.TabController(); lnkIDCaSau.ToolTip = r["ID"].ToString(); lnkIDCaSau.Attributes["onclick"] = "openwindow('" + DotNetNuke.Common.Globals.NavigateURL(tabCont.GetTabByName(ConfigurationManager.AppSettings["QLCS_CaSauListBienDongPage"], PortalId).TabID, "", "IDCaSau/" + r["IDCaSau"].ToString()) + "','',800,600);"; lnkIDCaSau.Attributes["style"] = "cursor:pointer;font-weight:bold;"; chkChon.Attributes["name"] = r["IDCaSau"].ToString(); chkChon.Attributes["onclick"] = "chon_click(event, this);"; lblStatus.Text = r["TrangThai"].ToString(); int t = e.Row.RowIndex + 1; lblSTT.Text = t.ToString(); } }
// 批量删除 protected void lbtDeleteMore_Click(object sender, EventArgs e) { foreach (RepeaterItem item in rptBanner.Items) { HtmlInputCheckBox isDelete = item.FindControl("isDelete") as HtmlInputCheckBox; HtmlInputHidden id = item.FindControl("id") as HtmlInputHidden; int picture_id = Convert.ToInt32(id.Value); if (isDelete.Checked) { using (var db = new TeachingCenterEntities()) { var banner = db.Picture.SingleOrDefault(a => a.Picture_id == picture_id); db.Picture.Remove(banner); db.SaveChanges(); } } } Server.Transfer("BannerList.aspx"); // Response.Write("<script>alert('删除成功!');location.href='BannerList.aspx';</script>"); }
private AccountPaymentsStatus GetStatus() { AccountPaymentsStatus status = AccountPaymentsStatus.Open; foreach (DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)item.FindControl("chkList"); if (chkList != null) { if (chkList.Checked == true) { Label lblStatus = (Label)item.FindControl("lblStatus"); status = (AccountPaymentsStatus)Enum.Parse(typeof(AccountPaymentsStatus), lblStatus.Text); return(status); } } } return(status); }
// 批量删除 protected void lbtDeleteMore_Click(object sender, EventArgs e) { foreach (RepeaterItem item in rptSource.Items) { HtmlInputCheckBox isDelete = item.FindControl("isDelete") as HtmlInputCheckBox; HtmlInputHidden id = item.FindControl("id") as HtmlInputHidden; int src_id = Convert.ToInt32(id.Value); if (isDelete.Checked) { using (var db = new TeachingCenterEntities()) { var src = db.EducateSource.SingleOrDefault(a => a.id == src_id); db.EducateSource.Remove(src); db.SaveChanges(); } } } //Response.Write("<script>alert('删除成功!');location.href='RecycleEducationSourse.aspx';</script>"); Server.Transfer("RecycleEducationSourse.aspx"); }
/// this method is to get list of selected scripttype(s) in the grid. /// </summary> /// <returns></returns> private string GetSelectedScriptTypeIDs() { string strSelectedScriptTypeIDs = ""; for (int i = 0; i < grdScriptType.Rows.Count; i++) { HtmlInputCheckBox chkScriptTypeSelecter = (HtmlInputCheckBox)grdScriptType.Rows[i].FindControl("chkRowChild"); if (chkScriptTypeSelecter.Checked == true) { strSelectedScriptTypeIDs += Convert.ToInt32(((DataTable)(ViewState["DSGRID"])).Rows[grdScriptType.Rows[i].DataItemIndex]["ScriptTypeID"]) + ", "; } } if (strSelectedScriptTypeIDs.Length > 0) { strSelectedScriptTypeIDs = strSelectedScriptTypeIDs.Remove(strSelectedScriptTypeIDs.LastIndexOf(", ")); } return(strSelectedScriptTypeIDs); }
// 批量删除 protected void lbtDeleteMore_Click(object sender, EventArgs e) { foreach (RepeaterItem item in rptSource.Items) { HtmlInputCheckBox isDelete = item.FindControl("isDelete") as HtmlInputCheckBox; HtmlInputHidden id = item.FindControl("id") as HtmlInputHidden; int src_id = Convert.ToInt32(id.Value); if (isDelete.Checked) { using (var db = new TeachingCenterEntities()) { var src = db.EducateSource.SingleOrDefault(a => a.id == src_id); src.is_deleted = 1; src.deletedtime = DateTime.Now; db.SaveChanges(); } } } Response.Write("<script>alert('删除成功!');location.href='EduSrcList.aspx';</script>"); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetCheckBoxUIProperties(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { string permissionId = DataBinder.Eval(e.Item.DataItem, RolePermission.PermissionId).ToString(); HtmlInputCheckBox permissionCheckBox = e.Item.FindControl("PermissionCheckBox") as HtmlInputCheckBox; HtmlInputHidden rolePermissionIdField = e.Item.FindControl("RolePermissionIdField") as HtmlInputHidden; permissionCheckBox.Value = permissionId; // Determine if a current rolepermission is assigned for this permission DataRow[] foundPermissions = currentRolePermissions.Select(RolePermission.PermissionId + " = " + permissionId); if (foundPermissions.Length > 0) { string rolePermissionId = foundPermissions[0][RolePermission.RolePermissionId].ToString(); rolePermissionIdField.Value = rolePermissionId; permissionCheckBox.Checked = !string.IsNullOrEmpty(rolePermissionId); } } }
protected void lbtRecycle_Click(object sender, EventArgs e) { foreach (RepeaterItem item in rptCategory.Items) { HtmlInputCheckBox isDelete = item.FindControl("isDelete") as HtmlInputCheckBox; HtmlInputHidden id = item.FindControl("id") as HtmlInputHidden; int project_id = Convert.ToInt32(id.Value); if (isDelete.Checked) { using (var db = new TeachingCenterEntities()) { var pro_category = db.ProjectCategory.SingleOrDefault(a => a.id == project_id); pro_category.is_deleted = 0; db.SaveChanges(); } } } Server.Transfer("RecycleProjectCategory.aspx"); // Response.Write("<script>alert('恢复成功!');location.href='RecycleProjectCategory.aspx';</script>"); }
public void InstantiateIn(Control container) { using (HtmlGenericControl div = new HtmlGenericControl("div")) { div.Attributes.Add("class", "ui toggle checkbox"); this.checkBox = new HtmlInputCheckBox(); this.checkBox.ID = "SelectCheckBox"; this.checkBox.ClientIDMode = ClientIDMode.Predictable; div.Controls.Add(this.checkBox); //Added for compatibility with Semantic UI using (HtmlGenericControl label = new HtmlGenericControl("label")) { div.Controls.Add(label); } container.Controls.Add(div); } }
//删除 protected void btn_Del_Click(object sender, EventArgs e) { bool result = false; foreach (RepeaterItem rpt in rpt_List.Items) { HtmlInputCheckBox chkSelect = (HtmlInputCheckBox)rpt.FindControl("chkSelect"); if (chkSelect.Checked) { if (!string.IsNullOrEmpty(chkSelect.Value)) { result = areaPlan.Delete(chkSelect.Value); } } } if (result) { ByPageBind(); } }
//删除行 protected void btndelrow_Click(object sender, EventArgs e) { bool result = false; for (int i = 0; i < rptList.Items.Count; i++) { HtmlInputCheckBox chkOrder = (HtmlInputCheckBox)rptList.Items[i].FindControl("chkOrder"); HtmlInputText txtflag = (HtmlInputText)rptList.Items[i].FindControl("txtflag"); HtmlInputHidden hidpkid = (HtmlInputHidden)rptList.Items[i].FindControl("hidpkid"); if (chkOrder.Checked) { result = tmd_dispatchdetails.Delete(hidpkid.Value); } } if (result) { WebMsg.MessageBox("删除成功"); BindList(); } }
private ArrayList GetData() { ArrayList arrayList = new ArrayList(); foreach (GridViewRow gridViewRow in this.GVBook.Rows) { HtmlInputCheckBox htmlInputCheckBox = (HtmlInputCheckBox)gridViewRow.Cells[0].FindControl("chkSub"); if (htmlInputCheckBox.Checked) { arrayList.Add(new OAOfficeResApplicationCollectDetail { ACDetailID = 0, ACRecordID = this.ICRecordID, ApplyNumber = (gridViewRow.Cells[5].Text.Trim() == "") ? 0 : int.Parse(gridViewRow.Cells[5].Text.Trim()), MaterialID = (gridViewRow.Cells[6].Text.Trim() == "") ? 0 : int.Parse(gridViewRow.Cells[6].Text.Trim()) }); } } return(arrayList); }
/// <summary> /// item data bound on datalist /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gettydata_ItemDataBound(object sender, DataListItemEventArgs e) { Literal _html = (Literal)e.Item.FindControl("lthtml"); _html.Text = @"<a href='" + (string)DataBinder.Eval(e.Item.DataItem, "UrlPreview") + @"' id='htmlA' > <img src='" + _baseURL + @"images/spacer.gif' data-original='" + HttpUtility.HtmlDecode((string)DataBinder.Eval(e.Item.DataItem, "UrlThumb")).Replace("&", "&") + @"' class='lazy' id='_imgtemp' runat='server' /> </a>"; if (_lilist.Count > 0) { foreach (DataListItem _chk in gettydata.Items) { HtmlInputCheckBox _selchk = _chk.FindControl("chkimg") as HtmlInputCheckBox; if (_lilist.Contains(_selchk.Value)) { _selchk.Checked = true; } } } }
private void InitMultiView(string type, string message) { int numberOfModulesUpdates = 0; int numberOfLanguagesUpdates = 0; SelectView(ref type, ref message, ref numberOfModulesUpdates, ref numberOfLanguagesUpdates); Dictionary<string, BXUpdaterVersion> nonInstalledLanguagesUpdates; var currentView = MultiView1.Views[MultiView1.ActiveViewIndex]; if (currentView == ViewMain) { StringBuilder sb = new StringBuilder(); if (numberOfModulesUpdates > 0) sb.AppendFormat(GetMessage("FormatModules"), numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (sb.Length > 0) sb.Append(", "); sb.AppendFormat(GetMessage("FormatLanguageFiles"), numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (sb.Length <= 0) sb.Append(GetMessage("None")); lbImportantUpdates.Text = sb.ToString(); nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalUpdates.Text = String.Format(GetMessage("FormatAlsoAvailableLanguageFiles"), nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalUpdates.Text = ""; } else if (currentView == ViewNoUpdates) { nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalNoUpdates.Text = String.Format(GetMessage("FormatAvailableLanguageFiles"), nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalNoUpdates.Text = GetMessage("NoAvailableUpdates"); } else if (currentView == ViewDownload) { numberOfModulesUpdates = (siteUpdater.ServerManifest.Modules != null ? siteUpdater.ServerManifest.Modules.Count : 0); numberOfLanguagesUpdates = (siteUpdater.ServerManifest.InstalledLanguages != null ? siteUpdater.ServerManifest.InstalledLanguages.Count : 0); bool usUpdated = (siteUpdater.ServerManifest.UpdateSystemVersion != null); lbImportantUpdatesDld.Text = ""; if (numberOfModulesUpdates > 0) lbImportantUpdatesDld.Text += String.Format(GetMessage("FormatModules"), numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += String.Format(GetMessage("FormatLanguageFiles"), numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (usUpdated) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += GetMessage("UpdateSystemHasBeenUpdated"); } if (lbImportantUpdatesDld.Text.Length <= 0) lbImportantUpdatesDld.Text += GetMessage("None"); int numberOfLanguagesUpdates1 = (siteUpdater.ServerManifest.Languages != null ? siteUpdater.ServerManifest.Languages.Count - siteUpdater.ServerManifest.InstalledLanguages.Count : 0); if (numberOfLanguagesUpdates1 > 0) lbOtherUpdatesDld.Text = String.Format(GetMessage("FormatAlsoAvailableLanguageFiles"), numberOfLanguagesUpdates1, UpdateWord(numberOfLanguagesUpdates1)); else lbOtherUpdatesDld.Text = ""; } else if (currentView == ViewList) { List<string> modulesArray = new List<string>(); List<string> langsArray = new List<string>(); bool isListPostBack = false; if (!String.IsNullOrEmpty(hfViewListModules.Value) || !String.IsNullOrEmpty(hfViewListLangs.Value)) { isListPostBack = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) { string[] ma = hfViewListModules.Value.Split(','); foreach (string s in ma) modulesArray.Add(s); } if (!String.IsNullOrEmpty(hfViewListLangs.Value)) { string[] la = hfViewListLangs.Value.Split(','); foreach (string s in la) langsArray.Add(s); } } if (ViewListTable.Rows.Count > 1) for (int i = ViewListTable.Rows.Count - 1; i > 0; i--) ViewListTable.Rows.RemoveAt(i); Dictionary<string, BXUpdaterModule> modulesUpdates = siteUpdater.GetDownloadedModulesUpdates(); Dictionary<string, BXUpdaterVersion> modulesInstalled = BXUpdaterModuleManager.GetCurrentVersions(); foreach (KeyValuePair<string, BXUpdaterModule> kvp in modulesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cb_{0}", kvp.Key); cb.Name = String.Format("viewtable_cb_{0}", kvp.Key); if (isListPostBack) { cb.Checked = modulesArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) hfViewListModules.Value += ","; hfViewListModules.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('M', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = (modulesInstalled.ContainsKey(kvp.Key) ? GetMessage("ModuleUpdate") : GetMessage("NewModule")); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.versions.Values[kvp.Value.versions.Count - 1].version.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBodyRight"); td.InnerHtml = string.Format("<a href='javascript:ShowDescription(\"{0}\");'>{1}</a>", kvp.Key, GetMessage("Description")); tr.Cells.Add(td); tr.Attributes.Add("ondblclick", "ShowDescription('" + kvp.Key + "')"); ViewListTable.Rows.Add(tr); } Dictionary<string, BXUpdaterVersion> installedLanguagesUpdates = siteUpdater.GetDownloadedInstalledLanguagesUpdates(); foreach (KeyValuePair<string, BXUpdaterVersion> kvp in installedLanguagesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cbl_{0}", kvp.Key); cb.Name = String.Format("viewtable_cbl_{0}", kvp.Key); if (isListPostBack) { cb.Checked = langsArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListLangs.Value)) hfViewListLangs.Value += ","; hfViewListLangs.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('L', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = GetMessage("LanguageFiles"); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = " "; tr.Cells.Add(td); ViewListTable.Rows.Add(tr); } } else if (currentView == ViewFinish) { lbInstalledUpdates.Text = message; } displayMessage = message; }
protected void LanguageGrid_RowDataBound(object sender, GridViewRowEventArgs e) { GridView gv = (GridView)sender; if (e.Row.RowType == DataControlRowType.DataRow) { LocaleData data = (LocaleData)e.Row.DataItem; int iColumn = 0; if (data.Id == ContentLanguage) { e.Row.Visible = false; } HtmlInputCheckBox chkSelect = new HtmlInputCheckBox(); chkSelect.ID = "ExportLang"; chkSelect.Value = data.Id.ToString(); chkSelect.Attributes.Add("title", "Check to export"); chkSelect.Checked = data.Enabled; e.Row.Cells[iColumn].Controls.Add(chkSelect); iColumn += 1; // Flag Icon System.Web.UI.HtmlControls.HtmlImage objImg = new System.Web.UI.HtmlControls.HtmlImage(); objImg.Src = data.FlagUrl; objImg.Alt = data.FlagFile; objImg.Attributes.Add("title", objImg.Alt); objImg.Width = 16; objImg.Height = 16; e.Row.Cells[iColumn].Controls.Add(objImg); iColumn += 1; } }
private void AddLayerToLegend(string mapTabId, List<CommonLayer> configuredLayers, List<LayerProperties> layerProperties, HtmlGenericControl container, CommonLayer layer) { int i = configuredLayers.IndexOf(layer); if (i < 0) { return; } int tileWidth = AppSettings.SwatchTileWidth; int tileHeight = AppSettings.SwatchTileHeight; bool expanded = AppSettings.LegendExpanded; HtmlGenericControl legendEntry = new HtmlGenericControl("div"); container.Controls.Add(legendEntry); legendEntry.Attributes["class"] = "LegendEntry"; HtmlGenericControl legendHeader = new HtmlGenericControl("div"); legendEntry.Controls.Add(legendHeader); legendHeader.Attributes["class"] = "LegendHeader"; HtmlGenericControl expander = new HtmlGenericControl("span"); legendHeader.Controls.Add(expander); expander.Attributes["class"] = "LegendExpander " + (expanded ? "Expanded" : "Collapsed"); if (layerProperties[i].CheckMode != CheckMode.None) { HtmlGenericControl visibility = new HtmlGenericControl("span"); legendHeader.Controls.Add(visibility); visibility.Attributes["class"] = "LegendVisibility"; if (layerProperties[i].CheckMode != CheckMode.Empty) { HtmlControl check = null; if (layerProperties[i].IsExclusive) { HtmlInputRadioButton radio = new HtmlInputRadioButton(); radio.Checked = layerProperties[i].CheckMode == CheckMode.Checked; radio.Name = String.Format("{0}_{1}", mapTabId, layer.Parent.ID); check = radio; } else { HtmlInputCheckBox checkBox = new HtmlInputCheckBox(); checkBox.Checked = layerProperties[i].CheckMode == CheckMode.Checked; check = checkBox; } visibility.Controls.Add(check); check.Attributes["class"] = "LegendCheck"; check.Attributes["data-layer"] = layerProperties[i].Tag; } } HtmlGenericControl name = new HtmlGenericControl("span"); legendHeader.Controls.Add(name); name.Attributes["class"] = "LegendName"; if (!String.IsNullOrEmpty(layerProperties[i].MetaDataUrl)) { HtmlAnchor a = new HtmlAnchor(); name.Controls.Add(a); a.HRef = layerProperties[i].MetaDataUrl; a.Target = "metadata"; a.InnerText = layerProperties[i].Name; a.Attributes["class"] = "LegendMetadata"; } else { name.InnerText = layerProperties[i].Name; } HtmlGenericControl content = new HtmlGenericControl("div"); content.Attributes["class"] = "LegendContent"; content.Style["display"] = expanded ? "block" : "none"; switch (layer.Type) { case CommonLayerType.Group: if (layer.Children != null) { foreach (CommonLayer childLayer in layer.Children) { AddLayerToLegend(mapTabId, configuredLayers, layerProperties, content, childLayer); } } break; case CommonLayerType.Feature: int layerIndex = layer.DataFrame.Layers.IndexOf(layer); if (layer.Legend != null) { int n = 0; string escapedMapTabId = Server.UrlEncode(mapTabId); for (int g = 0; g < layer.Legend.Groups.Count; ++g) { int classCount = layer.Legend.Groups[g].Classes.Count; for (int c = 0; c < classCount; ++c) { if (!layer.Legend.Groups[g].Classes[c].ImageIsTransparent) { HtmlGenericControl legendClass = new HtmlGenericControl("div"); content.Controls.Add(legendClass); legendClass.Attributes["class"] = "LegendClass"; HtmlGenericControl legendSwatch = new HtmlGenericControl("span"); legendClass.Controls.Add(legendSwatch); legendSwatch.Attributes["class"] = "LegendSwatch"; legendSwatch.Style["background"] = String.Format("transparent url(CompiledSwatch.ashx?maptab={0}&c={1}) no-repeat scroll -{2}px -{3}px", escapedMapTabId, AppContext.ConfigurationKey, tileWidth * layerIndex, tileHeight * n); using (MemoryStream stream = new MemoryStream(layer.Legend.Groups[g].Classes[c].Image)) { using (Bitmap swatch = new Bitmap(stream)) { legendClass.Style["height"] = String.Format("{0}px", swatch.Height); legendSwatch.Style["width"] = String.Format("{0}px", swatch.Width); legendSwatch.Style["height"] = String.Format("{0}px", swatch.Height); } } if (classCount > 1 || layer.Legend.Groups.Count > 1) { HtmlGenericControl className = new HtmlGenericControl("span"); legendClass.Controls.Add(className); className.Attributes["class"] = "LegendClassName"; className.InnerText = layer.Legend.Groups[g].Classes[c].Label; } } n += 1; } } } break; case CommonLayerType.Annotation: if (layer.Children != null) { foreach (CommonLayer childLayer in layer.Children) { AddLayerToLegend(mapTabId, configuredLayers, layerProperties, content, childLayer); } } break; } if (content.Controls.Count == 0) { expander.Attributes["class"] = "LegendExpander Empty"; } else { legendEntry.Controls.Add(content); } }
private void InitMultiView(string type, string message) { int numberOfModulesUpdates = 0; int numberOfLanguagesUpdates = 0; if (String.IsNullOrEmpty(type)) { try { if (siteUpdater.IsUpdateSystemUpdated()) { MultiView1.ActiveViewIndex = 6; } else { bool flag = siteUpdater.CheckForUpdates(); if (siteUpdater.ServerManifest.UpdateSystemVersion != null) { MultiView1.ActiveViewIndex = 2; } else { if (siteUpdater.ServerManifest.Client.reserved) { MultiView1.ActiveViewIndex = 8; } else { if (siteUpdater.ServerManifest.IsServerLicenseNewer()) { MultiView1.ActiveViewIndex = 7; } else { if (flag) { MultiView1.ActiveViewIndex = 2; } else { Dictionary<string, BXUpdaterModule> modulesUpdates = siteUpdater.GetDownloadedModulesUpdates(); Dictionary<string, BXUpdaterVersion> installedLanguagesUpdates = siteUpdater.GetDownloadedInstalledLanguagesUpdates(); numberOfModulesUpdates = (modulesUpdates != null ? modulesUpdates.Count : 0); numberOfLanguagesUpdates = (installedLanguagesUpdates != null ? installedLanguagesUpdates.Count : 0); if (numberOfModulesUpdates > 0 || numberOfLanguagesUpdates > 0) { if (MultiView1.ActiveViewIndex != 3) MultiView1.ActiveViewIndex = 0; } else { MultiView1.ActiveViewIndex = 1; } } } } } } } catch (Exception e) { type = "error"; MultiView1.ActiveViewIndex = 5; message = GetError(e); } } else if (type.Equals("error", StringComparison.InvariantCultureIgnoreCase)) { MultiView1.ActiveViewIndex = 5; } else { MultiView1.ActiveViewIndex = 4; } Dictionary<string, BXUpdaterVersion> nonInstalledLanguagesUpdates; switch (MultiView1.ActiveViewIndex) { case 0: StringBuilder sb = new StringBuilder(); if (numberOfModulesUpdates > 0) sb.AppendFormat(GetMessage("FormatModules"), numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (sb.Length > 0) sb.Append(", "); sb.AppendFormat(GetMessage("FormatLanguageFiles"), numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (sb.Length <= 0) sb.Append(GetMessage("None")); lbImportantUpdates.Text = sb.ToString(); nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalUpdates.Text = String.Format(GetMessage("FormatAlsoAvailableLanguageFiles"), nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalUpdates.Text = ""; break; case 1: nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalNoUpdates.Text = String.Format(GetMessage("FormatAvailableLanguageFiles"), nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalNoUpdates.Text = GetMessage("NoAvailableUpdates"); break; case 2: numberOfModulesUpdates = (siteUpdater.ServerManifest.Modules != null ? siteUpdater.ServerManifest.Modules.Count : 0); numberOfLanguagesUpdates = (siteUpdater.ServerManifest.InstalledLanguages != null ? siteUpdater.ServerManifest.InstalledLanguages.Count : 0); bool usUpdated = (siteUpdater.ServerManifest.UpdateSystemVersion != null); lbImportantUpdatesDld.Text = ""; if (numberOfModulesUpdates > 0) lbImportantUpdatesDld.Text += String.Format(GetMessage("FormatModules"), numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += String.Format(GetMessage("FormatLanguageFiles"), numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (usUpdated) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += GetMessage("UpdateSystemHasBeenUpdated"); } if (lbImportantUpdatesDld.Text.Length <= 0) lbImportantUpdatesDld.Text += GetMessage("None"); int numberOfLanguagesUpdates1 = (siteUpdater.ServerManifest.Languages != null ? siteUpdater.ServerManifest.Languages.Count - siteUpdater.ServerManifest.InstalledLanguages.Count : 0); if (numberOfLanguagesUpdates1 > 0) lbOtherUpdatesDld.Text = String.Format(GetMessage("FormatAlsoAvailableLanguageFiles"), numberOfLanguagesUpdates1, UpdateWord(numberOfLanguagesUpdates1)); else lbOtherUpdatesDld.Text = ""; break; case 3: List<string> modulesArray = new List<string>(); List<string> langsArray = new List<string>(); bool isListPostBack = false; if (!String.IsNullOrEmpty(hfViewListModules.Value) || !String.IsNullOrEmpty(hfViewListLangs.Value)) { isListPostBack = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) { string[] ma = hfViewListModules.Value.Split(','); foreach (string s in ma) modulesArray.Add(s); } if (!String.IsNullOrEmpty(hfViewListLangs.Value)) { string[] la = hfViewListLangs.Value.Split(','); foreach (string s in la) langsArray.Add(s); } } if (ViewListTable.Rows.Count > 1) for (int i = ViewListTable.Rows.Count - 1; i > 0; i--) ViewListTable.Rows.RemoveAt(i); Dictionary<string, BXUpdaterModule> modulesUpdates = siteUpdater.GetDownloadedModulesUpdates(); Dictionary<string, BXUpdaterVersion> modulesInstalled = BXUpdaterModuleManager.GetCurrentVersions(); foreach (KeyValuePair<string, BXUpdaterModule> kvp in modulesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cb_{0}", kvp.Key); cb.Name = String.Format("viewtable_cb_{0}", kvp.Key); if (isListPostBack) { cb.Checked = modulesArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) hfViewListModules.Value += ","; hfViewListModules.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('M', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = (modulesInstalled.ContainsKey(kvp.Key) ? GetMessage("ModuleUpdate") : GetMessage("NewModule")); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.versions.Values[kvp.Value.versions.Count - 1].version.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBodyRight"); td.InnerHtml = string.Format("<a href='javascript:ShowDescription(\"{0}\");'>{1}</a>", kvp.Key, GetMessage("Description")); tr.Cells.Add(td); tr.Attributes.Add("ondblclick", "ShowDescription('" + kvp.Key + "')"); ViewListTable.Rows.Add(tr); } Dictionary<string, BXUpdaterVersion> installedLanguagesUpdates = siteUpdater.GetDownloadedInstalledLanguagesUpdates(); foreach (KeyValuePair<string, BXUpdaterVersion> kvp in installedLanguagesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cbl_{0}", kvp.Key); cb.Name = String.Format("viewtable_cbl_{0}", kvp.Key); if (isListPostBack) { cb.Checked = langsArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListLangs.Value)) hfViewListLangs.Value += ","; hfViewListLangs.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('L', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = GetMessage("LanguageFiles"); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = " "; tr.Cells.Add(td); ViewListTable.Rows.Add(tr); } break; case 4: lbInstalledUpdates.Text = message; break; case 5: lbUpdateError.Text = message; if (message.Contains("EMPTY_LICENSE_KEY") || message.Contains("LICENSE_NOT_FOUND")) { lbUpdateError.Text += "<br/><br/>"; lbUpdateError.Text += GetMessageRaw("FormatHowYouCanGetKeyCommentFull"); } break; case 6: break; case 7: iframeLicenseAgreement.Attributes["src"] = siteUpdater.ServerManifest.NewLicensePath; hfAgreeLicenceVersion.Value = siteUpdater.ServerManifest.NewLicense.ToString(); break; case 8: if (Page.IsPostBack) { rfvActUserLastName.Enabled = cbActGenerateUser.Checked; rfvActUserLogin.Enabled = cbActGenerateUser.Checked; rfvActUserName.Enabled = cbActGenerateUser.Checked; rfvActUserPassword.Enabled = cbActGenerateUser.Checked; rfvActUserPasswordConf.Enabled = cbActGenerateUser.Checked; cvActUserPasswordConf.Enabled = cbActGenerateUser.Checked; } cbActGenerateUser.Attributes["onclick"] = "ActivateEnableDisableUser(this)"; break; default: break; } }
private void InitMultiView(string type, string message) { int numberOfModulesUpdates = 0; int numberOfLanguagesUpdates = 0; if (String.IsNullOrEmpty(type)) { try { if (siteUpdater.IsUpdateSystemUpdated()) { MultiView1.ActiveViewIndex = 6; } else { bool flag = siteUpdater.CheckForUpdates(); if (siteUpdater.ServerManifest.UpdateSystemVersion != null) { MultiView1.ActiveViewIndex = 2; } else { if (siteUpdater.ServerManifest.Client.reserved) { MultiView1.ActiveViewIndex = 8; } else { if (siteUpdater.ServerManifest.IsServerLicenseNewer()) { MultiView1.ActiveViewIndex = 7; } else { if (flag) { MultiView1.ActiveViewIndex = 2; } else { Dictionary<string, BXUpdaterModule> modulesUpdates = siteUpdater.GetDownloadedModulesUpdates(); Dictionary<string, BXUpdaterVersion> installedLanguagesUpdates = siteUpdater.GetDownloadedInstalledLanguagesUpdates(); numberOfModulesUpdates = (modulesUpdates != null ? modulesUpdates.Count : 0); numberOfLanguagesUpdates = (installedLanguagesUpdates != null ? installedLanguagesUpdates.Count : 0); if (numberOfModulesUpdates > 0 || numberOfLanguagesUpdates > 0) { if (MultiView1.ActiveViewIndex != 3) MultiView1.ActiveViewIndex = 0; } else { MultiView1.ActiveViewIndex = 1; } } } } } } } catch (Exception e) { type = "error"; MultiView1.ActiveViewIndex = 5; message = String.Format("{0}<br/>{1}", e.Message, ((e.InnerException != null) ? e.InnerException.Message : "")); } } else if (type.Equals("error", StringComparison.InvariantCultureIgnoreCase)) { MultiView1.ActiveViewIndex = 5; } else { MultiView1.ActiveViewIndex = 4; } Dictionary<string, BXUpdaterVersion> nonInstalledLanguagesUpdates; switch (MultiView1.ActiveViewIndex) { case 0: StringBuilder sb = new StringBuilder(); if (numberOfModulesUpdates > 0) sb.AppendFormat("{0} {1} модулей", numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (sb.Length > 0) sb.Append(", "); sb.AppendFormat("{0} {1} языковых файлов", numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (sb.Length <= 0) sb.Append("нет"); lbImportantUpdates.Text = sb.ToString(); nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalUpdates.Text = String.Format("Также доступны: {0} {1} языковых файлов, не использующихся на сайте", nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalUpdates.Text = ""; break; case 1: nonInstalledLanguagesUpdates = siteUpdater.GetDownloadedNonInstalledLanguagesUpdates(); if (nonInstalledLanguagesUpdates != null && nonInstalledLanguagesUpdates.Count > 0) lbOptionalNoUpdates.Text = String.Format("Доступны: {0} {1} языковых файлов, не использующихся на сайте", nonInstalledLanguagesUpdates.Count, UpdateWord(nonInstalledLanguagesUpdates.Count)); else lbOptionalNoUpdates.Text = "Нет доступных обновлений"; break; case 2: numberOfModulesUpdates = (siteUpdater.ServerManifest.Modules != null ? siteUpdater.ServerManifest.Modules.Count : 0); numberOfLanguagesUpdates = (siteUpdater.ServerManifest.InstalledLanguages != null ? siteUpdater.ServerManifest.InstalledLanguages.Count : 0); bool usUpdated = (siteUpdater.ServerManifest.UpdateSystemVersion != null); lbImportantUpdatesDld.Text = ""; if (numberOfModulesUpdates > 0) lbImportantUpdatesDld.Text += String.Format("{0} {1} модулей", numberOfModulesUpdates, UpdateWord(numberOfModulesUpdates)); if (numberOfLanguagesUpdates > 0) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += String.Format("{0} {1} языковых файлов", numberOfLanguagesUpdates, UpdateWord(numberOfLanguagesUpdates)); } if (usUpdated) { if (lbImportantUpdatesDld.Text.Length > 0) lbImportantUpdatesDld.Text += ", "; lbImportantUpdatesDld.Text += "обновлена система обновлений"; } if (lbImportantUpdatesDld.Text.Length <= 0) lbImportantUpdatesDld.Text += "нет"; int numberOfLanguagesUpdates1 = (siteUpdater.ServerManifest.Languages != null ? siteUpdater.ServerManifest.Languages.Count - siteUpdater.ServerManifest.InstalledLanguages.Count : 0); if (numberOfLanguagesUpdates1 > 0) lbOtherUpdatesDld.Text = String.Format("Также доступны: {0} {1} языковых файлов, не использующихся на сайте", numberOfLanguagesUpdates1, UpdateWord(numberOfLanguagesUpdates1)); else lbOtherUpdatesDld.Text = ""; break; case 3: List<string> modulesArray = new List<string>(); List<string> langsArray = new List<string>(); bool isListPostBack = false; if (!String.IsNullOrEmpty(hfViewListModules.Value) || !String.IsNullOrEmpty(hfViewListLangs.Value)) { isListPostBack = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) { string[] ma = hfViewListModules.Value.Split(','); foreach (string s in ma) modulesArray.Add(s); } if (!String.IsNullOrEmpty(hfViewListLangs.Value)) { string[] la = hfViewListLangs.Value.Split(','); foreach (string s in la) langsArray.Add(s); } } if (ViewListTable.Rows.Count > 1) for (int i = ViewListTable.Rows.Count - 1; i > 0; i--) ViewListTable.Rows.RemoveAt(i); Dictionary<string, BXUpdaterModule> modulesUpdates = siteUpdater.GetDownloadedModulesUpdates(); Dictionary<string, BXUpdaterVersion> modulesInstalled = BXUpdaterModuleManager.GetCurrentVersions(); foreach (KeyValuePair<string, BXUpdaterModule> kvp in modulesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cb_{0}", kvp.Key); cb.Name = String.Format("viewtable_cb_{0}", kvp.Key); if (isListPostBack) { cb.Checked = modulesArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListModules.Value)) hfViewListModules.Value += ","; hfViewListModules.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('M', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = (modulesInstalled.ContainsKey(kvp.Key) ? "Обновление модуля" : "Новый модуль"); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.versions.Values[kvp.Value.versions.Count - 1].version.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBodyRight"); td.InnerHtml = "<a href='javascript:ShowDescription(\"" + kvp.Key + "\");'>Описание</a>"; tr.Cells.Add(td); tr.Attributes.Add("ondblclick", "ShowDescription('" + kvp.Key + "')"); ViewListTable.Rows.Add(tr); } Dictionary<string, BXUpdaterVersion> installedLanguagesUpdates = siteUpdater.GetDownloadedInstalledLanguagesUpdates(); foreach (KeyValuePair<string, BXUpdaterVersion> kvp in installedLanguagesUpdates) { HtmlTableRow tr = new HtmlTableRow(); HtmlTableCell td = new HtmlTableCell(); td.Style.Add("width", "30px"); td.Style.Add("text-align", "center"); td.Attributes.Add("class", "ListBody"); HtmlInputCheckBox cb = new HtmlInputCheckBox(); cb.ID = String.Format("id_viewtable_cbl_{0}", kvp.Key); cb.Name = String.Format("viewtable_cbl_{0}", kvp.Key); if (isListPostBack) { cb.Checked = langsArray.Contains(kvp.Key); } else { cb.Checked = true; if (!String.IsNullOrEmpty(hfViewListLangs.Value)) hfViewListLangs.Value += ","; hfViewListLangs.Value += kvp.Key; } cb.Value = "Y"; cb.Attributes.Add("onclick", "ViewListClick('L', this, '" + kvp.Key + "')"); td.Controls.Add(cb); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Key; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = "Языковые файлы"; tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = kvp.Value.ToString(); tr.Cells.Add(td); td = new HtmlTableCell(); td.Attributes.Add("class", "ListBody"); td.InnerHtml = " "; tr.Cells.Add(td); ViewListTable.Rows.Add(tr); } break; case 4: lbInstalledUpdates.Text = message; break; case 5: lbUpdateError.Text = message; if (message.Contains("EMPTY_LICENSE_KEY") || message.Contains("LICENSE_NOT_FOUND")) lbUpdateError.Text += String.Format("<br/><br/>Если у вас нет лицензионного ключа, то для активизации системы обновлений вам необходимо зарегистрироваться и получить <a href=\"{0}\" target=\"_blank\">пробный лицензионный ключ</a>.", "http://www.1c-bitrix.ru/bsm_register_net.php"); break; case 6: break; case 7: iframeLicenseAgreement.Attributes["src"] = siteUpdater.ServerManifest.NewLicensePath; hfAgreeLicenceVersion.Value = siteUpdater.ServerManifest.NewLicense.ToString(); break; case 8: if (Page.IsPostBack) { rfvActUserLastName.Enabled = cbActGenerateUser.Checked; rfvActUserLogin.Enabled = cbActGenerateUser.Checked; rfvActUserName.Enabled = cbActGenerateUser.Checked; rfvActUserPassword.Enabled = cbActGenerateUser.Checked; rfvActUserPasswordConf.Enabled = cbActGenerateUser.Checked; cvActUserPasswordConf.Enabled = cbActGenerateUser.Checked; } cbActGenerateUser.Attributes["onclick"] = "ActivateEnableDisableUser(this)"; break; default: break; } }