Пример #1
0
        protected override bool SavePageData()
        {
            if (company == null)
            {
                return false;
            }

            try
            {
                icompany.Save(company);
                companyBakup = company.Clone() as Company;
                return true;
            }
            catch (BIZException be)
            {
                ShowErrorInfo("数据保存失败: " + be.Message);
                return false;
            }
            catch (DAOException de)
            {
                ShowErrorInfo("数据保存失败: " + de.Message);
                return false;
            }
        }
Пример #2
0
 private void ReloadData()
 {
     try
     {
         company = icompany.getCompany();
         taxTable = icompany.getTaxTable();
         if (company != null)
         {
             companyBakup = company.Clone() as Company;
         }
     }
     catch (BIZException be)
     {
         ShowErrorInfo("公司信息读取失败: " + be.Message);
         company = null;
         companyBakup = null;
     }
     catch (DAOException de)
     {
         ShowErrorInfo("公司信息读取失败: " + de.Message);
         company = null;
         companyBakup = null;
     }
 }
Пример #3
0
 protected override void RecoverData()
 {
     company = companyBakup.Clone() as Company;
 }
Пример #4
0
        private SqlParameter[] CompanyToParam(Company comp, string curUser, bool isInsertOp)
        {
            List<SqlParameter> paras = new List<SqlParameter>();
            paras.Add(new SqlParameter("@Name",SqlDbType.VarChar,100));
            paras.Add(new SqlParameter("@TelNum",SqlDbType.VarChar,20));
            paras.Add(new SqlParameter("@Legal",SqlDbType.VarChar,20));
            paras.Add(new SqlParameter("@Addr",SqlDbType.VarChar,100));
            paras.Add(new SqlParameter("@ZipCode",SqlDbType.VarChar,20));
            paras.Add(new SqlParameter("@IndowRate",SqlDbType.Float));
            paras.Add(new SqlParameter("@MedicalRate",SqlDbType.Float));
            paras.Add(new SqlParameter("@UnEmpRate",SqlDbType.Float));
            paras.Add(new SqlParameter("@EmpInjuryRate",SqlDbType.Float));
            paras.Add(new SqlParameter("@HouseRate",SqlDbType.Float));
            paras.Add(new SqlParameter("@TaxStart",SqlDbType.Float));
            paras.Add(new SqlParameter("@UpdateUser", SqlDbType.VarChar, 20));
            if (isInsertOp)
            {
                paras.Add(new SqlParameter("@CreateUser", SqlDbType.VarChar, 20));
            }
            paras[0].Value = comp.Name;
            paras[1].Value = comp.TelNum;
            paras[2].Value = comp.Legal;
            paras[3].Value = comp.Address;
            paras[4].Value = comp.ZipCode;
            paras[5].Value = comp.IndowRate;
            paras[6].Value = comp.Medicalrate;
            paras[7].Value = comp.UnEmpRate;
            paras[8].Value = comp.EmpInjuryRate;
            paras[9].Value = comp.HouseRate;
            paras[10].Value = comp.TaxStart;
            paras[11].Value = curUser;
            if (isInsertOp)
            {
                paras[12].Value = curUser;
            }

            return paras.ToArray();
        }
Пример #5
0
        public int UpdateCompany(Company comp, string currentUser, SqlTransaction trans)
        {
            string sqlStr = dbUtil.getSqlStatement("SQL_COMP_UpdateCompany");

            SqlParameter[] sqlParams = CompanyToParam(comp, currentUser, false);

            try
            {
                return (int)DAO.DBAccess.ExecuteNonQuery(trans, CommandType.Text, sqlStr, sqlParams);
            }
            catch (Exception ex)
            {
                throw new DAOException("E0001", ex);
            }
        }
Пример #6
0
 public Company getCompany()
 {
     string sqlStr = dbUtil.getSqlStatement("SQL_COMP_GetCompany");
     DataSet resultSet = null;
     try
     {
         Company comp = new Company();
         resultSet = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, null);
         UtilService utilService = new UtilService();
         if (!utilService.isNullDataset(resultSet))
         {
             DataRow dr = resultSet.Tables[0].Rows[0];
             comp.Name = dr["Name"].ToString();
             comp.TelNum = dr["TelNum"].ToString();
             comp.Legal = dr["Legal"].ToString();
             comp.Address = dr["Addr"].ToString();
             comp.ZipCode = dr["ZipCode"].ToString();
             comp.IndowRate = Convert.ToDouble(dr["IndowRate"]);
             comp.Medicalrate = Convert.ToDouble(dr["Medicalrate"]);
             comp.UnEmpRate = Convert.ToDouble(dr["UnEmpRate"]);
             comp.EmpInjuryRate = Convert.ToDouble(dr["EmpInjuryRate"]);
             comp.HouseRate = Convert.ToDouble(dr["HouseRate"]);
             comp.TaxStart = Convert.ToDouble(dr["TaxStart"]);
         }
         return comp;
     }
     catch (Exception ex)
     {
         throw new DAOException("E0001", ex);
     }
 }
Пример #7
0
 public void Save(Company comp)
 {
     try
     {
         compDAO.UpdateCompany(comp, "N001");
     }
     catch (DAOException)
     {
         throw;
     }
 }
Пример #8
0
 public void getCompanyTest()
 {
     CompanyImpl target = new CompanyImpl(); // TODO: Initialize to an appropriate value
     Company expected = new Company(); // TODO: Initialize to an appropriate value
     Company actual;
     actual = target.getCompany();
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }