示例#1
0
        public IList<Company> GetCompanyInfo()
        {
            string strSql = "select * from Company order by cCode";

            OracleDataReader dr = OracleHelper.ExecuteReader(strSql);
            IList<Company> datalist = new List<Company>();
            while (dr.Read())
            {
                Company company = new Company();
                company.CompanyCode = dr["CCode"].ToString();
                company.ShortCcode = dr["shortCCode"].ToString();
                company.Name = dr["CNAME"].ToString();
                company.CompanyType = dr["cType"].ToString();
                company.OrderNo = int.Parse(dr["OrderNo"].ToString());
                datalist.Add(company);
            }
            dr.Close();
            return datalist;
        }
示例#2
0
        public IList<Company> GetCompany(Company com)
        {
            string strWhere = string.Empty;
            if (!string.IsNullOrEmpty(com.ShortCcode)) strWhere = string.Format("substr(shortcCode,0,{0}) = '{1}' And",
                com.ShortCcode.Length.ToString(), com.ShortCcode);

            string strSql = "select * from Company where {0} 1=1 order by cCode";
            strSql = string.Format(strSql, strWhere);

            OracleDataReader dr = OracleHelper.ExecuteReader(strSql);
            IList<Company> datalist = new List<Company>();
            while (dr.Read())
            {
                Company company = new Company();
                company.CompanyCode = dr["CCode"].ToString();
                company.ShortCcode = dr["shortCCode"].ToString();
                company.Name = dr["CNAME"].ToString();
                company.CompanyType = dr["cType"].ToString();
                company.OrderNo = int.Parse(dr["OrderNo"].ToString());
                datalist.Add(company);
            }
            dr.Close();
            return datalist;
        }
示例#3
0
 public Users()
 {
     company = new Company();
     role = new Role();
     depart = new Department();
 }
示例#4
0
        public bool ManageCompany(Company com)
        {
            string[] strSql = null;
            switch (com.Action)
            {
                case ActionEnum.Insert:

                    strSql = new string[3];

                    strSql[0] = "insert into Company"
                    + " select '{0}','{1}','{2}','{3}','{4}','{5}',"
                    + " nvl(Max(OrderNo),0) + 1 OrderNo from Company "
                    + " where substr(ShortcCode, 0, {6}) = '{7}' and length(ShortcCode) = {8}";

                    strSql[0] = string.Format(strSql[0], com.CompanyCode, com.ShortCcode, com.CompanyType, com.Name, com.NameJc, com.Description,
                        com.ParentCode.Length.ToString(), com.ParentCode, (com.ParentCode.Length + 2).ToString(), com.CompanyCode);
                    strSql[1] = "insert into users (userId,ccode,userName,password,realname,sex,state,createdate) values ({0},'{1}','{2}','{3}','{4}',{5},{6},{7})";
                    strSql[1] = string.Format(strSql[1], com.CompanyCode, com.CompanyCode, com.CompanyCode, EncryptHelper.EncryptString(com.CompanyCode), "系统管理员",
                        "0", "0", "sysdate");
                    strSql[2] = "Insert into usersandrole values ({0},'{1}')";
                    strSql[2] = string.Format(strSql[2], com.CompanyCode, "1");
                    break;
                case ActionEnum.Update:
                    strSql = new string[1];
                    strSql[0] = "Update Company set CType = '{1}',cName = '{2}',cNameJC = '{3}',cDescription = '{4}' Where ShortcCode = '{0}'";
                    strSql[0] = string.Format(strSql[0], com.ShortCcode,  com.CompanyType, com.Name, com.NameJc, com.Description);
                    break;
                case ActionEnum.Delete:
                    strSql = new string[3];
                    strSql[0] = "delete from Company Where CCODE = '{0}'";
                    strSql[0] = string.Format(strSql[0], com.CompanyCode);
                    strSql[1] = "delete from usersandrole where userId in (select userid from users where UserName = '******')";
                    strSql[1] = string.Format(strSql[1], com.CompanyCode);
                    strSql[2] = "delete from users where UserName = '******'";
                    strSql[2] = string.Format(strSql[2], com.CompanyCode);

                    break;
            }
            return OracleHelper.ExecuteCommand(strSql);
        }