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

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

                CompanyDangerChemicalsProduce.PermitRange = PermitRange.Text;
                CompanyDangerChemicalsProduce.ValidStartDate = DateTime.Parse(ValidStartDate.Text);
                CompanyDangerChemicalsProduce.ValidEndDate = DateTime.Parse(ValidEndDate.Text);

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

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

            UseWaitCursor = false;
        }
        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++)
                    {
                        CompanyDangerChemicalsProduce CompanyDangerChemicalsProduce = new CompanyDangerChemicalsProduce();
                        CompanyDangerChemicalsProduce.PermitRange = dt.Rows[j][9].ToString();
                        try
                        {
                            CompanyDangerChemicalsProduce.ValidStartDate = DateTime.Parse(dt.Rows[j][10].ToString());
                        }
                        catch { }

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

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

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

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

            UseWaitCursor = false;
        }
 public frmCompanyDangerChemicalsProduce(CompanyDangerChemicalsProduce CompanyDangerChemicalsProduce)
     : this()
 {
     this.CompanyDangerChemicalsProduce = CompanyDangerChemicalsProduce;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 危险化学品生产(含溶剂回收)、储存详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        internal CompanyDangerChemicalsProduce CompanyDangerChemicalsProduceGetOne(int CompanyID)
        {
            CompanyDangerChemicalsProduce Company = new CompanyDangerChemicalsProduce();
            SelectSqlSection section = DB.Select(DataBases.CompanyDangerChemicalsProduce, DataBases.CompanyDangerChemicalsProduce.ID.Count());
            if (CompanyID >= 0)
            {
                section.Where(DataBases.CompanyDangerChemicalsProduce.CompanyID == CompanyID);
            }

            int count = Convert.ToInt32(section.ToScalar());
            if (count > 0)
            {
                section = DB.Select(DataBases.CompanyDangerChemicalsProduce);
                if (CompanyID >= 0)
                {
                    section.Where(DataBases.CompanyDangerChemicalsProduce.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;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 危险化学品生产(含溶剂回收)、储存详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        public CompanyDangerChemicalsProduce CompanyDangerChemicalsProduceGetOne(int CompanyID)
        {
            try
            {
                CompanyDangerChemicalsProduce Obj = new CompanyDangerChemicalsProduce();
                Obj.SystemService = this;
                return Obj.CompanyDangerChemicalsProduceGetOne(CompanyID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 危险化学品生产(含溶剂回收)、储存详情表
        /// </summary>
        /// <param name="page">当前页</param>
        /// <param name="pageSize">显示记录数</param>
        /// <param name="name">单位名称</param>
        /// <returns>实体集合</returns>
        public EList<CompanyDangerChemicalsProduce> CompanyDangerChemicalsProduceGetAll(int page, int pageSize, string name, int IsCity, int AreaID)
        {
            try
            {
                CompanyDangerChemicalsProduce Obj = new CompanyDangerChemicalsProduce();
                Obj.SystemService = this;
                return Obj.CompanyDangerChemicalsProduceGetAll(page, pageSize, name, IsCity, AreaID);

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