public static void CreateStoredProcedures(Database db)
        {
            DbCommand command;
            string sql;

            try
            {
                DeleteStoredProcedures(db);
            }
            catch { }

            sql = "CREATE OR REPLACE PACKAGE PKGENTLIB AS " +
                "TYPE T_CURSOR IS REF CURSOR; " +
                "PROCEDURE RegionSelect (CUR_OUT OUT T_CURSOR); " +
                "END PKGENTLIB;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "CREATE OR REPLACE PACKAGE BODY PKGENTLIB AS " +
                "PROCEDURE RegionSelect(CUR_OUT OUT T_CURSOR) IS " +
                "V_CURSOR T_CURSOR; " +
                "BEGIN " +
                "OPEN V_CURSOR FOR " +
                "SELECT * FROM Region ORDER BY RegionID; " +
                "CUR_OUT := V_CURSOR; " +
                "END RegionSelect; " +
                "END PKGENTLIB;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionInsert (pRegionID IN Region.RegionID%TYPE, pRegionDescription IN Region.RegionDescription%TYPE) as " +
                    "BEGIN " +
                    "   insert into Region values(pRegionID, pRegionDescription); " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionUpdate (pRegionID IN Region.RegionID%TYPE, pRegionDescription IN Region.RegionDescription%TYPE) as " +
                    "BEGIN " +
                    "   update Region set RegionDescription = pRegionDescription where RegionID = pRegionID; " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);

            sql = "create procedure RegionDelete (pRegionID IN Region.RegionID%TYPE) as " +
                    "BEGIN " +
                    "   delete from Region where RegionID = pRegionID; " +
                    "END;";

            command = db.GetSqlStringCommand(sql);
            db.ExecuteNonQuery(command);
        }
Пример #2
0
        public void btnDelete_Click(System.Object sender, System.EventArgs e)
        {
            //ExecuteNonQuery
            //db.ExecuteNonQuery(CommandType.Text, "DELETE FROM SampleData where [Name] = 'Insert'")

            //GetSqlStringCommand and ExecuteNonQuery
            DbCommand cmd = db.GetSqlStringCommand("DELETE FROM SampleData where [Name] = \'Insert\'");

            db.ExecuteNonQuery(cmd);
        }
        public void SetUp()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
        public void TestInitialize()
        {
            testConnection = new TestConnectionString();
            testConnection.CopyFile();
            db = new SqlCeDatabase(testConnection.ConnectionString);

            DbCommand insertCommand = db.GetSqlStringCommand(insertString);
            queryCommand = db.GetSqlStringCommand(queryString);

            baseFixture = new ExecuteReaderFixture(db, insertString, insertCommand, queryString, queryCommand);
        }
        public void SetUp()
        {
            EnvironmentHelper.AssertOracleClientIsInstalled();
            DatabaseProviderFactory factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
            db = factory.Create("OracleTest");

            DbCommand insertionCommand = db.GetSqlStringCommand(insertString);
            DbCommand countCommand = db.GetSqlStringCommand(countQuery);

            baseFixture = new ExecuteNonQueryFixture(db, insertString, countQuery, insertionCommand, countCommand);
        }
Пример #6
0
 /// <summary>
 /// 获取指定的表(适用含虚体表的T)
 /// 示例(指定表获取):DAOHelp.UniversalizationGetAll<DSSLMSEntering>(CommonApp.DBFactory.CreateDefault(), new List<string>() { "[SLMSDB_I].[dbo].[SampleInfo]", "[SLMSDB_I].[dbo].[SampleResult]" });
 /// </summary>
 /// <typeparam name="T">数据集</typeparam>
 /// <param name="_db"></param>
 /// <param name="_tablenames">注意表名要用数据库全称</param>
 /// <returns></returns>
 public static T UniversalizationGetAll <T>(Microsoft.Practices.EnterpriseLibrary.Data.Database _db, List <string> _tablenames)
 {
     try
     {
         var model = Activator.CreateInstance <T>();
         var sql   = _tablenames.Aggregate("", (current, _tb) => current + ("select * from " + _tb + ";"));
         var cmd   = _db.GetSqlStringCommand(sql);
         //注意:如果需要使返回的table名不含有数据库表的限定名,则如下:
         var list = new List <string>();
         foreach (var tbn in _tablenames)
         {
             var ele = "";
             if (tbn.Contains("."))
             {
                 ele = (tbn.Split('.'))[(tbn.Split('.')).Length - 1];
             }
             if (ele.StartsWith("["))
             {
                 ele = ele.Substring(1, ele.Length - 2);
             }
             list.Add(ele);
         }
         _db.LoadDataSet(cmd, model as DataSet, list.ToArray());//return回来的dataset表名
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #7
0
        /// <summary>
        /// GetItem  SAS_ExportData Data...
        /// <summary>
        /// <param name=sender></param>
        /// <param name= e></param>
        public ExportDataEN GetItem(ExportDataEN argEn)
        {
            ExportDataEN loItem = new ExportDataEN();
            string       sqlCmd = "Select * FROM SAS_ExportData WHERE InterfaceID = @InterfaceID";

            Microsoft.Practices.EnterpriseLibrary.Data.Database coDb = DatabaseFactory.CreateDatabase(csConnectionStr);
            try
            {
                using (DbCommand cmd = coDb.GetSqlStringCommand(sqlCmd))
                {
                    coDb.AddInParameter(cmd, "@InterfaceID", DbType.String, argEn.InterfaceID);
                    using (IDataReader loReader = coDb.ExecuteReader(cmd))
                    {
                        if (loReader != null)
                        {
                            loReader.Read();
                            loItem = LoadObject(loReader);
                        }
                        loReader.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(loItem);
        }
Пример #8
0
        /// <summary>
        /// Getlist  SAS_ExportData Data...
        /// <summary>
        /// <param name=sender></param>
        /// <param name= e></param>
        public List <ExportDataEN> GetList(ExportDataEN argEn)
        {
            List <ExportDataEN> loEnList = new List <ExportDataEN>();

            argEn.InterfaceID = argEn.InterfaceID.Replace("*", "%");
            string sqlCmd = "select * from SAS_ExportData where Interfaceid <> '0'";

            if (argEn.InterfaceID.Length != 0)
            {
                sqlCmd = sqlCmd + " and Interfaceid like '" + argEn.InterfaceID + "'";
            }
            Microsoft.Practices.EnterpriseLibrary.Data.Database coDb = DatabaseFactory.CreateDatabase(csConnectionStr);
            try
            {
                using (DbCommand cmd = coDb.GetSqlStringCommand(sqlCmd))
                {
                    using (IDataReader loReader = coDb.ExecuteReader(cmd))
                    {
                        while (loReader.Read())
                        {
                            ExportDataEN loItem = LoadObject(loReader);
                            loEnList.Add(loItem);
                        }
                        loReader.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(loEnList);
        }
Пример #9
0
        /// <summary>
        /// Delete  SAS_ExportData Data...
        /// <summary>
        /// <param name=sender></param>
        /// <param name= e></param>
        public bool Delete(ExportDataEN argEn)
        {
            bool   lbRes  = false;
            string sqlCmd = "DELETE FROM SAS_ExportData WHERE InterfaceID = @InterfaceID";

            Microsoft.Practices.EnterpriseLibrary.Data.Database coDb = DatabaseFactory.CreateDatabase(csConnectionStr);
            try
            {
                using (DbCommand cmd = coDb.GetSqlStringCommand(sqlCmd))
                {
                    coDb.AddInParameter(cmd, "@InterfaceID", DbType.String, argEn.InterfaceID);
                    int liRowAffected = coDb.ExecuteNonQuery(cmd);
                    if (liRowAffected > -1)
                    {
                        lbRes = true;
                    }
                    else
                    {
                        throw new Exception("Deletion Failed! No Row has been deleted...");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lbRes);
        }
Пример #10
0
 /// <summary>
 /// 限定数据库表前缀查询(要求T所有表均有对应的实体表)
 /// 示例(所有表获取):DAOHelp.UniversalizationGetAll<DSSLMSEntering>(CommonApp.DBFactory.CreateDefault(), "[SLMSDB_I].[dbo].");
 /// </summary>
 /// <typeparam name="T">数据集</typeparam>
 /// <param name="_db"></param>
 /// <param name="_tablenameprefix">前缀为空时,则指数据集表名与数据库表名一致</param>
 /// <returns></returns>
 public static T UniversalizationGetAll <T>(Microsoft.Practices.EnterpriseLibrary.Data.Database _db, string _tablenameprefix)
 {
     try
     {
         var type  = typeof(T);
         var ppt   = type.GetProperties();
         var model = Activator.CreateInstance <T>();
         var sql   = "";
         //获取表集合
         var tbs = new List <string>();
         foreach (var t in ppt)
         {
             var eltype = t.ToString().Split(' ')[0];
             if (!eltype.Contains("DataTable"))
             {
                 continue;
             }
             if (eltype.Substring(eltype.Length - 9) != "DataTable")
             {
                 continue;
             }
             sql += "select * from " + _tablenameprefix + t.Name + ";"; //注意:xsd中表名应当跟数据库表名一致
             tbs.Add(t.Name);
         }
         var cmd = _db.GetSqlStringCommand(sql);
         _db.LoadDataSet(cmd, model as DataSet, tbs.ToArray());//return回来的dataset表名
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #11
0
        //Get XML From Database2
        public static string GetOldXml(int id)
        {
            string RetrivedXML2 = null;

            try
            {
                //Instance for the database
                DatabaseProviderFactory factory2 = new DatabaseProviderFactory();
                Microsoft.Practices.EnterpriseLibrary.Data.Database db2 = factory2.Create("DB2");

                DbCommand dbCommand2 = db2.GetSqlStringCommand("SELECT xmldata FROM data WHERE id='" + id + "'");
                object    getOldXml  = db2.ExecuteScalar(dbCommand2);

                if (getOldXml != null)
                {
                    RetrivedXML2 = (string)getOldXml;
                }
                else
                {
                    throw new Exception(String.Format("Could not find the historyId.", id));
                }

                return(RetrivedXML2);
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #12
0
        /// <summary>
        /// 获取待办事项调转地址
        /// </summary>
        /// <param name="moduleID"></param>
        /// <param name="moduleName"></param>
        /// <param name="instanceID"></param>
        /// <param name="workflowTasksSetp"></param>
        /// <returns></returns>
        //private string GetAuditUrl(string moduleID, string moduleName, string instanceID, string workflowTasksSetp, string applyBasisType, string taskStatus)
        //{
        //    string sRtn = string.Empty;
        //    string showType = basepage.CurrUserInfo().RoleShowType;
        //    if (moduleName == Constant.TaskCYGYWSP)//车易购业务审批
        //    {
        //        switch (workflowTasksSetp)
        //        {
        //            case "0":
        //                if (applyBasisType == "1")
        //                {
        //                    sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/ApplyAddPersonage.aspx?Desktop=true&id=" + moduleID + "&showType=" + showType + "');>办理</a>";
        //                }
        //                if (applyBasisType == "2")
        //                {
        //                    sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/ApplyAddCompany.aspx?Desktop=true&id=" + moduleID + "&showType=" + showType + "');>办理</a>";
        //                }
        //                break;
        //            case "1":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption1.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //            case "2":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption2.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //            case "3":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption3.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //            case "4":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption4.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //            case "5":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption5.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //            case "6":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/InstructionsAuditOption6.aspx?Desktop=true&id=" + moduleID + "&ApplyBasis_Type=" + applyBasisType + "&step=" + workflowTasksSetp + "&showType=" + showType + "');>办理</a>";
        //                break;
        //        }
        //    }
        //    if (moduleName == Constant.TaskCYGTQHK)//车易购业务提前还款
        //    {
        //        switch (workflowTasksSetp)
        //        {
        //            case "0":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Repayment/AdvancePayAdd.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //            case "1":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Repayment/AdvancePayApproveAudit.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //        }

        //    }

        //    string ExpressInfo_Status = string.Empty;
        //    string ApplyBasis_Code = string.Empty;
        //    string ApplyBasis_Name = string.Empty;
        //    string Department_Name = string.Empty;
        //    string ApplyBasis_VehicleType = string.Empty;
        //    string ApplyBasisID = string.Empty;
        //    if (moduleName == Constant.TaskCYGTQHK || moduleName == Constant.TaskCLIENTFILE || moduleName == Constant.TaskCLIENTFILESHPI)
        //    {
        //        Business_ExpressInfo ExpressInfo = new Business_ExpressInfoBLL().Find(p => p.ExpressInfoID == moduleID);
        //        if (ExpressInfo != null)
        //        {
        //            ExpressInfo_Status = ExpressInfo.ExpressInfo_Status;
        //            ApplyBasisID = ExpressInfo.ExpressInfo_ApplyBasisId;
        //            View_Business_ApplyBasis ApplyBasis = new View_Business_ApplyBasisBLL().Find(p => p.ApplyBasisId == ExpressInfo.ExpressInfo_ApplyBasisId);
        //            if (ApplyBasis != null)
        //            {
        //                ApplyBasis_Code = ApplyBasis.ApplyBasis_Code;
        //                ApplyBasis_Name = ApplyBasis.ApplyBasis_Name;
        //                Department_Name = ApplyBasis.Department_Name;
        //                ApplyBasis_VehicleType = ApplyBasis.ApplyBasis_VehicleType;
        //            }
        //        }

        //    }
        //    if (moduleName == Constant.TaskCLIENTFILE)//客户资料管理
        //    {
        //        sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Archives/ExpressInfoAudit.aspx?Desktop=true&id=" + ApplyBasisID + "&ExpressInfoID=" + moduleID + "&ExpressInfo_Status=" + ExpressInfo_Status + "&ApplyBasis_Code=" + ApplyBasis_Code + "&ApplyBasis_Name=" + ApplyBasis_Name + "&Department_Name=" + Department_Name + "&ApplyBasis_VehicleType=" + ApplyBasis_VehicleType + "');>办理</a>";
        //    }
        //    if (moduleName == Constant.TaskCLIENTFILESHPI)//快递资料审批
        //    {
        //        sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Archives/ExpressInfoEdit.aspx?Desktop=true&id=" + ApplyBasisID + "&ExpressInfoID=" + moduleID + "&ExpressInfo_Status=" + ExpressInfo_Status + "&ApplyBasis_Code=" + ApplyBasis_Code + "&ApplyBasis_Name=" + ApplyBasis_Name + "&Department_Name=" + Department_Name + "&ApplyBasis_VehicleType=" + ApplyBasis_VehicleType + "');>办理</a>";
        //    }
        //    if (moduleName == Constant.TaskCYGYWKHXXBG)//车易购业务客户信息变更
        //    {
        //        string ApplyBasis_Type = string.Empty;
        //        string CustomerInfoChange_ApplyBasisId = string.Empty;
        //        string CustomerInfoChange_StateCode = string.Empty;
        //        Business_CustomerInfoChange CustomerInfoChange = new Business_CustomerInfoChangeBLL().Find(p => p.CustomerInfoChange_ID == moduleID);
        //        CustomerInfoChange_ApplyBasisId = CustomerInfoChange.CustomerInfoChange_ApplyBasisId;
        //        CustomerInfoChange_StateCode = CustomerInfoChange.CustomerInfoChange_State;
        //        if (CustomerInfoChange != null)
        //        {
        //            View_Business_ApplyBasis ApplyBasis = new View_Business_ApplyBasisBLL().Find(p => p.ApplyBasisId == CustomerInfoChange_ApplyBasisId);
        //            if (ApplyBasis != null)
        //            {
        //                ApplyBasis_Type = ApplyBasis.ApplyBasis_Type.ToString();
        //            }
        //        }

        //        switch (workflowTasksSetp)
        //        {
        //            case "0":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/CustomerInfoChangeAdd.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "&ApplyBasis_Type=" + ApplyBasis_Type + "&CustomerInfoChange_StateCode=" + CustomerInfoChange_StateCode + "');>办理</a>";
        //                break;
        //            case "1":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Business/CustomerInfoApprove.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "&ApplyBasis_Type=" + ApplyBasis_Type + "&CustomerInfoChange_ApplyBasisId=" + CustomerInfoChange_ApplyBasisId + "');>办理</a>";
        //                break;
        //        }
        //    }
        //    if (moduleName == Constant.TaskCYGYWBDXB)//车易购业务保单续保
        //    {
        //        switch (workflowTasksSetp)
        //        {
        //            case "0":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Warranty/WarrantyRenewalApply.aspx?Desktop=true&BusinessID=RenewalApplyList,Modify&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //            case "1":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Warranty/WarrantyRenewalApprove.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //        }
        //    }
        //    if (moduleName == Constant.TaskCYGYWBDLP)//车易购业务保单理赔
        //    {
        //        switch (workflowTasksSetp)
        //        {
        //            case "0":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Warranty/ClaimsApply.aspx?Desktop=true&BusinessID=CustomerClaimsList&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //            case "1":
        //                sRtn = "<a href=javascript:TaskShowClick('" + taskStatus + "','/Manage/Warranty/ClaimsApprove.aspx?Desktop=true&id=" + moduleID + "&step=" + workflowTasksSetp + "');>办理</a>";
        //                break;
        //        }
        //    }
        //    return sRtn;
        //}



        /// <summary>
        /// 其他待办事项(PendingMatter_ToRoleName:多角色 userInfo.RoleName:多角色)
        /// </summary>
        public List <string> LoadPendingMatterInfo()
        {
            List <string> PendingMatterList = new List <string>();//待办事项集合
            string        sqlString         = "exec GetPendingMatterRecord '" + basepage.CurrUserInfo().RoleID + "','" + basepage.CurrUserInfo().UserID + "'";

            Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(sqlString);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            string title  = ds.Tables[0].Rows[i]["PendingMatter_Title"].ToString();
                            string url    = ds.Tables[0].Rows[i]["PendingMatter_URL"].ToString();
                            string iCount = ds.Tables[0].Rows[i]["iCount"].ToString();
                            title = string.Format(Constant.TesksAuditTitle, title, iCount);
                            PendingMatterList.Add("<li>·<a href=javascript:showTabs('待办事项','" + url + "');>" + title + "</a></li>");
                        }
                    }
                }
            }
            return(PendingMatterList);
        }
        public bool ExisteUsuario(string Usuario)
        {
            stringBuilder = new StringBuilder();
            stringBuilder.Append("SELECT  COUNT(1) FROM DbSistemas.dbo.TBLSECUSUARIOS WHERE USUARIO = @USUARIO");
            DbCommand commad = Database.GetSqlStringCommand(stringBuilder.ToString());

            Database.AddInParameter(commad, "USUARIO", System.Data.DbType.String, Usuario);
            if ((int)Database.ExecuteScalar(commad) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select KATILIMCI_ID,UZMANLIK_ALANI_ID from KATILIMCI_UZMANLIK_ARATABLO "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
Пример #15
0
 public IDataReader GetAllReader(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,ACIKLAMA from SECENEK_TIP "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteReader(dbComm);
 }
Пример #16
0
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,AD,SOYAD,TELEFON,EMAIL,UNVAN_ID from KATILIMCI "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ORGANIZASYON_ID,KATILIMCI_ID,KAYIT_NO from KATILIMCI_ORGANIZASYON_ARATABLO "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select SORU_ID,SECENEK_ID from SORU_SECENEK_ARATABLO "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
Пример #19
0
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,DUYURU_TIP_ID,ORGANIZASYON_ID,BASLIK,BITIS_TARIHI from DUYURU "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
        public bool IsInitialized()
        {
            bool    isInitialized = false;
            DataSet ds            = new DataSet();
            string  sql           = "SELECT COUNT(*) FROM sysobjects WHERE type = 'U' AND name = 'chpt09_SchemaVersions'";

            using (DbCommand dbCmd = db.GetSqlStringCommand(sql))
            {
                ds = db.ExecuteDataSet(dbCmd);
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    int count = (int)ds.Tables[0].Rows[0][0];
                    isInitialized = (count == 1);
                }
            }
            return(isInitialized);
        }
Пример #21
0
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,ORGANIZASYON_TIP_ID,KULUP_ID,AD,TARIH from ORGANIZASYON "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
Пример #22
0
 public DataSet GetAll(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,ACIKLAMA from DUYURU_TIP "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteDataSet(dbComm);
 }
 public IDataReader GetAllReader(string OrderBy, Database db)
 {
     orderBy = "";
     if (OrderBy.Length > 0) orderBy = " Order By " + OrderBy;
     sqlText="Select ID,UZMANLIK_ADI from UZMANLIK_ALANLARI "+orderBy;
      			dbComm = db.GetSqlStringCommand(sqlText);
     return db.ExecuteReader(dbComm);
 }
        public bool DeleteTrServicedetailsInfoById(object param, Database db, DbTransaction transaction)
        {
            string sql = "DELETE FROM TR_ServiceDetails WHERE Id=@Id";
            DbCommand dbCommand = db.GetSqlStringCommand(sql);
            db.AddInParameter(dbCommand, "Id", DbType.String, param);

            db.ExecuteNonQuery(dbCommand, transaction);
            return true;
        }
Пример #25
0
        protected virtual System.Data.Common.DbCommand CreateCommand(string commandText)
        {
            if (string.IsNullOrWhiteSpace(commandText))
                throw new ArgumentNullException();

            dbConnection = CreateDB();
            System.Data.Common.DbCommand cmd = dbConnection.GetSqlStringCommand(commandText);
            return cmd;
        }
Пример #26
0
        /// <summary>
        /// Method to Get AutoNumber
        /// </summary>
        /// <param name="Description">Description as Input</param>
        /// <returns>Returns AutoNumber</returns>
        public string GetAutoNumber(string Description)
        {
            string AutoNo   = "";
            int    CurNo    = 0;
            int    NoDigit  = 0;
            int    AutoCode = 0;
            int    i        = 0;
            string SqlStr;

            SqlStr = "select * from SAS_AutoNumber where SAAN_Des='" + Description + "'";

            try
            {
                Microsoft.Practices.EnterpriseLibrary.Data.Database loDbAut = DatabaseFactory.CreateDatabase(csConnectionStr);
                DbCommand   cmd      = loDbAut.GetSqlStringCommand(SqlStr);
                IDataReader loReader = loDbAut.ExecuteReader(cmd);

                if (loReader.Read())
                {
                    AutoCode = Convert.ToInt32(loReader["SAAN_Code"]);
                    CurNo    = Convert.ToInt32(loReader["SAAN_CurNo"]) + 1;
                    NoDigit  = Convert.ToInt32(loReader["SAAN_NoDigit"]);
                    AutoNo   = Convert.ToString(loReader["SAAN_Prefix"]);
                    if (CurNo.ToString().Length < NoDigit)
                    {
                        while (i < NoDigit - CurNo.ToString().Length)
                        {
                            AutoNo = AutoNo + "0";
                            i      = i + 1;
                        }
                        AutoNo = AutoNo + CurNo;
                    }
                    loReader.Close();
                }

                AutoNumberEn loItem = new AutoNumberEn();
                loItem.SAAN_Code = AutoCode;
                AutoNumberDAL cods = new AutoNumberDAL();
                cods.GetItem(loItem);

                loItem.SAAN_Code   = Convert.ToInt32(AutoCode);
                loItem.SAAN_CurNo  = CurNo;
                loItem.SAAN_AutoNo = AutoNo;


                cods.Update(loItem);


                return(AutoNo);
            }

            catch (Exception ex)
            {
                Console.Write("Error in connection : " + ex.Message);
                return(ex.ToString());
            }
        }
        public void SetUp()
        {
            EnvironmentHelper.AssertOracleClientIsInstalled();
            DatabaseProviderFactory factory = new DatabaseProviderFactory(OracleTestConfigurationSource.CreateConfigurationSource());
            db = factory.Create("OracleTest");
            DbCommand command = db.GetSqlStringCommand("Select count(*) from region");

            baseFixture = new ExecuteScalarFixture(db, command);
        }
 public int Delete(int katilimciId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE KATILIMCI_ANKET_CEVAP_ARATABLO where KATILIMCI_ID=@katilimciId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@katilimciId", DbType.Int32, katilimciId);
     KatilimciAnketCevapAratablo nesne = new KatilimciAnketCevapAratablo();
     nesne.KatilimciId = katilimciId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
 public int Delete(int anketId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ANKET_SORU_ARATABLO where ANKET_ID=@anketId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@anketId", DbType.Int32, anketId);
     AnketSoruAratablo nesne = new AnketSoruAratablo();
     nesne.AnketId = anketId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE UZMANLIK_ALANLARI where ID=@id ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     UzmanlikAlanlari nesne = new UzmanlikAlanlari();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #31
0
 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ORGANIZASYON where ID=@id ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     Organizasyon nesne = new Organizasyon();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
 public int Delete(int secenekId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE SORU_SECENEK_ARATABLO where SECENEK_ID=@secenekId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@secenekId", DbType.Int32, secenekId);
     SoruSecenekAratablo nesne = new SoruSecenekAratablo();
     nesne.SecenekId = secenekId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #33
0
 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE SECENEK_TIP where ID=@id ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     SecenekTip nesne = new SecenekTip();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #34
0
 public int Delete(int id,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ANKET where ID=@id ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@id", DbType.Int32, id);
     Anket nesne = new Anket();
     nesne.Id = id;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #35
0
 public int DeleteByKulupId(Int32 kulupId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ORGANIZASYON where KULUP_ID=@kulupId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@kulupId", DbType.Int32, kulupId);
     Organizasyon nesne=new Organizasyon();
     nesne.Id=-1;
     nesne.KulupId=kulupId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
 public int DeleteByUzmanlikAlaniId(Int32 uzmanlikAlaniId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE KATILIMCI_UZMANLIK_ARATABLO where UZMANLIK_ALANI_ID=@uzmanlikAlaniId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@uzmanlikAlaniId", DbType.Int32, uzmanlikAlaniId);
     KatilimciUzmanlikAratablo nesne=new KatilimciUzmanlikAratablo();
     nesne.KatilimciId=-1;
     nesne.UzmanlikAlaniId=uzmanlikAlaniId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
 public int DeleteByOrganizasyonId(Int32 organizasyonId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE KATILIMCI_ORGANIZASYON_ARATABLO where ORGANIZASYON_ID=@organizasyonId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@organizasyonId", DbType.Int32, organizasyonId);
     KatilimciOrganizasyonAratablo nesne=new KatilimciOrganizasyonAratablo();
     nesne.KatilimciId=-1;
     nesne.OrganizasyonId=organizasyonId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #38
0
 public int DeleteBySecenekTip(Int32 secenekTip,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE SORU where SECENEK_TIP=@secenekTip ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@secenekTip", DbType.Int32, secenekTip);
     Soru nesne=new Soru();
     nesne.Id=-1;
     nesne.SecenekTip=secenekTip;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #39
0
 public int DeleteByOrganizasyonId(Int32 organizasyonId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE ANKET where ORGANIZASYON_ID=@organizasyonId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@organizasyonId", DbType.Int32, organizasyonId);
     Anket nesne=new Anket();
     nesne.Id=-1;
     nesne.OrganizasyonId=organizasyonId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #40
0
 public int DeleteByDuyuruTipId(Int32 duyuruTipId,DbTransaction dbTransaction,Database db)
 {
     sqlText="DELETE DUYURU where DUYURU_TIP_ID=@duyuruTipId ";
      			dbComm = db.GetSqlStringCommand(sqlText);
     db.AddInParameter(dbComm, "@duyuruTipId", DbType.Int32, duyuruTipId);
     Duyuru nesne=new Duyuru();
     nesne.Id=-1;
     nesne.DuyuruTipId=duyuruTipId;
     return base.Delete(nesne, dbComm, dbTransaction, db);
 }
Пример #41
0
 /// <summary>
 /// 获取指定表名的架构信息
 /// </summary>
 /// <param name="db"></param>
 /// <param name="tableName"></param>
 /// <returns></returns>
 public static DataTable GetSchema(Database db, string tableName)
 {
     DbDataAdapter ap = db.GetDataAdapter();
     DbCommand cmd = db.GetSqlStringCommand(string.Format("SELECT * FROM {0}", tableName));
     cmd.Connection = db.CreateConnection();
     ap.SelectCommand = cmd;
     DataTable t = new DataTable();
     ap.FillSchema(t, SchemaType.Mapped);
     return t;
 }
Пример #42
0
        public bool ActualizarPersonalTiemposDeAlimentacion(PersonalTiemposDeAlimentacion personalTiemposDeAlimentacion)
        {
            stringBuilder = new StringBuilder();
            stringBuilder.AppendLine("UPDATE TblPersonalTiemposDeAlimentacion SET NumeroDeEmpleado=@NumeroDeEmpleado,Fecha=@Fecha,TiemposDeAlimentacionID=@TiemposDeAlimentacionID,ModuloHabitacional=@ModuloHabitacional");
            stringBuilder.AppendLine(" WHERE PersonalTiemposDeAlimentacionID=@PersonalTiemposDeAlimentacionID");
            DbCommand cmd = Database.GetSqlStringCommand(stringBuilder.ToString());

            Database.AddInParameter(cmd, "NumeroDeEmpleado", DbType.String, personalTiemposDeAlimentacion.NumeroDeEmpleado);
            Database.AddInParameter(cmd, "Fecha", DbType.DateTime, personalTiemposDeAlimentacion.Fecha);
            Database.AddInParameter(cmd, "TiemposDeAlimentacionID", DbType.Int16, personalTiemposDeAlimentacion.TiemposDeAlimentacionID);
            Database.AddInParameter(cmd, "ModuloHabitacional", DbType.Int16, personalTiemposDeAlimentacion.ModuloHabitacional);
            Database.AddInParameter(cmd, "PersonalTiemposDeAlimentacionID", DbType.Int32, personalTiemposDeAlimentacion.PersonalTiemposDeAlimentacionID);
            if (Database.ExecuteNonQuery(cmd) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #43
0
Файл: h.cs Проект: ghconn/mich
 /// <summary>
 /// ExecuteNonQuery 数据添加、修改、删除
 /// </summary>
 /// <param name="cmdType">SqlCommand命令类型 (存储过程, T-SQL语句, 等等。)</param>
 /// <param name="cmdText">存储过程的名字或者 T-SQL 语句</param>
 /// <param name="commandParameters">以数组形式提供SqlCommand命令中用到的参数列表</param>
 /// <returns>受影响的行数</returns>
 public int ExecuteNonQuery(CommandType cmdType, string cmdText, params IDbDataParameter[] commandParameters)
 {
     try
     {
         this.Open();
         if (cmdType == CommandType.StoredProcedure)
         {
             mDbCommand = mDatabase.GetStoredProcCommand(cmdText);
         }
         else
         {
             mDbCommand = mDatabase.GetSqlStringCommand(cmdText);
         }
         mDbCommand.Connection = Connection;
         if (Transaction != null)
         {
             mDbCommand.Transaction = Transaction;
         }
         if ((commandParameters != null) && (commandParameters.Length > 0))
         {
             foreach (IDbDataParameter mParameter in commandParameters)
             {
                 mDatabase.AddParameter(mDbCommand, mParameter.ParameterName, mParameter.DbType, mParameter.Direction, mParameter.SourceColumn, mParameter.SourceVersion, mParameter.Value);
             }
         }
         return(mDbCommand.ExecuteNonQuery());
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
     finally
     {
         if (Transaction == null)
         {
             this.Close();
         }
     }
 }
        public void GetTiemposDeAlimentacion(int TiemposDeAlimentacionID)
        {
            DatabaseProviderFactory databaseProviderFactory = new DatabaseProviderFactory();

            Microsoft.Practices.EnterpriseLibrary.Data.Database database = databaseProviderFactory.Create("DefaultConnection");
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("SELECT  Nombre FROM TblTiemposDeAlimentacion WHERE TiemposDeAlimentacionID=@PTiemposDeAlimentacionID");
            DbCommand command = database.GetSqlStringCommand(stringBuilder.ToString());

            database.AddInParameter(command, "PTiemposDeAlimentacionID", System.Data.DbType.String, TiemposDeAlimentacionID);
            Nombre = database.ExecuteScalar(command).ToString();
        }
Пример #45
0
        public void GetModuloHabitacional(string ModuloHabitacionalID)
        {
            DatabaseProviderFactory databaseProviderFactory = new DatabaseProviderFactory();

            Microsoft.Practices.EnterpriseLibrary.Data.Database database = databaseProviderFactory.Create("DefaultConnection");
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("SELECT  Nombre FROM TblModulosHabitacionales WHERE ModuloHabitacional=@PModuloHabitacional");
            DbCommand command = database.GetSqlStringCommand(stringBuilder.ToString());

            database.AddInParameter(command, "PModuloHabitacional", System.Data.DbType.String, ModuloHabitacionalID);
            Nombre = database.ExecuteScalar(command).ToString();
        }
Пример #46
0
 /// <summary>
 /// 查询数据库是否有对应记录(是否唯一)
 /// </summary>
 /// <param name="_db"></param>
 /// <param name="_tablename">>注意表名要用数据库全称</param>
 /// <param name="_sqlwhere">限定语句,必须and开头,可留空</param>
 /// <returns></returns>
 public static bool UniversalizationGetUnique(Microsoft.Practices.EnterpriseLibrary.Data.Database _db, string _tablename, string _sqlwhere)
 {
     try
     {
         var ds  = new DataSet();
         var sql = "select * from " + _tablename + " where 1=1 " + _sqlwhere;
         var cmd = _db.GetSqlStringCommand(sql);
         _db.LoadDataSet(cmd, ds, _tablename);
         return(ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #47
0
 /// <summary>
 /// 根据条件where获取单表
 /// </summary>
 /// <param name="_db"></param>
 /// <param name="_tablename">注意表名要用数据库全称</param>
 /// <param name="_sqlwhere">限定语句,必须and开头,可留空</param>
 /// <returns></returns>
 public static T UniversalizationGetwhere <T>(Microsoft.Practices.EnterpriseLibrary.Data.Database _db, string _tablename, string _sqlwhere)
 {
     try
     {
         var sql   = "select * from " + _tablename + " where 1=1 " + _sqlwhere;
         var model = Activator.CreateInstance <T>();
         var cmd   = _db.GetSqlStringCommand(sql);
         //注意:如果需要使返回的table名不含有数据库表的限定名,则如下:
         if (_tablename.Contains("."))
         {
             _tablename = (_tablename.Split('.'))[(_tablename.Split('.')).Length - 1];
         }
         if (_tablename.StartsWith("["))
         {
             _tablename = _tablename.Substring(1, _tablename.Length - 2);
         }
         _db.LoadDataSet(cmd, model as DataSet, _tablename);//return回来的dataset表名
         return(model);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #48
0
        public object ExecuteScalar(string query, CommandType commandType, List <IDbDataParameter> parameters)
        {
            DbConnection _connection;

            _connection = _database.CreateConnection();
            _connection.Open();
            var cmd = commandType == CommandType.StoredProcedure ? _database.GetStoredProcCommand(query) : _database.GetSqlStringCommand(query);

            cmd.CommandTimeout = 300;
            cmd.Connection     = _connection;
            using (cmd)
            {
                if (parameters != null && parameters.Count > 0)
                {
                    cmd.Parameters.AddRange(parameters.ToArray());
                }
                return(_database.ExecuteScalar(cmd));
            }
        }
Пример #49
0
        /// <summary>
        /// 获取待办事项明细信息
        /// </summary>
        public List <string> LoadPendingMatterDetailInfo()
        {
            string SQLApplyBasis = string.Empty;

            //if (basepage.CurrUserInfo().RoleName.Contains("运营专员"))
            //{
            //    SQLApplyBasis = SQLWhere("ApplyList.aspx");
            //}

            SQLApplyBasis = SQLWhere("/ApplyList.aspx");

            //else if (basepage.CurrUserInfo().RoleName.Contains("初审专员"))
            //{ SQLApplyBasis = SQLWhere("AuditInstructionsList.aspx?step=1"); }
            //else if (basepage.CurrUserInfo().RoleName.Contains("信贷专员"))
            //{ SQLApplyBasis = SQLWhere("AuditInstructionsList.aspx?step=2"); }
            //else if (basepage.CurrUserInfo().RoleName.Contains("信贷主管"))
            //{ SQLApplyBasis = SQLWhere("AuditInstructionsList.aspx?step=3"); }
            //else if (basepage.CurrUserInfo().RoleName.Contains("贷前审核"))
            //{ SQLApplyBasis = SQLWhere("AuditInstructionsList.aspx?step=5"); }
            //else if (basepage.CurrUserInfo().RoleName.Contains("财务放款"))
            //{ SQLApplyBasis = SQLWhere("AuditInstructionsList.aspx?step=6"); }


            //string SQLApplyBasis = SQLWhere("ApplyList.aspx");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=1");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=2");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=3");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=4");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=5");
            //SQLApplyBasis += SQLWhere("AuditInstructionsList.aspx?step=6");
            SQLApplyBasis = SQLApplyBasis.Replace("'", "''");

            List <string> PendingMatterList = new List <string>();//待办事项集合
            string        sqlString         = "exec GetPendingMatterRecordDetail '" + basepage.CurrUserInfo().RoleID + "','" + basepage.CurrUserInfo().UserID + "','" + SQLApplyBasis + "'";

            Microsoft.Practices.EnterpriseLibrary.Data.Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(sqlString);
            DataSet   ds        = db.ExecuteDataSet(dbCommand);

            if (ds != null)
            {
                if (ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        string trStr = "";
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            trStr  = "";
                            trStr += "<tr>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\"><img src=\"/Images/Desktop/audit.png\" /></td>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["Stauts"].ToString() + "</td>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["ApplyBasis_Code"].ToString() + "</td>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["ApplyBasis_Name"].ToString() + "</td>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["VehicleTypeName"].ToString() + "</td>";
                            //trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["CustomProduct_Loan"].ToString() + "</td>";
                            trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + ds.Tables[0].Rows[i]["ApplyBasis_Date"].ToString() + "</td>";
                            //trStr += "<td align=center style=\"border-bottom:1pt dotted\">" + GetAuditUrl(ds.Tables[0].Rows[i]["PendingMatter_ModuleID"].ToString(), ds.Tables[0].Rows[i]["PendingMatter_ModuleName"].ToString(), ds.Tables[0].Rows[i]["WorkflowTasksInstanceID"].ToString(), ds.Tables[0].Rows[i]["WorkflowTasksSetp"].ToString(), ds.Tables[0].Rows[i]["ApplyBasis_Type"].ToString(), ds.Tables[0].Rows[i]["Stauts"].ToString()) + "</td>";
                            trStr += "</tr>";
                            PendingMatterList.Add(trStr);
                        }
                    }
                }
            }
            return(PendingMatterList);
        }
Пример #50
0
        /// <summary>
        /// Update  SAS_ExportData Data...
        /// <summary>
        /// <param name=sender></param>
        /// <param name= e></param>
        public bool Update(ExportDataEN argEn)
        {
            bool   lbRes  = false;
            int    iOut   = 0;
            string sqlCmd = "Select count(*) as cnt From SAS_ExportData WHERE InterfaceID = '" + argEn.InterfaceID + "'";

            try
            {
                Microsoft.Practices.EnterpriseLibrary.Data.Database loDbSel = DatabaseFactory.CreateDatabase(csConnectionStr);
                using (DbCommand cmdSel = loDbSel.GetSqlStringCommand(sqlCmd))
                {
                    using (IDataReader dr = loDbSel.ExecuteReader(cmdSel))
                    {
                        if (dr.Read())
                        {
                            iOut = GetValue <int>(dr, "cnt");
                        }
                        if (iOut < 0)
                        {
                            throw new Exception("Update Failed! No Record Exist!");
                        }
                    }
                    if (iOut != 0)
                    {
                        sqlCmd = "UPDATE SAS_ExportData SET InterfaceID = @InterfaceID, FileFormat = @FileFormat, Interface = @Interface, Frequency = @Frequency, TimeofExport = @TimeofExport, Filepath = @Filepath, PreviousData = @PreviousData,DateRange = @DateRange, DateFrom = @DateFrom, DateTo = @DateTo, LastUpdatedBy = @LastUpdatedBy, LastUpdatedDateTime = @LastUpdatedDateTime WHERE InterfaceID = @InterfaceID";
                        Microsoft.Practices.EnterpriseLibrary.Data.Database loDbUpd = DatabaseFactory.CreateDatabase(csConnectionStr);
                        using (DbCommand cmd = loDbUpd.GetSqlStringCommand(sqlCmd))
                        {
                            loDbUpd.AddInParameter(cmd, "@InterfaceID", DbType.String, argEn.InterfaceID);
                            loDbUpd.AddInParameter(cmd, "@FileFormat", DbType.String, argEn.FileFormat);
                            loDbUpd.AddInParameter(cmd, "@Interface", DbType.String, argEn.Interface);
                            loDbUpd.AddInParameter(cmd, "@Frequency", DbType.String, argEn.Frequency);
                            loDbUpd.AddInParameter(cmd, "@TimeofExport", DbType.String, argEn.TimeofExport);
                            loDbUpd.AddInParameter(cmd, "@Filepath", DbType.String, argEn.Filepath);
                            loDbUpd.AddInParameter(cmd, "@PreviousData", DbType.Boolean, argEn.PreviousData);
                            loDbUpd.AddInParameter(cmd, "@DateRange", DbType.Boolean, argEn.DateRange);
                            loDbUpd.AddInParameter(cmd, "@DateFrom", DbType.DateTime, argEn.DateFrom);
                            loDbUpd.AddInParameter(cmd, "@DateTo", DbType.DateTime, argEn.DateTo);
                            loDbUpd.AddInParameter(cmd, "@LastUpdatedBy", DbType.String, argEn.LastUpdatedBy);
                            loDbUpd.AddInParameter(cmd, "@LastUpdatedDateTime", DbType.DateTime, argEn.LastUpdatedDateTime);
                            int liRowAffected = loDbUpd.ExecuteNonQuery(cmd);
                            if (liRowAffected > -1)
                            {
                                System.Messaging.Message mm = new System.Messaging.Message(argEn, new System.Messaging.XmlMessageFormatter(new Type[] { typeof(ExportDataEN), typeof(string) }));
                                mm.Label = argEn.InterfaceID;
                                MessageQueueTransaction Transaction = new MessageQueueTransaction();
                                Transaction.Begin();
                                mq.Send(mm, Transaction);
                                Transaction.Commit();
                                lbRes = true;
                            }
                            else
                            {
                                throw new Exception("Update Failed! No Row has been updated...");
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lbRes);
        }