Пример #1
0
        private void buttonOK_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                if (chemicalsList == null)
                    chemicalsList = new ChemicalsList();

                GetEntity(chemicalsList);
                chemicalsList.ChemicalsType = ChemicalsType;
                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                CommonInvoke.MessageBox("操作成功!");
                CloseWindow();
            }
            catch (Exception ex)
            {
                CommonInvoke.ErrorMessageBox(ex);
            }

            UseWaitCursor = false;
        }
Пример #2
0
        /// <summary>
        /// 危化品名录
        /// </summary>
        /// <param name="page">当前页</param>
        /// <param name="pageSize">显示记录数</param>
        /// <param name="Number">编号</param>
        /// <param name="Name">名称</param>
        /// <param name="Type">类别</param>
        /// <returns>实体集合</returns>
        public EList<ChemicalsList> ChemicalsListGetAll(int page, int pageSize, string Number, string Name, string alias, int Type, int ChildType,string UN)
        {
            try
            {
                ChemicalsList Obj = new ChemicalsList();
                Obj.SystemService = this;
                return Obj.ChemicalsListGetAll(page, pageSize, Number, Name,alias, Type,ChildType,UN);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
 public frmChemicalsList(ChemicalsList chemicalsList,int Type)
     : this()
 {
     this.chemicalsList = chemicalsList;
     ChemicalsType = Type;
 }
Пример #4
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                //this.enforceLawGridViewChemicalsList.DataSource = GetData(@"E:\移动办公\newEnforceLaw\trunk\src\Maleos\UI\bin\Debug\危化品\6\6-70.xls");
                if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.爆炸品)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.EExplosivesType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.EExplosivesType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","",  -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.毒害品和感染性物品)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.EToxicType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.EToxicType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.腐蚀品)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.ECorrosiveType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.ECorrosiveType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.压缩气体和液化气体)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.EGasType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.EGasType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.氧化剂和有机过氧化物)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.EOxidantType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.EOxidantType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.易燃固体)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.ECombustibleSolidType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.ECombustibleSolidType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                else if (ChemicalsListType == (int)SOA.ORM.ChemicalsList.EChemicalsType.易燃液体)
                {
                    foreach (int i in Enum.GetValues(typeof(SOA.ORM.ChemicalsList.ECombustibleLiquidType)))
                    {
                        int value = i;
                        string text = ((SOA.ORM.ChemicalsList.ECombustibleLiquidType)i).ToString();
                        DataTable dt = ExcelToTable(System.Environment.CurrentDirectory + @"\危化品\" + ChemicalsListType + @"\" + ChemicalsListType + "-" + value + ".xls");
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            ChemicalsList chemicalsList = new ChemicalsList();
                            chemicalsList.ChemicalsType = ChemicalsListType;
                            chemicalsList.ChemicalsChildType = i;
                            chemicalsList.ChemicalsNumber = dt.Rows[j][0].ToString();
                            chemicalsList.ChemicalsName = dt.Rows[j][1].ToString();
                            chemicalsList.ChemicalsAlias = dt.Rows[j][2].ToString();
                            chemicalsList.ChemicalsUN = dt.Rows[j][3].ToString();

                            EList<ChemicalsList> ChemicalsLists = InvokeUtil.SystemService.ChemicalsListGetAll(1, 20, chemicalsList.ChemicalsNumber, "","", -1, -1, chemicalsList.ChemicalsUN);
                            if (ChemicalsLists.Items.Count <= 0)
                            {
                                InvokeUtil.SystemService.EntityUpdate(chemicalsList);
                            }
                        }
                    }
                }
                Reload();
                CommonInvoke.MessageBox("操作成功!");
            }
            catch (Exception ex)
            {
                CommonInvoke.ErrorMessageBox(ex);
            }

            UseWaitCursor = false;
        }