コード例 #1
0
        public bool DeleteMasProjItemBidding(MAS_PROJECTITEMBIDDING data)
        {
            IDbConnection conn = null;
            bool          ret  = false;

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();

                Mas_ProjectITemBiddingBL bl = new Mas_ProjectITemBiddingBL(conn);
                ret = bl.DeleteData(data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
コード例 #2
0
        public INF_BIDDINGS GetInfBidding(string BiddingNo)
        {
            IDbConnection conn = null;
            INF_BIDDINGS  ret  = new INF_BIDDINGS();

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();

                Mas_ProjectITemBiddingBL bl = new Mas_ProjectITemBiddingBL(conn);
                ret = bl.GetInfBidding(BiddingNo);
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }
コード例 #3
0
        public string InsertMasProjtBidding(MAS_PROJECTBIDDING data, List <MAS_PROJECTITEMBIDDING> lItemData)
        {
            Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US");

            IDbConnection  conn = null;
            IDbTransaction tran = null;

            string ret = string.Empty;

            try
            {
                //SET CONNECTION
                conn = ConnectionFactory.GetConnection();
                conn.ConnectionString = ConfigurationManager.GetConfiguration().DbConnectionString;

                //OPEN CONNECTION
                conn.Open();
                tran = conn.BeginTransaction(IsolationLevel.Serializable);

                Mas_ProjectBiddingBL     bidBL  = new Mas_ProjectBiddingBL(conn, tran);
                Mas_ProjectITemBiddingBL itemBl = new Mas_ProjectITemBiddingBL(conn, tran);

                string pkProjectBD = string.Empty;
                pkProjectBD = bidBL.InsertData(data);
                if (!string.IsNullOrWhiteSpace(pkProjectBD))
                {
                    ret = pkProjectBD;

                    foreach (MAS_PROJECTITEMBIDDING item in lItemData)
                    {
                        MAS_PROJECTITEMBIDDING insItem = new MAS_PROJECTITEMBIDDING();
                        insItem.ProjectNo   = pkProjectBD;
                        insItem.ItemColumn1 = item.ItemColumn1;
                        insItem.ItemColumn2 = item.ItemColumn2;
                        insItem.ItemColumn3 = item.ItemColumn3;
                        insItem.ItemColumn4 = item.ItemColumn4;
                        insItem.ItemColumn5 = item.ItemColumn5;
                        insItem.ItemColumn6 = item.ItemColumn6;
                        insItem.ItemColumn7 = item.ItemColumn7;
                        insItem.ItemColumn8 = item.ItemColumn8;

                        insItem.CreatedBy   = data.CreatedBy;
                        insItem.CreatedDate = DateTime.Now;
                        insItem.UpdatedBy   = data.UpdatedBy;
                        insItem.UpdatedDate = DateTime.Now;

                        itemBl.InsertData(insItem);
                    }
                }

                tran.Commit();
            }
            catch (Exception ex)
            {
                tran.Rollback();

                ret = string.Empty;

                logger.Error(ex.Message);
                logger.Error(ex.StackTrace);
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }

                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    conn.Dispose();
                }
            }

            return(ret);
        }