Beispiel #1
0
        private void btOK_Click(object sender, RoutedEventArgs e)
        {
            if (!Validated())
            {
                return;
            }
            ExamPlace examPlace = new ExamPlace();

            examPlace = GetValue();
            BeOperationInvoker.Invoke <I_CO_IA_Setting, string>(
                channel =>
            {
                string result = channel.SaveExamPlace(examPlace);
                if (string.IsNullOrEmpty(result))
                {
                    MessageBox.Show("保存成功", "提示", MessageBoxButton.OK);
                    if (RefreshExamPlaceEvent != null)
                    {
                        RefreshExamPlaceEvent();
                    }
                    this.Close();
                }
                else
                {
                    MessageBox.Show(result, "提示", MessageBoxButton.OK);
                }
                return("");
            });
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            int checkcount = STTemplateItemsSource.Count(r => r.IsChecked == true);

            if (checkcount == 0)
            {
                MessageBox.Show("请勾选需要删除的模板", "消息提示", MessageBoxButton.OK);
                return;
            }
            if (MessageBox.Show("确定删除已勾选的模板吗?", "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
            {
                try
                {
                    List <string> guids = STTemplateItemsSource.Where(o => o.IsChecked == true).Select(r => r.GUID).ToList();
                    BeOperationInvoker.Invoke <I_CO_IA_ActivitySummarize>(channel =>
                    {
                        if (channel.DeleteSummarizeTemplate(guids))
                        {
                            //GetExamPlace();
                            STTemplateItemsSource = GetSTTemplate();
                            MessageBox.Show("删除成功!", "提示", MessageBoxButton.OK);
                        }
                        else
                        {
                            MessageBox.Show("删除失败!", "提示", MessageBoxButton.OK);
                        }
                    });
                }
                catch (Exception ex)
                {
                    MessageBox.Show("删除失败!原因:" + ex.Message.ToString(), "提示", MessageBoxButton.OK);
                }
            }
        }
Beispiel #3
0
        private void btOK_Click(object sender, RoutedEventArgs e)
        {
            if (Validated())
            {
                BeOperationInvoker.Invoke <I_CO_IA_Setting, string>(
                    channel =>
                {
                    string result = channel.SaveSecurityClass(CurrentSecurityClass);
                    if (string.IsNullOrEmpty(result))
                    {
                        MessageBox.Show("保存成功", "提示", MessageBoxButton.OK);

                        if (RefreshSecurityClassEvent != null)
                        {
                            RefreshSecurityClassEvent();
                        }

                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(result, "提示", MessageBoxButton.OK);
                    }
                    return(result);
                });
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnEquDelete_Click(object sender, RoutedEventArgs e)
        {
            List <ActivityEquipment> equs = equipmentListControl.EquipmentItemsSource.Where(r => r.IsChecked == true).ToList();

            if (equs.Count == 0)
            {
                MessageBox.Show("请勾选要删除的设备");
                return;
            }
            List <string> guids = equs.Select(r => r.Key).ToList();

            MessageBoxResult result = MessageBox.Show("确认要删除勾选的单位", "提示", MessageBoxButton.YesNo);

            if (result == MessageBoxResult.Yes)
            {
                try
                {
                    BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(channel =>
                    {
                        channel.DeleteActivityEquipment(guids);
                    });

                    InitQueryCondition(eququerycondition);
                    GetActivityEquipments(eququerycondition);

                    MessageBox.Show("删除成功");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.GetExceptionMessage(), "删除失败");
                }
            }
        }
Beispiel #5
0
 /// <summary>
 /// 查询工作文件
 /// </summary>
 /// <param name="catalog"></param>
 /// <returns></returns>
 public static List <WorkFileInfo> GetWorkFiles(string activityguid, string catalogguid)
 {
     return(BeOperationInvoker.Invoke <I_CO_IA_ActivityManage, List <WorkFileInfo> >(channel =>
     {
         return channel.GetWorkFile(activityguid, catalogguid);
     }));
 }
Beispiel #6
0
 /// <summary>
 /// 查询目录集合
 /// </summary>
 /// <param name="activityid"></param>
 /// <returns></returns>
 public static List <CatalogInfo> QueryCatalogs(string activityid)
 {
     return(BeOperationInvoker.Invoke <I_CO_IA_ActivityManage, List <CatalogInfo> >(
                channel =>
     {
         return channel.GetCatalogs(activityid);
     }));
 }
Beispiel #7
0
 private void QueryType()
 {
     BeOperationInvoker.Invoke <I_CO_IA_Setting, List <string> >(channel =>
     {
         List <string> types =
             channel.GetMonitorEQUType();
         typegrid.ItemsSource = types;
         return(types);
     });
 }
Beispiel #8
0
        private STTemplate[] GetSTTemplate()
        {
            //STTemplateItemsSource =
            List <STTemplate> list = new List <STTemplate>();

            BeOperationInvoker.Invoke <I_CO_IA_ActivitySummarize>(channel =>
            {
                list = channel.GetSummarizeTemplateAllName();
            });
            return(list.ToArray());
        }
Beispiel #9
0
        private void orgListControl_SelectionChanged(Data.Organization obj)
        {
            if (obj != null)
            {
                EquipmentLoadStrategy eququerycondition = new EquipmentLoadStrategy();
                eququerycondition.OrgName = obj.Name;

                BeOperationInvoker.Invoke <I_CO_IA_PlanDatabase>(channel =>
                {
                    equListControl.DataContext = channel.GetEquipmentsForOrg(obj.Guid);
                });
            }
        }
Beispiel #10
0
        /// <summary>
        /// 单位换行事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void orgdatagrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (SelectedORG != null)
            {
                eququerycondition         = new EquipmentLoadStrategy();
                eququerycondition.OrgName = SelectedORG.Name;

                BeOperationInvoker.Invoke <I_CO_IA_PlanDatabase>(channel =>
                {
                    equipmentListControl.DataContext = channel.GetEquipmentsForOrg(SelectedORG.Guid);
                });
            }
        }
Beispiel #11
0
        /// <summary>
        /// 下载功能
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DownBtn_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                STTemplate summarize = (sender as System.Windows.Documents.Hyperlink).Tag as STTemplate;
                if (summarize == null)
                {
                    return;
                }
                string guid = summarize.GUID;

                STTemplate sTTemplateFile = new STTemplate();
                BeOperationInvoker.Invoke <I_CO_IA_ActivitySummarize>(channel =>
                {
                    sTTemplateFile = channel.GetSummarizeTemplateFile(guid);
                });

                byte[]         file           = sTTemplateFile.FILEDOC;
                string         docstr         = summarize.NAME.Substring(summarize.NAME.LastIndexOf('.'));
                string         serviceDocPath = ByteConvertDocService(file, summarize.NAME);
                WebClient      webClient      = new WebClient();
                SaveFileDialog dlg            = new SaveFileDialog();
                dlg.FileName = summarize.NAME;
                //dlg.Reset();
                if (docstr == ".doc" || docstr == ".docx")
                {
                    dlg.Filter += "Word 文件|*.doc;*.docx";
                }
                else if (docstr == ".xls" || docstr == ".xlsx")
                {
                    dlg.Filter += "Excel 文件|*.xls;*.xlsx";
                }
                // dlg.Filter = "Office Files|*.doc;*.docx;*.xls;*.xlsx";
                if (dlg.ShowDialog() == true)
                {
                    try
                    {
                        webClient.DownloadFile(serviceDocPath, dlg.FileName);
                        MessageBox.Show("文件下载成功!");
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.GetExceptionMessage());
            }
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            List <ActivityOrganization> orgs = ORGItemSource.Where(r => r.IsChecked == true).ToList();

            if (orgs.Count == 0)
            {
                MessageBox.Show("请先勾线要删除的单位");
                return;
            }
            else
            {
                MessageBoxResult msresult = MessageBox.Show("确认要删除选择的设备?", "提示", MessageBoxButton.YesNo);
                if (msresult == MessageBoxResult.Yes)
                {
                    List <string> guids = orgs.Select(r => r.Guid).ToList();

                    BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(org =>
                    {
                        List <string> resultguids = org.CountActivityEqusForOrg(guids, RiasPortal.ModuleContainer.Activity.Guid);
                        StringBuilder errormsg    = new StringBuilder();

                        if (resultguids != null && resultguids.Count > 0)
                        {
                            foreach (string orgguid in guids)
                            {
                                ActivityOrganization orginfo = orgs.FirstOrDefault(r => r.Guid == orgguid);
                                errormsg.AppendFormat("{0},", orginfo.Name);
                            }
                            string message = errormsg.ToString().TrimEnd(',');
                            MessageBox.Show(string.Format("当前活动下,{0}已经包含设备", message), "提示");
                        }
                        else
                        {
                            try
                            {
                                org.DeleteActivityOrg(guids, RiasPortal.ModuleContainer.Activity.Guid);
                                GetORGInfos();
                                chkAll.IsChecked       = false;
                                IsORGItemSourceChanged = true;
                                MessageBox.Show("删除成功");
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show(ex.GetExceptionMessage(), "删除失败");
                            }
                        }
                    });
                }
            }
        }
Beispiel #13
0
 /// <summary>
 /// 删除目录信息
 /// </summary>
 /// <param name="guids"></param>
 /// <returns></returns>
 public static string DeleteCatalog(List <string> guids)
 {
     try
     {
         return(BeOperationInvoker.Invoke <I_CO_IA_ActivityManage, string>(channel =>
         {
             return channel.DeleteCatalog(guids);
         }));
     }
     catch (Exception ex)
     {
         return(ex.GetExceptionMessage());
     }
 }
Beispiel #14
0
 private void ImportActivityEquipmentEvent(ActivityOrganization orginfo, List <ActivityEquipment> lstequ)
 {
     try
     {
         BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(channel =>
         {
             channel.ImportActivityEquipment(orginfo, lstequ);
             ReLoadOrgGridSource(orginfo);
             MessageBox.Show("导入成功!", "提示", MessageBoxButton.OK);
         });
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetExceptionMessage(), "导入失败");
     }
 }
Beispiel #15
0
        private string downLoadTemplate(string guid)
        {
            try
            {
                STTemplate sTTemplateFile = new STTemplate();
                BeOperationInvoker.Invoke <I_CO_IA_ActivitySummarize>(channel =>
                {
                    sTTemplateFile = channel.GetSummarizeTemplateFile(guid);
                });

                byte[]    file           = sTTemplateFile.FILEDOC;
                string    docstr         = sTTemplateFile.NAME.Substring(sTTemplateFile.NAME.LastIndexOf('.'));
                string    serviceDocPath = ByteConvertDocService(file, sTTemplateFile.NAME);
                WebClient webClient      = new WebClient();
                //SaveFileDialog dlg = new SaveFileDialog();
                //dlg.FileName = sTTemplateFile.NAME;
                //dlg.Reset();
                //if (docstr == ".doc" || docstr == ".docx")
                //{
                //    dlg.Filter += "Word 文件|*.doc;*.docx";
                //}
                //else if (docstr == ".xls" || docstr == ".xlsx")
                //{
                //    dlg.Filter += "Excel 文件|*.xls;*.xlsx";
                //}
                // dlg.Filter = "Office Files|*.doc;*.docx;*.xls;*.xlsx";

                webClient.DownloadFile(serviceDocPath, sTTemplateFile.NAME);
                //if (dlg.ShowDialog() == true)
                //{
                //    try
                //    {
                //        webClient.DownloadFile(serviceDocPath, dlg.FileName);
                //    }
                //    catch (Exception)
                //    {
                //        return "";
                //    }
                //}
                return(serviceDocPath);
            }
            catch (Exception ex)
            {
                return("");
                //MessageBox.Show(ex.GetExceptionMessage());
            }
        }
Beispiel #16
0
 /// <summary>
 /// 保存目录信息
 /// </summary>
 /// <param name="catalog"></param>
 public static bool SaveCatalog(CatalogInfo catalog, out string errormsg)
 {
     errormsg = null;
     try
     {
         BeOperationInvoker.Invoke <I_CO_IA_ActivityManage>(channel =>
         {
             channel.SaveCatalog(catalog);
         });
         return(true);
     }
     catch (Exception ex)
     {
         errormsg = ex.GetExceptionMessage();
         return(false);
     }
 }
 private void securityDelete_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("确定删除选中的考点吗?", "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
     {
         try
         {
             BeOperationInvoker.Invoke <I_CO_IA_Setting>(channel =>
             {
                 channel.DeleteExamPlace(SelectExamPlace.Guid);
                 GetExamPlace();
                 MessageBox.Show("删除成功!", "提示", MessageBoxButton.OK);
             });
         }
         catch
         {
         }
     }
 }
        /// <summary>
        /// XLS导入
        /// </summary>
        /// <param name="orginfo"></param>
        /// <param name="lstequ"></param>
        private void ImportActivityEquipmentEvent(ActivityOrganization orginfo, List <ActivityEquipment> lstequ)
        {
            List <ActivityEquipment> lst = new List <ActivityEquipment>();

            BeOperationInvoker.Invoke <I_CO_IA_FreqStation>(channel =>
            {
                foreach (ActivityEquipment equ in lstequ)
                {
                    int count = channel.CountEquName(equ);
                    if (count > 0)
                    {
                        lst.Add(equ);
                    }
                }

                if (lst.Count == 0)
                {
                    try
                    {
                        channel.ImportActivityEquipment(orginfo, lstequ);
                        GetActivityOrgs(orgquerycondition);
                        ActivityOrganization selectorg = this.ActivityOrgSource.FirstOrDefault(r => r.Guid == orginfo.Guid);
                        this.orgdatagrid.SelectedItem  = selectorg;
                        MessageBox.Show("导入成功!", "提示", MessageBoxButton.OK);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.GetExceptionMessage(), "导入失败");
                    }
                }
                else
                {
                    StringBuilder errormsg = new StringBuilder();
                    errormsg.AppendLine("当前单位名称下,存在相同的设备名称+编号:");
                    foreach (Equipment item in lst)
                    {
                        errormsg.AppendLine(string.Format("设备名称:{0},设备编号:{1}", item.Name, item.SeriesNumber));
                    }

                    ErrorDialog errordialog = new ErrorDialog(errormsg.ToString());
                    errordialog.ShowDialog();
                }
            });
        }
Beispiel #19
0
 /// <summary>
 /// 删除
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void securityDelete_Click(object sender, RoutedEventArgs e)
 {
     if (this.SelectedSecurityClass == null)
     {
         MessageBox.Show("请先选择需要删除的保障类别");
         return;
     }
     else
     {
         MessageBoxResult msresult = MessageBox.Show("确认要删除选中的保障类别?", "提示", MessageBoxButton.YesNo);
         if (msresult == MessageBoxResult.Yes)
         {
             try
             {
                 BeOperationInvoker.Invoke <I_CO_IA_Setting>(channel =>
                 {
                     channel.DeleteSecurityClass(SelectedSecurityClass.Guid);
                     GetSecurityClass();
                     MessageBox.Show("删除成功!", "提示", MessageBoxButton.OK);
                 });
             }
             catch (System.Exception ex)
             {
                 if (ex.Message.Contains("FK_SECRETFREQ_SECURITYCLASSES"))
                 {
                     MessageBox.Show("已经设置保密频段,不可以删除!");
                 }
                 else if (ex.Message.Contains("FK_ORGINFO_SECURITYCLASS_CODE"))
                 {
                     MessageBox.Show("已经应用为单位的保障类别,不可以删除!");
                 }
                 else
                 {
                     throw;
                 }
             }
         }
     }
 }
Beispiel #20
0
        private void InitTemplate()
        {
            List <ItemsData>            listID = new List <ItemsData>();
            Dictionary <string, string> dic    = new Dictionary <string, string>();
            List <STTemplate>           list   = new List <STTemplate>();

            BeOperationInvoker.Invoke <I_CO_IA_ActivitySummarize>(channel =>
            {
                list = channel.GetSummarizeTemplateAllName();
            });
            if (list != null)
            {
                foreach (var template in list)
                {
                    ItemsData itemsData = new ItemsData();
                    itemsData.Key   = template.GUID;
                    itemsData.Value = template.NAME;
                    listID.Add(itemsData);
                    //dic.Add(template.GUID, template.NAME);
                }
            }
            combTemplate.ItemsSource = listID;
        }
Beispiel #21
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnXLSImport_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.Filter     = "Excel 文件|*.xls;*.xlsx";
            dialog.DefaultExt = "xls";

            dialog.CheckFileExists = true;
            if (dialog.ShowDialog() == true)
            {
                DataTable[] tables = ExcelImportHelper.LoadDataFromExcel(dialog.FileName);
                if (tables != null && tables.Length > 0)
                {
                    string imgPath = dialog.FileName.Substring(0, dialog.FileName.LastIndexOf('\\') + 1) + "车辆照片";
                    if (Directory.Exists(imgPath))
                    {
                        List <DataRow> rows = VehicleImportHelper.GetEnableDataRow(tables);
                        if (rows != null && rows.Count > 0)
                        {
                            VehicleImportHelper.ImageFilePath = imgPath;
                            List <VehicleInfo> vehicles = null;
                            bool result = false;
                            vehicles = VehicleImportHelper.GetVehicleFromTable(rows, out result);
                            //设备获取成功
                            if (result)
                            {
                                if (vehicles != null && vehicles.Count > 0)
                                {
                                    List <VehicleInfo> samenolst = new List <VehicleInfo>();
                                    //验证在数据库中是否存在相同的车辆编号
                                    if (VehicleImportHelper.VerifyVehicleNotInDB(vehicles, out samenolst))
                                    {
                                        try
                                        {
                                            BeOperationInvoker.Invoke <I_CO_IA_PlanDatabase>
                                                (channel =>
                                            {
                                                channel.ImportVehicles(vehicles);
                                            });
                                            GetVehicleInfos();
                                        }
                                        catch (Exception ex)
                                        {
                                            MessageBox.Show(ex.GetExceptionMessage(), "导入失败");
                                        }
                                    }
                                    else
                                    {
                                        StringBuilder errstr = new StringBuilder();
                                        errstr.AppendLine("数据库存在相同的车牌号码:");
                                        foreach (VehicleInfo item in samenolst)
                                        {
                                            errstr.AppendLine(item.VehicleNo);
                                        }
                                        errstr.AppendLine("是否进行替换?");
                                        errstr.AppendLine("说明:如果车辆在监测实施中,存在设备。则不替换'监测车'属性");
                                        MessageBoxResult msgresult = MessageBox.Show(errstr.ToString(), "提示", MessageBoxButton.YesNo);
                                        if (msgresult == MessageBoxResult.Yes)
                                        {
                                            BeOperationInvoker.Invoke <I_CO_IA_PlanDatabase>
                                                (channel =>
                                            {
                                                channel.ImportVehicles(vehicles);
                                            });
                                            GetVehicleInfos();
                                        }
                                        else
                                        {
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            MessageBox.Show("车辆信息为空,请填写车辆信息", "提示", MessageBoxButton.OK);
                        }
                    }
                    else
                    {
                        MessageBox.Show("车辆照片文件夹不存在,无法导入照片");
                    }
                }
                else
                {
                    MessageBox.Show("车辆信息为空,请填写车辆信息", "提示", MessageBoxButton.OK);
                }
            }
        }