public void SetControlsEnabledTest() { // 测试用例1 SmartForm.SetControlsEnabled((Control.ControlCollection)null, (List <Control>)null); // 测试用例2 Control.ControlCollection controlCollection; controlCollection = new Control.ControlCollection((Control)null); SmartForm.SetControlsEnabled(controlCollection, (List <Control>)null); }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_Artificiallake.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_Artificiallake = new Fire_Artificiallake(); } if (m_OperationType == OperationType.Add) { this.m_Artificiallake = new Fire_Artificiallake(); } this.m_Artificiallake.longitude = this.coordinatesInputControl1.Longitude; this.m_Artificiallake.latitude = this.coordinatesInputControl1.Latitude; this.m_Artificiallake.pac = this.pacControl11.LocalPac; this.m_Artificiallake.city_name = this.pacControl11.City; this.m_Artificiallake.county_name = this.pacControl11.County; this.m_Artificiallake.shape = Converters.LngLatToWKT(this.m_Artificiallake.longitude, this.m_Artificiallake.latitude); //自动从窗体控件上取值 m_Artificiallake = SmartForm.GetEntity <Fire_Artificiallake>(this.tabPage_baseInfo.Controls, this.m_Artificiallake); this.m_Artificiallake.note = this.tbx_note.Text.Trim(); this.m_Artificiallake.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_ArtificiallakeController.Add(this.m_Artificiallake); } else if (m_OperationType == OperationType.Edit) { this.m_ArtificiallakeController.Edit(this.m_Artificiallake); } }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_FireDocument.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_FireDocument = new Fire_Document(); } this.m_FireDocument.longitude = this.coordinatesInputControl1.Longitude; this.m_FireDocument.latitude = this.coordinatesInputControl1.Latitude; this.m_FireDocument.pac = this.pacControl11.LocalPac; this.m_FireDocument.code = this.m_FireDocument.pac; this.m_FireDocument.province = this.pacControl11.Province; this.m_FireDocument.city = this.pacControl11.City; this.m_FireDocument.county = this.pacControl11.County; this.m_FireDocument.town_name = this.tbx_town_name.Text.Trim(); this.m_FireDocument.village_name = this.tbx_village_name.Text.Trim(); this.m_FireDocument.shape = Converters.LngLatToWKT((double)this.m_FireDocument.longitude, (double)this.m_FireDocument.latitude); //自动从窗体控件上取值 m_FireDocument = SmartForm.GetEntity <Fire_Document>(this.tabPage_baseInfo.Controls, this.m_FireDocument); this.m_FireDocument.description = this.tbx_description.Text.Trim(); this.m_FireDocument.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_FireDocumentController.Add(this.m_FireDocument); } else if (m_OperationType == OperationType.Edit) { this.m_FireDocumentController.Edit(this.m_FireDocument); } }
public void ValidatorTest() { bool b; // 测试用例1 b = SmartForm.Validator ((Control.ControlCollection)null, (IDictionary <string, string>)null); // 测试用例2 Control.ControlCollection controlCollection; controlCollection = new Control.ControlCollection((Control)null); b = SmartForm.Validator(controlCollection, (IDictionary <string, string>)null); }
/// <summary> /// Executes the specified method. /// </summary> /// <param name="method">The method.</param> /// <param name="args">The args.</param> /// <returns></returns> public object Execute(SmartForm smartForm, string method, params object[] args) { if (smartForm == null) { throw new ArgumentNullException("smartForm"); } if ((args == null) || (args.Length == 0)) { args = _defaultArgs; } // send email int smsSent = 0; var usedPhoneIDs = new List <string>(); for (int argIndex = 1; argIndex < args.Length; argIndex++) { string scopeKey = (args[argIndex] as string); if (scopeKey == null) { throw new ArgumentNullException(string.Format("args[{0}]", argIndex)); } if (scopeKey.Length > 0) { scopeKey += "::"; } foreach (string phone2 in smartForm[scopeKey + "phone"].Replace(";", ",").Split(',')) { string phone = phone2.Trim(); if (!string.IsNullOrEmpty(phone) && !usedPhoneIDs.Contains(phone.ToLowerInvariant())) { string carrierIDAsText = smartForm[scopeKey + "carrierID"]; ShortMessageServiceCarrierID carrierID; if (!string.IsNullOrEmpty(carrierIDAsText) && EnumEx.TryParse <ShortMessageServiceCarrierID>(carrierIDAsText, out carrierID)) { // execute var message = new ShortMessageServiceMessage { Phone = phone, CarrierID = carrierID, Body = smartForm.CreateMergedText(scopeKey + "textBody"), }; Exception ex; _smsClient.TrySend(message, out ex); smsSent++; } // prevent resends usedPhoneIDs.Add(phone.ToLowerInvariant()); } } usedPhoneIDs.Clear(); } return(smsSent); }
public void FillTest() { // 测试用例1 SmartForm.Fill((Control.ControlCollection)null, (object)null); // 测试用例2 object s0 = new object(); SmartForm.Fill((Control.ControlCollection)null, s0); // 测试用例3 Control.ControlCollection controlCollection; controlCollection = new Control.ControlCollection((Control)null); SmartForm.Fill(controlCollection, s0); }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_RadioStation.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_RadioStation = new Fire_RadioStation(); } this.m_RadioStation.longitude = this.coordinatesInputControl1.Longitude; this.m_RadioStation.latitude = this.coordinatesInputControl1.Latitude; this.m_RadioStation.pac = this.pacControl11.LocalPac; this.m_RadioStation.city = this.pacControl11.City; this.m_RadioStation.county = this.pacControl11.County; this.m_RadioStation.shape = Converters.LngLatToWKT(this.m_RadioStation.longitude, this.m_RadioStation.latitude); //自动从窗体控件上取值 this.m_RadioStation = SmartForm.GetEntity <Fire_RadioStation>(this.tabPage_baseInfo.Controls, this.m_RadioStation); this.m_RadioStation.build_year = this.dtp_build_year.Value.ToString("yyyy-MM-dd hh:mm:ss"); this.m_RadioStation.note = this.tbx_note.Text.Trim(); this.m_RadioStation.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_RadioStationController.Add(this.m_RadioStation); } else if (m_OperationType == OperationType.Edit) { this.m_RadioStationController.Edit(this.m_RadioStation); } }
public void GetEntityTest() { object o; //测试用例1 o = SmartForm.GetEntity <object>((Control.ControlCollection)null, (object)null); //测试用例2 object s0 = new object(); o = SmartForm.GetEntity <object>((Control.ControlCollection)null, s0); //测试用例3 Control.ControlCollection controlCollection; controlCollection = new Control.ControlCollection((Control)null); o = SmartForm.GetEntity <object>(controlCollection, (object)null); }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_DangerousFacilities.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_DangerousFacilities = new Fire_DangerousFacilities(); } this.m_DangerousFacilities.longitude = this.coordinatesInputControl1.Longitude; this.m_DangerousFacilities.latitude = this.coordinatesInputControl1.Latitude; this.m_DangerousFacilities.pac = this.pacControl11.LocalPac; this.m_DangerousFacilities.shape = Converters.LngLatToWKT(this.m_DangerousFacilities.longitude, this.m_DangerousFacilities.latitude); //自动从窗体控件上取值 m_DangerousFacilities = SmartForm.GetEntity <Fire_DangerousFacilities>(this.tabPage_baseInfo.Controls, this.m_DangerousFacilities); this.m_DangerousFacilities.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { FormWaitingBox f = new FormWaitingBox((obj, args) => { this.m_DFacilitiesController.Add(this.m_DangerousFacilities); }, 10, "正在提交数据,请耐心等待....", false, false); f.ShowDialog(this); } else if (m_OperationType == OperationType.Edit) { this.m_DFacilitiesController.Edit(this.m_DangerousFacilities); } }
/// <summary> /// Executes the specified method. /// </summary> /// <param name="smartForm">The smart form.</param> /// <param name="method">The method.</param> /// <param name="args">The args.</param> /// <returns></returns> public object Execute(SmartForm smartForm, string method, params object[] args) { if (smartForm == null) throw new ArgumentNullException("smartForm"); if (args == null || args.Length == 0) args = _defaultArgs; // send email var smsSent = 0; var usedPhoneIDs = new List<string>(); for (var argIndex = 1; argIndex < args.Length; argIndex++) { var scopeKey = (args[argIndex] as string); if (scopeKey == null) throw new ArgumentNullException(string.Format("args[{0}]", argIndex)); if (scopeKey.Length > 0) scopeKey += "::"; foreach (var phone2 in smartForm[scopeKey + "phone"].Replace(";", ",").Split(',')) { var phone = phone2.Trim(); if (!string.IsNullOrEmpty(phone) && !usedPhoneIDs.Contains(phone.ToLowerInvariant())) { var carrierIDAsText = smartForm[scopeKey + "carrierID"]; ShortMessageServiceCarrierID carrierID; if (!string.IsNullOrEmpty(carrierIDAsText) && EnumEx.TryParse<ShortMessageServiceCarrierID>(carrierIDAsText, out carrierID)) { // execute var message = new ShortMessageServiceMessage { Phone = phone, CarrierID = carrierID, Body = smartForm.CreateMergedText(scopeKey + "textBody"), }; Exception ex; _smsClient.TrySend(message, out ex); smsSent++; } // prevent resends usedPhoneIDs.Add(phone.ToLowerInvariant()); } } usedPhoneIDs.Clear(); } if (EnsureSent && smsSent == 0) throw new InvalidOperationException("EnsureSent"); return smsSent; }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_FireImportantUnits.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_FireImportantUnits = new Fire_ImportantUnits(); } this.m_FireImportantUnits.longitude = this.coordinatesInputControl1.Longitude; this.m_FireImportantUnits.latitude = this.coordinatesInputControl1.Latitude; this.m_FireImportantUnits.pac = this.pacControl11.LocalPac; this.m_FireImportantUnits.SHAPE = Converters.LngLatToWKT(this.m_FireImportantUnits.longitude, this.m_FireImportantUnits.latitude); //自动从窗体控件上取值 m_FireImportantUnits = SmartForm.GetEntity <Fire_ImportantUnits>(this.tabPage_baseInfo.Controls, this.m_FireImportantUnits); this.m_FireImportantUnits.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_FireIUnitsController.Add(this.m_FireImportantUnits); } else if (m_OperationType == OperationType.Edit) { this.m_FireIUnitsController.Edit(this.m_FireImportantUnits); } }
/// <summary> /// Executes the specified method. /// </summary> /// <param name="smartForm">The smart form.</param> /// <param name="emailMessage">The email message.</param> /// <param name="scopeKey">The scope key.</param> public void Execute(SmartForm smartForm, MailMessage emailMessage, string scopeKey) { if (smartForm == null) throw new ArgumentNullException("smartForm"); if (emailMessage == null) throw new ArgumentNullException("emailMessage"); if (scopeKey == null) throw new ArgumentNullException("scopeKey"); // var htmlBody = smartForm.CreateMergedText(scopeKey + "htmlBody"); if (htmlBody.Length > 0) { if ((_htmlSchema != null) && (htmlBody.IndexOf("<html>", StringComparison.OrdinalIgnoreCase) == -1)) htmlBody = "<html><body>" + _htmlSchema.DecodeHtml(htmlBody, (int)HtmlSchemaBase.DecodeFlags.CrLfToBr) + "</body></html>"; emailMessage.IsBodyHtml = true; emailMessage.Body = htmlBody; } else { emailMessage.IsBodyHtml = false; emailMessage.Body = smartForm.CreateMergedText(scopeKey + "textBody"); } }
private void FormRadioStation_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增无线电台站"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑无线电台站"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看无线电台站"; this.mediaControl1.MainToolStrip.Visible = false; } /* 瞭望台状态 */ RadioStationStatus radioStationStatus = RadioStationStatus.优秀; List <object> watchTowerStatusList = CommonHelper.GetDataSource <RadioStationStatus>(radioStationStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Value"; this.cbx_status.DataSource = watchTowerStatusList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_RadioStation.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_RadioStation.longitude; this.coordinatesInputControl1.Latitude = this.m_RadioStation.latitude; //窗体自动赋值 SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_RadioStation); this.tbx_note.Text = this.m_RadioStation.note; this.mediaControl1.MediaFiles = this.m_RadioStation.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }
private void FormFireForestBelt_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增防护林带"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑防护林带"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看防护林带"; this.mediaControl1.MainToolStrip.Visible = false; } /* 防护林带营造单位 */ FireForestBeltBuildUnit fireForestBeltBuildUnit = FireForestBeltBuildUnit.林业局; List <object> fireForestBeltBuildUnitList = CommonHelper.GetDataSource <FireForestBeltBuildUnit>(fireForestBeltBuildUnit); this.cbx_build_unit.DisplayMember = "Name"; this.cbx_build_unit.ValueMember = "Name"; this.cbx_build_unit.DataSource = fireForestBeltBuildUnitList; /* 防护林带放火林带 */ FireForestBeltType fireForestBeltType = FireForestBeltType.主防火林带; List <object> fireForestBeltTypeList = CommonHelper.GetDataSource <FireForestBeltType>(fireForestBeltType); this.cbx_type.DisplayMember = "Name"; this.cbx_type.ValueMember = "Name"; this.cbx_type.DataSource = fireForestBeltTypeList; /* 防护林带营造位置 */ FireForestBeltBuildAddr fireForestBeltBuildAddr = FireForestBeltBuildAddr.边境防火林带; List <object> fireForestBeltBuildAddrList = CommonHelper.GetDataSource <FireForestBeltBuildAddr>(fireForestBeltBuildAddr); this.cbx_build_addr.DisplayMember = "Name"; this.cbx_build_addr.ValueMember = "Name"; this.cbx_build_addr.DataSource = fireForestBeltBuildAddrList; /* 防护林带状态 */ FireForestBeltStatus fireForestBeltStatus = FireForestBeltStatus.优秀; List <object> fireForestBeltStatusList = CommonHelper.GetDataSource <FireForestBeltStatus>(fireForestBeltStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Value"; this.cbx_status.DataSource = fireForestBeltStatusList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_FireForestBelt.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_FireForestBelt.longitude; this.coordinatesInputControl1.Latitude = this.m_FireForestBelt.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_FireForestBelt); this.tbx_note.Text = this.m_FireForestBelt.note; this.mediaControl1.MediaFiles = this.m_FireForestBelt.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }
private void FormFireDocument_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增火灾档案"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑火灾档案"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看火灾档案"; this.mediaControl1.MainToolStrip.Visible = false; } /* 坡位 */ FireDocumentSlopePosition fireDSlopePosition = FireDocumentSlopePosition.山脊; List <object> fireDSlopePositionList = CommonHelper.GetDataSource <FireDocumentSlopePosition>(fireDSlopePosition); this.cbx_slope_position.DisplayMember = "Name"; this.cbx_slope_position.ValueMember = "Name"; this.cbx_slope_position.DataSource = fireDSlopePositionList; /* 是否已处理 */ IsDealWith isDealWith = IsDealWith.否; List <object> isDealWithList = CommonHelper.GetDataSource <IsDealWith>(isDealWith); this.cbx_IsDealWith.DisplayMember = "Name"; this.cbx_IsDealWith.ValueMember = "Value"; this.cbx_IsDealWith.DataSource = isDealWithList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_FireDocument.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = (this.m_FireDocument.longitude == null)?0:(double)this.m_FireDocument.longitude; this.coordinatesInputControl1.Latitude = (this.m_FireDocument.latitude == null) ? 0 : (double)this.m_FireDocument.latitude; this.tbx_town_name.Text = (this.m_FireDocument.town_name == null)?"":this.m_FireDocument.town_name; this.tbx_village_name.Text = (this.m_FireDocument.village_name == null) ? "" : this.m_FireDocument.village_name; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_FireDocument); this.tbx_description.Text = this.m_FireDocument.description; this.mediaControl1.MediaFiles = this.m_FireDocument.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; this.tbx_town_name.Enabled = false; this.tbx_village_name.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_description.Enabled = false; } } #endregion }
private void FormFireForestBelt_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增飞机吊桶取水点"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑飞机吊桶取水点"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看飞机吊桶取水点"; this.mediaControl1.MainToolStrip.Visible = false; } /* 飞机吊桶取水点状态 */ PWType firePWType = PWType.水库; List <object> firePWTypeList = CommonHelper.GetDataSource <PWType>(firePWType); this.cbx_Type.DisplayMember = "Name"; this.cbx_Type.ValueMember = "Name"; this.cbx_Type.DataSource = firePWTypeList; /* 飞机吊桶取水点状态 */ PWStatus firePWStatus = PWStatus.优秀; List <object> firePWStatusList = CommonHelper.GetDataSource <PWStatus>(firePWStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Name"; this.cbx_status.DataSource = firePWStatusList; /* 飞机吊桶取水点有无电线索道 */ PWIsCableway isCableway = PWIsCableway.是; List <object> isCablewayList = CommonHelper.GetDataSource <PWIsCableway>(isCableway); this.cbx_is_cableway.DisplayMember = "Name"; this.cbx_is_cableway.ValueMember = "Name"; this.cbx_is_cableway.DataSource = isCablewayList; /* 航飞机吊桶取水点能否吊桶取水 */ PWIsTakeWater isTakeWater = PWIsTakeWater.是; List <object> isTakeWaterList = CommonHelper.GetDataSource <PWIsTakeWater>(isTakeWater); this.cbx_is_take_water.DisplayMember = "Name"; this.cbx_is_take_water.ValueMember = "Name"; this.cbx_is_take_water.DataSource = isTakeWaterList; /* 航飞机吊桶取水点是否有网箱养鱼 */ PWIsCageFish isCageFish = PWIsCageFish.是; List <object> isCageFishList = CommonHelper.GetDataSource <PWIsCageFish>(isCageFish); this.cbx_is_cage_fish.DisplayMember = "Name"; this.cbx_is_cage_fish.ValueMember = "Name"; this.cbx_is_cage_fish.DataSource = isCageFishList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_Planewaterpoint.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_Planewaterpoint.longitude; this.coordinatesInputControl1.Latitude = this.m_Planewaterpoint.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_Planewaterpoint); this.tbx_note.Text = this.m_Planewaterpoint.note; this.mediaControl1.MediaFiles = this.m_Planewaterpoint.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }
private void FormArtificiallake_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增林区危险及重要设施"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑林区危险及重要设施"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看林区危险及重要设施"; this.mediaControl1.MainToolStrip.Visible = false; } /* 林区危险及重要性设备设施状态 */ DFacilitiesStatus dFacilitiesStatus = DFacilitiesStatus.优秀; List <object> dFacilitiesStatusList = CommonHelper.GetDataSource <DFacilitiesStatus>(dFacilitiesStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Value"; this.cbx_status.DataSource = dFacilitiesStatusList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_DangerousFacilities.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_DangerousFacilities.longitude; this.coordinatesInputControl1.Latitude = this.m_DangerousFacilities.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_DangerousFacilities); this.mediaControl1.MediaFiles = this.m_DangerousFacilities.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); } } #endregion }
private void FormArtificiallake_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增航空灭火蓄水池"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑航空灭火蓄水池"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看航空灭火蓄水池"; this.mediaControl1.MainToolStrip.Visible = false; } /* 航空灭火蓄水池状态 */ ArtificiallakeStatus artificiallakeStatus = ArtificiallakeStatus.优秀; List <object> artificiallakeStatusList = CommonHelper.GetDataSource <ArtificiallakeStatus>(artificiallakeStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Value"; this.cbx_status.DataSource = artificiallakeStatusList; /* 航空灭火蓄水池有无电线索道 */ ArtificiallakeIsCableway isCableway = ArtificiallakeIsCableway.是; List <object> isCablewayList = CommonHelper.GetDataSource <ArtificiallakeIsCableway>(isCableway); this.cbx_isCableway.DisplayMember = "Name"; this.cbx_isCableway.ValueMember = "Name"; this.cbx_isCableway.DataSource = isCablewayList; /* 航空灭火蓄水池能否吊桶取水 */ ArtificiallakeIsTakeWater isTakeWater = ArtificiallakeIsTakeWater.是; List <object> isTakeWaterList = CommonHelper.GetDataSource <ArtificiallakeIsTakeWater>(isTakeWater); this.cbx_isTakeWater.DisplayMember = "Name"; this.cbx_isTakeWater.ValueMember = "Name"; this.cbx_isTakeWater.DataSource = isTakeWaterList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_Artificiallake.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_Artificiallake.longitude; this.coordinatesInputControl1.Latitude = this.m_Artificiallake.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_Artificiallake); this.tbx_note.Text = this.m_Artificiallake.note; this.mediaControl1.MediaFiles = this.m_Artificiallake.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.mediaControl1.MainToolStrip.Visible = false; this.tbx_note.Enabled = false; } } #endregion }
private void FormWatchTower_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增瞭望台"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑瞭望台"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看瞭望台"; this.mediaControl1.MainToolStrip.Visible = false; } /* 瞭望台类型 */ WatchTowerType watchTowerType = WatchTowerType.铁质了望台; List <object> watchTowerTypeList = CommonHelper.GetDataSource <WatchTowerType>(watchTowerType); this.cbx_type.DisplayMember = "Name"; this.cbx_type.ValueMember = "Name"; this.cbx_type.DataSource = watchTowerTypeList; /* 瞭望台状态 */ WatchTowerStatus watchTowerStatus = WatchTowerStatus.优秀; List <object> watchTowerStatusList = CommonHelper.GetDataSource <WatchTowerStatus>(watchTowerStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Value"; this.cbx_status.DataSource = watchTowerStatusList; /* 瞭望台结构 */ WatchTowerStructure watchTowerStructure = WatchTowerStructure.一层; List <object> watchTowerStructureList = CommonHelper.GetDataSource <WatchTowerStructure>(watchTowerStructure); this.cbx_structure.DisplayMember = "Name"; this.cbx_structure.ValueMember = "Name"; this.cbx_structure.DataSource = watchTowerStructureList; /* 瞭望台修建单位 */ WatchTowerBuildUnit watchTowerBuildUnit = WatchTowerBuildUnit.林业局; List <object> watchTowerBuildUnitList = CommonHelper.GetDataSource <WatchTowerBuildUnit>(watchTowerBuildUnit); this.cbx_build_unit.DisplayMember = "Name"; this.cbx_build_unit.ValueMember = "Name"; this.cbx_build_unit.DataSource = watchTowerBuildUnitList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_WatchTower.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_WatchTower.longitude; this.coordinatesInputControl1.Latitude = this.m_WatchTower.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_WatchTower); this.tbx_note.Text = this.m_WatchTower.note; this.mediaControl1.MediaFiles = this.m_WatchTower.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }
private void FormFireForestBelt_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增森林防火物资储备库"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑森林防火物资储备库"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看森林防火物资储备库"; this.mediaControl1.MainToolStrip.Visible = false; } /* 防火物资储备库类型 */ WarehouseType warehouseType = WarehouseType.国家级物质储备库; List <object> warningBoardsTypeList = CommonHelper.GetDataSource <WarehouseType>(warehouseType); this.cmb_type.DisplayMember = "Name"; this.cmb_type.ValueMember = "Name"; this.cmb_type.DataSource = warningBoardsTypeList; /* 防火物资储备库状态 */ WarehouseStatus warehouseStatus = WarehouseStatus.优秀; List <object> warehouseStatusList = CommonHelper.GetDataSource <WarehouseStatus>(warehouseStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Name"; this.cbx_status.DataSource = warehouseStatusList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_Warehouse.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_Warehouse.longitude; this.coordinatesInputControl1.Latitude = this.m_Warehouse.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_Warehouse); this.tbx_note.Text = this.m_Warehouse.note; this.mediaControl1.MediaFiles = this.m_Warehouse.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; } } #endregion }
/// <summary> /// Executes the specified method. /// </summary> /// <param name="method">The method.</param> /// <param name="args">The args.</param> /// <returns></returns> public object Execute(SmartForm smartForm, string method, params object[] args) { if (smartForm == null) { throw new ArgumentNullException("smartForm"); } if ((args == null) || (args.Length == 0)) { args = _defaultArgs; } // send email int emailsSent = 0; var usedToEmails = new List <string>(); for (int argIndex = 0; argIndex < args.Length; argIndex++) { string scopeKey = (args[argIndex] as string); if (scopeKey == null) { throw new ArgumentNullException(string.Format("args[{0}]", argIndex)); } if (scopeKey.Length > 0) { scopeKey += "::"; } foreach (string toEmail2 in smartForm[scopeKey + "toEmail"].Replace(";", ",").Split(',')) { string toEmail = toEmail2.Trim(); if (!string.IsNullOrEmpty(toEmail) && !usedToEmails.Contains(toEmail.ToLowerInvariant())) { string fromEmail = smartForm[scopeKey + "fromEmail"]; if (!string.IsNullOrEmpty(fromEmail)) { // execute string fromName = smartForm.CreateMergedText(scopeKey + "fromName"); var emailMessage = new MailMessage { From = (!string.IsNullOrEmpty(fromName) ? new MailAddress(fromEmail, fromName) : new MailAddress(fromEmail)), Subject = smartForm.CreateMergedText(scopeKey + "subject"), }; string replyToEmail = smartForm[scopeKey + "replyToEmail"]; if (!string.IsNullOrEmpty(replyToEmail)) { string replyToName = smartForm[scopeKey + "replyToName"]; emailMessage.ReplyTo = (!string.IsNullOrEmpty(replyToName) ? new MailAddress(replyToEmail, replyToName) : new MailAddress(replyToEmail)); } string toName = smartForm[scopeKey + "toName"]; emailMessage.To.Add(!string.IsNullOrEmpty(toName) ? new MailAddress(toEmail, toName) : new MailAddress(toEmail)); string ccEmail = smartForm[scopeKey + "ccEmail"]; if (!string.IsNullOrEmpty(ccEmail)) { emailMessage.CC.Add(ccEmail.Replace(";", ",")); } string bccEmail = smartForm[scopeKey + "bccEmail"]; if (!string.IsNullOrEmpty(bccEmail)) { emailMessage.Bcc.Add(bccEmail.Replace(";", ",")); } string attachments = smartForm[scopeKey + "attachments"]; if (!string.IsNullOrEmpty(attachments)) { foreach (string attachment in attachments.Split(';')) { if (!string.IsNullOrEmpty(attachment) && File.Exists(attachment)) { emailMessage.Attachments.Add(new Attachment(attachment)); } } } _bodyBuilder.Execute(smartForm, emailMessage, scopeKey); _smtpClient.Send(emailMessage); emailsSent++; } // prevent resends usedToEmails.Add(toEmail.ToLowerInvariant()); } } usedToEmails.Clear(); } return(emailsSent); }
private void FormFirePBrigade_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增专业森林消防队"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑专业森林消防队"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看专业森林消防队"; this.mediaControl1.MainToolStrip.Visible = false; } /* 专业森林防火队状态 */ FirePBrigadeStatus firePBrigateStatus = FirePBrigadeStatus.优秀; List <object> firePBrigateStatusList = CommonHelper.GetDataSource <FirePBrigadeStatus>(firePBrigateStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Name"; this.cbx_status.DataSource = firePBrigateStatusList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_FirePBrigade.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_FirePBrigade.longitude; this.coordinatesInputControl1.Latitude = this.m_FirePBrigade.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_FirePBrigade); this.tbx_note.Text = this.m_FirePBrigade.note; this.mediaControl1.MediaFiles = this.m_FirePBrigade.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }
private void FormFireOffice_Load(object sender, EventArgs e) { #region 初始化控件内容 if (m_OperationType == OperationType.Add) { this.Text = "新增森林防火办公室"; } else if (m_OperationType == OperationType.Edit) { this.Text = "编辑森林防火办公室"; this.mediaControl1.IsMultiselect = false; } else if (m_OperationType == OperationType.Check) { this.Text = "查看森林防火办公室"; this.mediaControl1.MainToolStrip.Visible = false; } /* 森林防火办公室状态 */ FireOfficeStatus fireOfficeStatus = FireOfficeStatus.优秀; List <object> fireOfficeStatusList = CommonHelper.GetDataSource <FireOfficeStatus>(fireOfficeStatus); this.cbx_status.DisplayMember = "Name"; this.cbx_status.ValueMember = "Name"; this.cbx_status.DataSource = fireOfficeStatusList; /* 森林防火办公室类型 */ FireOfficeType fireOfficeType = FireOfficeType.防火指挥部; List <object> fireOfficeTypeList = CommonHelper.GetDataSource <FireOfficeType>(fireOfficeType); this.cbx_type.DisplayMember = "Name"; this.cbx_type.ValueMember = "Name"; this.cbx_type.DataSource = fireOfficeTypeList; /* 森林防火办公室级别 */ FireOfficeLevel fireOfficeLevel = FireOfficeLevel.省级; List <object> fireOfficeLevelList = CommonHelper.GetDataSource <FireOfficeLevel>(fireOfficeLevel); this.cbx_level.DisplayMember = "Name"; this.cbx_level.ValueMember = "Name"; this.cbx_level.DataSource = fireOfficeLevelList; /* 森林防火办公室机构编制 */ FireOfficeInstitutions fireOfficeInstitutions = FireOfficeInstitutions.行政; List <object> fireOfficeInstitutionsList = CommonHelper.GetDataSource <FireOfficeInstitutions>(fireOfficeInstitutions); this.cbx_institutions.DisplayMember = "Name"; this.cbx_institutions.ValueMember = "Name"; this.cbx_institutions.DataSource = fireOfficeLevelList; #endregion #region 初始化行政区信息 if (m_OperationType == OperationType.Add) { this.pacControl11.Init(); } else if (m_OperationType == OperationType.Edit || m_OperationType == OperationType.Check) { this.pacControl11.Init(this.m_FireOffice.pac); } #endregion #region 编辑查看时为控件赋值 if (this.m_OperationType == OperationType.Edit || this.m_OperationType == OperationType.Check) { this.coordinatesInputControl1.Longitude = this.m_FireOffice.longitude; this.coordinatesInputControl1.Latitude = this.m_FireOffice.latitude; SmartForm.Fill(this.tabPage_baseInfo.Controls, this.m_FireOffice); this.tbx_note.Text = this.m_FireOffice.note; this.mediaControl1.MediaFiles = this.m_FireOffice.mediaFiles; if (this.m_OperationType == OperationType.Check) { this.btnOK.Enabled = false; this.btnCancel.Text = "关闭(&C)"; this.coordinatesInputControl1.Enabled = false; this.pacControl11.Enabled = false; SmartForm.SetControlsEnabled(this.tabPage_baseInfo.Controls, null); this.tbx_note.Enabled = false; this.mediaControl1.MainToolStrip.Visible = false; } } #endregion }