예제 #1
0
        public List <CustomerAgreementVo> findToPrimaryKey(string companyCode, string customerCode)
        {
            var           resultList = new List <CustomerAgreementVo>();
            StringBuilder s          = new StringBuilder();

            s.Append("SELECT * FROM [dbo].[M_取引先契約書]");
            using (SqlCommand sql = new SqlCommand(s.ToString(), this.conn))
            {
                using (SqlDataReader dr = sql.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        var vo = new CustomerAgreementVo();
                        vo.companyCode = dr.GetString(0);
                        resultList.Add(vo);
                    }
                }
            }
            return(resultList);
        }
예제 #2
0
        public void insert(CustomerAgreementVo vo)
        {
            StringBuilder s = new StringBuilder();

            s.Append("INSERT INTO [dbo].[M_取引先契約書] VALUES(");
            s.Append("@companyCode,");
            s.Append("@customerCode,");
            s.Append("@customerKbn,");
            s.Append("@picturePath1,");
            s.Append("@picturePath2,");
            s.Append("@picturePath3,");
            s.Append("@picturePath4,");
            s.Append("@picturePath5,");
            s.Append("@remarks1,");
            s.Append("@remarks2,");
            s.Append("@remarks3,");
            s.Append("@remarks4,");
            s.Append("@remarks5,");
            s.Append("@registerDateTime,");
            s.Append("@registerUserId,");
            s.Append("@update,");
            s.Append("@updateUserId,");
            s.Append("@isDelete,");
            s.Append("@delete,");
            s.Append("@deleteUserId");
            s.Append(")");
            using (var tran = conn.BeginTransaction())
                using (var sql = new SqlCommand(s.ToString(), this.conn))
                {
                    sql.Parameters.AddWithValue("@companyCode", vo.companyCode);
                    sql.Parameters.AddWithValue("@customerCode", vo.customerCode);
                    sql.Parameters.AddWithValue("@customerKbn", vo.customerKbn);
                    sql.Parameters.AddWithValue("@picturePath1", vo.picturePath1);
                    sql.Parameters.AddWithValue("@picturePath2", vo.picturePath2);
                    sql.Parameters.AddWithValue("@picturePath3", vo.picturePath3);
                    sql.Parameters.AddWithValue("@picturePath4", vo.picturePath4);
                    sql.Parameters.AddWithValue("@picturePath5", vo.picturePath5);
                    sql.Parameters.AddWithValue("@remarks1", vo.remarks1);
                    sql.Parameters.AddWithValue("@remarks2", vo.remarks2);
                    sql.Parameters.AddWithValue("@remarks3", vo.remarks3);
                    sql.Parameters.AddWithValue("@remarks4", vo.remarks4);
                    sql.Parameters.AddWithValue("@remarks5", vo.remarks5);
                    sql.Parameters.AddWithValue("@registerDateTime", vo.registerDateTime);
                    sql.Parameters.AddWithValue("@registerUserId", vo.registerUserId);
                    sql.Parameters.AddWithValue("@updateDateTime", vo.updateDateTime);
                    sql.Parameters.AddWithValue("@updateUserId", vo.updateUserId);
                    sql.Parameters.AddWithValue("@isDelete", vo.isDelete);
                    sql.Parameters.AddWithValue("@deleteDateTime", vo.deleteDateTime);
                    sql.Parameters.AddWithValue("@deleteUserId", vo.deleteUserId);
                    try
                    {
                        sql.ExecuteNonQuery();
                        tran.Commit();
                    }
                    catch
                    {
                        tran.Rollback();
                        throw;
                    }
                    finally
                    {
                    }
                }
        }