Ejemplo n.º 1
0
        /// <summary>
        /// 获取所有保险记录列表
        /// </summary>
        /// <returns>保险记录集合</returns>
        public IList<Insure> GetAllInsure()
        {
            IList<Insure> list = new List<Insure>();

            string sql = "select * from TB_Insure order by Date desc";

            DataSet ds = AccessHelper.ExecuteDataSet(_connectionString, sql);

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    Insure insure = new Insure();
                    insure.Id = (int)row["ID"];
                    insure.EId = (int)row["EId"];
                    insure.Date = (DateTime)row["Date"];
                    insure.Type = (string)row["Type"];
                    insure.BaseNumber = (double)row["BaseNumber"];
                    insure.Company = (double)row["Company"];
                    insure.Person = (double)row["Person"];

                    list.Add(insure);
                }
            }

            return list;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绑定社保记录信息
        /// </summary>
        private void BindInsureInfo()
        {
            record = iBll.GetInsure(_id);

            lblEmployeeName.Text = eBll.GetEmployee(record.EId).EName;
            dtpDate.Text = record.Date.ToString("yyyy年MM月dd日");
            for (int i = 0; i < cbType.Items.Count; i++)
            {
                if (cbType.Items[i].ToString() == record.Type)
                {
                    cbType.SelectedIndex = i;
                    break;
                }
            }
            numBaseNumber.Value = (decimal)record.BaseNumber;
            numCompany.Value = (decimal)record.BaseNumber;
            numCompany.Value = (decimal)record.BaseNumber;
        }
Ejemplo n.º 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            string baseNumber = numBaseNumber.Text.Trim();
            string company = numCompany.Text.Trim();
            string person = numPerson.Text.Trim();

            if (baseNumber.Length == 0)
            {
                MessageBox.Show("缴纳基数不能为空");
                return;
            }
            if (company.Length == 0)
            {
                MessageBox.Show("个人缴纳不能为空");
                return;
            }
            if (person.Length == 0)
            {
                MessageBox.Show("单位缴纳不能为空");
                return;
            }

            Insure record = new Insure();
            record.EId = _eId;
            record.Date = Convert.ToDateTime(dtpDate.Text);
            record.Type = cbType.SelectedItem.ToString();
            record.BaseNumber = Convert.ToDouble(baseNumber);
            record.Company = Convert.ToDouble(company);
            record.Person = Convert.ToDouble(person);

            iBll.Insert(record);
            MessageBox.Show("添加成功!");
            this.DialogResult = DialogResult.OK;

            this.Close();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 修改保险记录
 /// </summary>
 /// <param name="insure">保险记录对象</param>
 /// <returns>影响行数</returns>
 public int Update(Insure insure)
 {
     return _dal.Update(insure);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 添加保险记录
 /// </summary>
 /// <param name="insure">保险记录对象</param>
 /// <returns>ID</returns>
 public int Insert(Insure insure)
 {
     return _dal.Insert(insure);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 获取保险记录对象
        /// </summary>
        /// <param name="eId">Id</param>
        /// <returns>保险记录对象</returns>
        public Insure GetInsure(int id)
        {
            Insure insure = null;
            string sql = "select * from TB_Insure where ID=" + id;

            DataSet ds = AccessHelper.ExecuteDataSet(_connectionString, sql);

            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                DataRow row = ds.Tables[0].Rows[0];

                insure = new Insure();
                insure.Id = (int)row["ID"];
                insure.EId = (int)row["EId"];
                insure.Date = (DateTime)row["Date"];
                insure.Type = (string)row["Type"];
                insure.BaseNumber = (double)row["BaseNumber"];
                insure.Company = (double)row["Company"];
                insure.Person = (double)row["Person"];
            }
            return insure;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 修改保险记录
        /// </summary>
        /// <param name="insure">保险记录对象</param>
        /// <returns>影响行数</returns>
        public int Update(Insure insure)
        {
            string sql = "update TB_Insure set EId=@EId,[Date]=@Date,Type=@Type,BaseNumber=@BaseNumber,Company=@Company,Person=@Person where ID=@ID";

            OleDbParameter[] param = new OleDbParameter[] {
                 new OleDbParameter("@EId",insure.EId),
                new OleDbParameter("@Date",insure.Date),
                new OleDbParameter("@Type",insure.Type),
                new OleDbParameter("@BaseNumber",insure.BaseNumber),
                new OleDbParameter("@Company",insure.Company),
                new OleDbParameter("@Person",insure.Person),
                new OleDbParameter("@ID",insure.Id)
            };

            int count = AccessHelper.ExecuteNonQuery(_connectionString, sql, param);
            return count;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 添加保险记录
        /// </summary>
        /// <param name="insure">保险记录对象</param>
        /// <returns>ID</returns>
        public int Insert(Insure insure)
        {
            string sql = "insert into TB_Insure(EId,[Date],Type,BaseNumber,Company,Person) ";
            sql += "values(@EId,@Date,@Type,@BaseNumber,@Company,@Person)";

            OleDbParameter[] param = new OleDbParameter[] {
                new OleDbParameter("@EId",insure.EId),
                new OleDbParameter("@Date",insure.Date),
                new OleDbParameter("@Type",insure.Type),
                new OleDbParameter("@BaseNumber",insure.BaseNumber),
                new OleDbParameter("@Company",insure.Company),
                new OleDbParameter("@Person",insure.Person)
            };

            AccessHelper.ExecuteNonQuery(_connectionString, sql, param);
            object id = AccessHelper.ExecuteScalar(_connectionString, "select @@identity");

            return Convert.ToInt32(id);
        }