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

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

                //GetEntity(CompanyDangerChemicals);

                CompanyNoCoalSecurity.CertificateNumber = this.CertificateNumber.Text.Trim();
                CompanyNoCoalSecurity.EconomicType = EconomicType.Text.Trim();
                CompanyNoCoalSecurity.MiningMethods = MiningMethods.Text.Trim();
                CompanyNoCoalSecurity.PermitRange = PermitRange.Text.Trim();
                CompanyNoCoalSecurity.StandardizationRegister = StandardizationRegister.Text;
                CompanyNoCoalSecurity.ValidStartDate = DateTime.Parse(ValidStartDate.Text);
                CompanyNoCoalSecurity.ValidEndDate = DateTime.Parse(ValidEndDate.Text);

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

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

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

            UseWaitCursor = false;
        }
Пример #2
0
 public frmCompanyNoCoalSecurity(CompanyNoCoalSecurity CompanyNoCoalSecurity)
     : this()
 {
     this.CompanyNoCoalSecurity = CompanyNoCoalSecurity;
 }
Пример #3
0
        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++)
                    {
                        CompanyNoCoalSecurity CompanyNoCoalSecurity = new CompanyNoCoalSecurity();
                        CompanyNoCoalSecurity.CertificateNumber = dt.Rows[j][9].ToString();
                        CompanyNoCoalSecurity.EconomicType = dt.Rows[j][10].ToString();
                        CompanyNoCoalSecurity.MiningMethods = dt.Rows[j][12].ToString();
                        CompanyNoCoalSecurity.PermitRange = dt.Rows[j][13].ToString();
                        CompanyNoCoalSecurity.StandardizationRegister = dt.Rows[j][11].ToString();
                        try
                        {
                            if (dt.Rows[j][14].ToString() != "")
                            {
                                string[] DateString = dt.Rows[j][14].ToString().Split('-');
                                if (dt.Rows[j][14].ToString().IndexOf("-") == -1)
                                {
                                    DateString = dt.Rows[j][14].ToString().Split('至');
                                }
                                if (dt.Rows[j][14].ToString().IndexOf("-") == -1 && dt.Rows[j][14].ToString().IndexOf("至") == -1)
                                {
                                    DateString = dt.Rows[j][14].ToString().Split('到');
                                }
                                if (DateString.Length <= 0)
                                {
                                    CompanyNoCoalSecurity.ValidStartDate = DateTime.Parse("1900-01-01");
                                    CompanyNoCoalSecurity.ValidEndDate = DateTime.Parse("1900-01-01");
                                }
                                else if (DateString.Length == 1)
                                {
                                    CompanyNoCoalSecurity.ValidStartDate = DateTime.Parse(DateString[0]);
                                    CompanyNoCoalSecurity.ValidEndDate = DateTime.Parse("1900-01-01");
                                }
                                else
                                {
                                    if (DateString.Length > 0)
                                    {
                                        CompanyNoCoalSecurity.ValidStartDate = DateTime.Parse(DateString[0]);
                                    }
                                    if (DateString.Length > 1)
                                    {
                                        CompanyNoCoalSecurity.ValidEndDate = DateTime.Parse(DateString[1]);
                                    }
                                }
                            }
                        }
                        catch { }

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

                        if (dt.Rows[j][15].ToString() != "")
                        {
                            CompanyNoCoalSecurity.Company.IsCity = 1;
                        }
                        else
                        {
                            CompanyNoCoalSecurity.Company.IsCity = 0;
                        }
                        CompanyArea Area = InvokeUtil.SystemService.CompanyAreaGetOne(dt.Rows[j][16].ToString());
                        CompanyNoCoalSecurity.Company.CompanyAreaID = Area.ID;

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

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

            UseWaitCursor = false;
        }
Пример #4
0
        /// <summary>
        /// 非煤矿山安全生产许可企业详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        public CompanyNoCoalSecurity CompanyNoCoalSecurityGetOne(int CompanyID)
        {
            try
            {
                CompanyNoCoalSecurity Obj = new CompanyNoCoalSecurity();
                Obj.SystemService = this;
                return Obj.CompanyNoCoalSecurityGetOne(CompanyID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        /// <summary>
        /// 非煤矿山安全生产许可企业详情表
        /// </summary>
        /// <param name="page">当前页</param>
        /// <param name="pageSize">显示记录数</param>
        /// <param name="name">单位名称</param>
        /// <returns>实体集合</returns>
        public EList<CompanyNoCoalSecurity> CompanyNoCoalSecurityGetAll(int page, int pageSize, string name, int IsCity, int AreaID)
        {
            try
            {
                CompanyNoCoalSecurity Obj = new CompanyNoCoalSecurity();
                Obj.SystemService = this;
                return Obj.CompanyNoCoalSecurityGetAll(page, pageSize, name, IsCity, AreaID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #6
0
        /// <summary>
        /// 非煤矿山安全生产许可企业详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        internal CompanyNoCoalSecurity CompanyNoCoalSecurityGetOne(int CompanyID)
        {
            CompanyNoCoalSecurity Company = new CompanyNoCoalSecurity();
            SelectSqlSection section = DB.Select(DataBases.CompanyNoCoalSecurity, DataBases.CompanyNoCoalSecurity.ID.Count());
            if (CompanyID >= 0)
            {
                section.Where(DataBases.CompanyNoCoalSecurity.CompanyID == CompanyID);
            }

            int count = Convert.ToInt32(section.ToScalar());
            if (count > 0)
            {
                section = DB.Select(DataBases.CompanyNoCoalSecurity);
                if (CompanyID >= 0)
                {
                    section.Where(DataBases.CompanyNoCoalSecurity.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;
        }