示例#1
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++)
                    {
                        CompanyFireworks CompanyFireworks = new CompanyFireworks();
                        CompanyFireworks.PermitBusinessScope = dt.Rows[j][11].ToString();
                        CompanyFireworks.PermitCertificateNo = dt.Rows[j][9].ToString();
                        CompanyFireworks.WarehousAddress = dt.Rows[j][10].ToString();
                        try
                        {
                            CompanyFireworks.ValidStartDate = DateTime.Parse(dt.Rows[j][12].ToString());
                        }
                        catch { }

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

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

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

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

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

            try
            {
                if (CompanyFirework == null)
                    CompanyFirework = new CompanyFireworks();

                //GetEntity(CompanyDangerChemicals);

                CompanyFirework.PermitBusinessScope = this.PermitBusinessScope.Text.Trim();
                CompanyFirework.PermitCertificateNo = PermitCertificateNo.Text.Trim();
                CompanyFirework.WarehousAddress = WarehousAddress.Text;
                CompanyFirework.ValidStartDate = DateTime.Parse(ValidStartDate.Text);
                CompanyFirework.ValidEndDate = DateTime.Parse(ValidEndDate.Text);

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

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

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

            UseWaitCursor = false;
        }
示例#3
0
 public frmCompanyFirework(CompanyFireworks CompanyFirework)
     : this()
 {
     this.CompanyFirework = CompanyFirework;
 }
示例#4
0
        /// <summary>
        /// 烟花爆竹零售详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        internal CompanyFireworks CompanyFireworksGetOne(int CompanyID)
        {
            CompanyFireworks Company = new CompanyFireworks();
            SelectSqlSection section = DB.Select(DataBases.CompanyFireworks, DataBases.CompanyFireworks.ID.Count());
            if (CompanyID >= 0)
            {
                section.Where(DataBases.CompanyFireworks.CompanyID == CompanyID);
            }

            int count = Convert.ToInt32(section.ToScalar());
            if (count > 0)
            {
                section = DB.Select(DataBases.CompanyFireworks);
                if (CompanyID >= 0)
                {
                    section.Where(DataBases.CompanyFireworks.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;
        }
示例#5
0
        /// <summary>
        /// 烟花爆竹零售详情表
        /// </summary>
        /// <param name="CompanyID">基本信息表编号</param>
        /// <returns>实体</returns>
        public CompanyFireworks CompanyFireworksGetOne(int CompanyID)
        {
            try
            {
                CompanyFireworks Obj = new CompanyFireworks();
                Obj.SystemService = this;
                return Obj.CompanyFireworksGetOne(CompanyID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#6
0
        /// <summary>
        /// 烟花爆竹零售详情表
        /// </summary>
        /// <param name="page">当前页</param>
        /// <param name="pageSize">显示记录数</param>
        /// <param name="name">单位名称</param>
        /// <returns>实体集合</returns>
        public EList<CompanyFireworks> CompanyFireworksGetAll(int page, int pageSize, string name, int IsCity, int AreaID)
        {
            try
            {
                CompanyFireworks Obj = new CompanyFireworks();
                Obj.SystemService = this;
                return Obj.CompanyFireworksGetAll(page, pageSize, name,IsCity,AreaID);

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#7
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++)
                    {
                        CompanyFireworks CompanyFireworks = new CompanyFireworks();
                        CompanyFireworks.PermitBusinessScope = dt.Rows[j][11].ToString();
                        CompanyFireworks.PermitCertificateNo = dt.Rows[j][9].ToString();
                        CompanyFireworks.WarehousAddress = dt.Rows[j][10].ToString();

                        try
                        {
                            if (dt.Rows[j][12].ToString() != "")
                            {
                                string[] DateString = dt.Rows[j][12].ToString().Split('-');
                                if (dt.Rows[j][12].ToString().IndexOf("-") == -1)
                                {
                                    DateString = dt.Rows[j][12].ToString().Split('至');
                                }
                                if (dt.Rows[j][12].ToString().IndexOf("-") == -1 && dt.Rows[j][12].ToString().IndexOf("至") == -1)
                                {
                                    DateString = dt.Rows[j][12].ToString().Split('到');
                                }
                                if (DateString.Length <= 0)
                                {
                                    CompanyFireworks.ValidStartDate = DateTime.Parse("1900-01-01");
                                    CompanyFireworks.ValidEndDate = DateTime.Parse("1900-01-01");
                                }
                                else if (DateString.Length == 1)
                                {
                                    CompanyFireworks.ValidStartDate = DateTime.Parse(DateString[0]);
                                    CompanyFireworks.ValidEndDate = DateTime.Parse("1900-01-01");
                                }
                                else
                                {
                                    if (DateString.Length > 0)
                                    {
                                        CompanyFireworks.ValidStartDate = DateTime.Parse(DateString[0]);
                                    }
                                    if (DateString.Length > 1)
                                    {
                                        CompanyFireworks.ValidEndDate = DateTime.Parse(DateString[1]);
                                    }
                                }
                            }
                        }
                        catch { }

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

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

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

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

            UseWaitCursor = false;
        }