private void btnImport_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                string theFile;
                openFileDialog1.InitialDirectory = Application.ExecutablePath;
                openFileDialog1.Filter = "excel Files(*.xls)|*.xls|All Files(*.*)|*.*";//xlsx
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    theFile = openFileDialog1.FileName;
                    DataTable dt = ExcelToTable(theFile);
                    for (int j = 0; j < dt.Rows.Count; j++)
                    {
                        CompanyHighlyToxicChemicals CompanyHighlyToxicChemicals = new CompanyHighlyToxicChemicals();
                        CompanyHighlyToxicChemicals.MainProducts = dt.Rows[j][9].ToString();
                        CompanyHighlyToxicChemicals.Registration = dt.Rows[j][10].ToString();
                        try
                        {
                            CompanyHighlyToxicChemicals.ValidStartDate = DateTime.Parse(dt.Rows[j][11].ToString());
                        }
                        catch { }

                        try
                        {
                            CompanyHighlyToxicChemicals.ValidEndDate = DateTime.Parse(dt.Rows[j][12].ToString());
                        }
                        catch { }

                        CompanyHighlyToxicChemicals.Company.CompanyAddress = dt.Rows[j][7].ToString();
                        CompanyHighlyToxicChemicals.Company.CompanyName = dt.Rows[j][0].ToString();
                        CompanyHighlyToxicChemicals.Company.CompanyPost = dt.Rows[j][8].ToString();
                        CompanyHighlyToxicChemicals.Company.JuridicalPerson = dt.Rows[j][1].ToString();
                        CompanyHighlyToxicChemicals.Company.JuridicalPersonAge = dt.Rows[j][3].ToString();
                        CompanyHighlyToxicChemicals.Company.JuridicalPersonJob = dt.Rows[j][4].ToString();
                        CompanyHighlyToxicChemicals.Company.JuridicalPersonSex = dt.Rows[j][2].ToString();
                        CompanyHighlyToxicChemicals.Company.Mobile = dt.Rows[j][6].ToString();
                        CompanyHighlyToxicChemicals.Company.Tel = dt.Rows[j][5].ToString();

                        EList<CompanyHighlyToxicChemicals> CompanyList = InvokeUtil.SystemService.CompanyHighlyToxicChemicalsGetAll(1, 20, CompanyHighlyToxicChemicals.Company.CompanyName);
                        if (CompanyList.Items.Count <= 0)
                        {
                            InvokeUtil.SystemService.EntityUpdate(CompanyHighlyToxicChemicals);
                        }
                    }
                    Reload();
                    CommonInvoke.MessageBox("操作成功!");
                }

            }
            catch (Exception ex)
            {
                CommonInvoke.ErrorMessageBox(ex);
            }

            UseWaitCursor = false;
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                if (CompanyHighlyToxicChemicals == null)
                    CompanyHighlyToxicChemicals = new CompanyHighlyToxicChemicals();

                CompanyHighlyToxicChemicals.MainProducts = MainProducts.Text;
                CompanyHighlyToxicChemicals.Registration = Registration.Text;
                CompanyHighlyToxicChemicals.ValidStartDate = DateTime.Parse(ValidStartDate.Text);
                CompanyHighlyToxicChemicals.ValidEndDate = DateTime.Parse(ValidEndDate.Text);

                CompanyHighlyToxicChemicals.Company.CompanyAddress = CompanyAddress.Text.Trim();
                CompanyHighlyToxicChemicals.Company.CompanyName = CompanyName.Text.Trim();
                CompanyHighlyToxicChemicals.Company.CompanyPost = CompanyPost.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPerson = JuridicalPerson.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonAge = JuridicalPersonAge.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonJob = JuridicalPersonJob.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonSex = JuridicalPersonSex.Text.Trim();
                CompanyHighlyToxicChemicals.Company.Mobile = Mobile.Text.Trim();
                CompanyHighlyToxicChemicals.Company.Tel = Tel.Text.Trim();

                if (this.radioButton1.Checked)
                {
                    CompanyHighlyToxicChemicals.Company.IsCity = 1;
                }
                else
                {
                    CompanyHighlyToxicChemicals.Company.IsCity = 0;
                }
                CompanyHighlyToxicChemicals.Company.CompanyAreaID = Convert.ToInt32(((ComboBoxItemTextValue)(this.comboBox1.SelectedItem)).selectValue);

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

            UseWaitCursor = false;
        }
        private void buttonOK_Click(object sender, EventArgs e)
        {
            UseWaitCursor = true;
            Application.DoEvents();

            try
            {
                if (CompanyHighlyToxicChemicals == null)
                    CompanyHighlyToxicChemicals = new CompanyHighlyToxicChemicals();

                CompanyHighlyToxicChemicals.MainProducts = MainProducts.Text;
                CompanyHighlyToxicChemicals.Registration = Registration.Text;
                CompanyHighlyToxicChemicals.ValidStartDate = DateTime.Parse(ValidStartDate.Text);
                CompanyHighlyToxicChemicals.ValidEndDate = DateTime.Parse(ValidEndDate.Text);

                CompanyHighlyToxicChemicals.Company.CompanyAddress = CompanyAddress.Text.Trim();
                CompanyHighlyToxicChemicals.Company.CompanyName = CompanyName.Text.Trim();
                CompanyHighlyToxicChemicals.Company.CompanyPost = CompanyPost.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPerson = JuridicalPerson.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonAge = JuridicalPersonAge.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonJob = JuridicalPersonJob.Text.Trim();
                CompanyHighlyToxicChemicals.Company.JuridicalPersonSex = JuridicalPersonSex.Text.Trim();
                CompanyHighlyToxicChemicals.Company.Mobile = Mobile.Text.Trim();
                CompanyHighlyToxicChemicals.Company.Tel = Tel.Text.Trim();

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

            UseWaitCursor = false;
        }
 public frmCompanyHighlyToxicChemical(CompanyHighlyToxicChemicals CompanyHighlyToxicChemicals)
     : this()
 {
     this.CompanyHighlyToxicChemicals = CompanyHighlyToxicChemicals;
 }
        /// <summary>
        /// 剧毒化学品使用详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        internal CompanyHighlyToxicChemicals CompanyHighlyToxicChemicalsGetOne(int CompanyID)
        {
            CompanyHighlyToxicChemicals Company = new CompanyHighlyToxicChemicals();
            SelectSqlSection section = DB.Select(DataBases.CompanyHighlyToxicChemicals, DataBases.CompanyHighlyToxicChemicals.ID.Count());
            if (CompanyID >= 0)
            {
                section.Where(DataBases.CompanyHighlyToxicChemicals.CompanyID == CompanyID);
            }

            int count = Convert.ToInt32(section.ToScalar());
            if (count > 0)
            {
                section = DB.Select(DataBases.CompanyHighlyToxicChemicals);
                if (CompanyID >= 0)
                {
                    section.Where(DataBases.CompanyHighlyToxicChemicals.CompanyID == CompanyID);
                }
                using (IDataReader reader = section.ToDataReader())
                {
                    while (reader.Read())
                    {
                        Company = ReadRow(reader);
                        break;
                    }
                }
                if (Company.CompanyID >= 0)
                {

                    SelectSqlSection sectionCompany = DB.Select(DataBases.Company).Where(DataBases.Company.CompanyID == CompanyID);
                    using (IDataReader readerCompany = sectionCompany.ToDataReader())
                    {
                        while (readerCompany.Read())
                        {
                            Company.Company.CompanyAddress = readerCompany["CompanyAddress"].ToString();
                            Company.Company.CompanyID = Convert.ToInt32(readerCompany["CompanyID"].ToString());
                            Company.Company.CompanyName = readerCompany["CompanyName"].ToString();
                            Company.Company.CompanyPost = readerCompany["CompanyPost"].ToString();
                            Company.Company.JuridicalPerson = readerCompany["JuridicalPerson"].ToString();
                            Company.Company.JuridicalPersonAge = readerCompany["JuridicalPersonAge"].ToString();
                            Company.Company.JuridicalPersonJob = readerCompany["JuridicalPersonJob"].ToString();
                            Company.Company.JuridicalPersonSex = readerCompany["JuridicalPersonSex"].ToString();
                            Company.Company.Mobile = readerCompany["Mobile"].ToString();
                            Company.Company.Tel = readerCompany["Tel"].ToString();
                            Company.Company.IsCity = Convert.ToInt32(readerCompany["IsCity"].ToString());
                            Company.Company.CompanyAreaID = Convert.ToInt32(readerCompany["CompanyAreaID"].ToString());
                        }
                    }
                }
            }

            return Company;
        }
示例#6
0
        /// <summary>
        /// 剧毒化学品使用详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        public CompanyHighlyToxicChemicals CompanyHighlyToxicChemicalsGetOne(int CompanyID)
        {
            try
            {
                CompanyHighlyToxicChemicals Obj = new CompanyHighlyToxicChemicals();
                Obj.SystemService = this;
                return Obj.CompanyHighlyToxicChemicalsGetOne(CompanyID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
0
        /// <summary>
        /// 剧毒化学品使用详情表
        /// </summary>
        /// <param name="page">当前页</param>
        /// <param name="pageSize">显示记录数</param>
        /// <param name="name">单位名称</param>
        /// <returns>实体集合</returns>
        public EList<CompanyHighlyToxicChemicals> CompanyHighlyToxicChemicalsGetAll(int page, int pageSize, string name, int IsCity, int AreaID)
        {
            try
            {
                CompanyHighlyToxicChemicals Obj = new CompanyHighlyToxicChemicals();
                Obj.SystemService = this;
                return Obj.CompanyHighlyToxicChemicalsGetAll(page, pageSize, name, IsCity, AreaID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }