Example #1
0
        //public static bool CheckImportTable(int iType, UserInfo user, ref string strError)
        //{
        //    switch (iType)
        //    {
        //        case 1:
        //            Basic.Area.Area_DB areadb = new Basic.Area.Area_DB();
        //            return areadb.CheckImportTable(ref strError);

        //        case 2:
        //            Stock.Stock_DB stockdb = new Stock.Stock_DB();
        //            return stockdb.CheckImportTable(ref strError);

        //        default:
        //            strError = "找不到对应的导入类型";
        //            return false;
        //    }
        //}

        public static bool UpLoadSql(List <string> lstSql, User.UserModel user, ref string strError)
        {
            if (lstSql == null || lstSql.Count <= 0)
            {
                strError = "上传数据不能为空";
                return(false);
            }

            if (OracleDBHelper.ExecuteNonQueryList(lstSql, ref strError) >= 1)
            {
                return(true);
            }
            else
            {
                if (string.IsNullOrEmpty(strError))
                {
                    try
                    {
                        OracleDBHelper.ExecuteNonQuery2(CommandType.Text, lstSql[0], null);
                        if (lstSql.Count >= 2)
                        {
                            OracleDBHelper.ExecuteNonQuery2(CommandType.Text, lstSql[1], null);
                        }
                    }
                    catch (Exception ex)
                    {
                        strError = ex.Message;
                    }
                }
                return(false);
            }
        }
Example #2
0
        public bool SaveModelBySqlToDB(User.UserModel user, ref TBase_Model model, ref string strError)
        {
            try
            {
                List <string> lstSql = new List <string>();

                int i = OracleDBHelper.ExecuteNonQueryList(this.GetSaveSql(user, ref model), ref strError);

                if (i > 0)
                {
                    model = GetModelByID(model.ID);
                    if (model == null)
                    {
                        strError = "GetModelByID(modelID)出错,没有找到相符的记录,可能是视图有错误!";
                        return(false);
                    }
                    else
                    {
                        return(true);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }
Example #3
0
        public bool UpdateModelListBySqlToDB(User.UserModel user, ref List <TBase_Model> modelList, ref string strError)
        {
            try
            {
                List <string> lstSql = new List <string>();

                lstSql = this.GetUpdateModelListSql(user, modelList);

                if (lstSql == null || lstSql.Count == 0)
                {
                    return(true);
                }

                int i = OracleDBHelper.ExecuteNonQueryList(lstSql, ref strError);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }
Example #4
0
        public bool SaveModelListBySqlToDB(List <string> lstSql, ref string strError)
        {
            try
            {
                int i = OracleDBHelper.ExecuteNonQueryList(lstSql, ref strError);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }
Example #5
0
        public virtual bool UpdateModelByModelSql(User.UserModel user, TBase_Model model, ref string strError)
        {
            try
            {
                List <string> lstSql = new List <string>();

                int i = OracleDBHelper.ExecuteNonQueryList(this.GetUpdateSql(user, model), ref strError);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }
Example #6
0
        public bool UpdateModelListStatusBySql(List <string> sqlList, ref string strError)
        {
            try
            {
                List <string> lstSql = new List <string>();

                int i = OracleDBHelper.ExecuteNonQueryList(sqlList, ref strError);

                if (i > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                strError = ex.Message;
                return(false);
                //throw new Exception(ex.Message);
            }
        }